* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Login Screen */
.screen {
    display: none !important;
}

.screen.active {
    display: block !important;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 48px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: #1a202c;
}

.subtitle {
    color: #718096;
    margin-bottom: 32px;
    font-size: 14px;
}

/* Dashboard Layout */
#dashboardScreen {
    min-height: 100vh;
}

#dashboardScreen.active {
    display: flex;
}

.sidebar {
    width: 260px;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h2 {
    font-size: 24px;
    color: #667eea;
    margin-bottom: 4px;
}

.admin-badge {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: #f7fafc;
    color: #667eea;
}

.nav-item.active {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 4px solid #764ba2;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background-color: #f7fafc !important;
    position: relative;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    color: #1a202c;
    margin-bottom: 8px;
}

.page-header p {
    color: #718096;
    font-size: 14px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 40px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a202c;
}

.stat-label {
    font-size: 13px;
    color: #718096;
    margin-top: 4px;
}

/* Card */
.card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 18px;
    color: #1a202c;
    margin-bottom: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-block {
    width: 100%;
}

.filter-select {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px;
    background: #f7fafc;
    color: #4a5568;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-warning {
    background: #feebc8;
    color: #7c2d12;
}

.badge-info {
    background: #bee3f8;
    color: #2c5282;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

/* Error Message */
.error-message {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 12px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Metric Value */
.metric-value {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
    margin: 16px 0;
}

/* Feature List */
.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-name {
    font-weight: 500;
    color: #1a202c;
}

.feature-count {
    color: #667eea;
    font-weight: 600;
}

/* Ticket Item */
.ticket-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid #667eea;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ticket-id {
    font-weight: 600;
    color: #1a202c;
}

.ticket-meta {
    font-size: 13px;
    color: #718096;
    margin-bottom: 8px;
}

.ticket-description {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 12px;
}

.ticket-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #718096;
}

/* Modern Ticket Detail Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

/* Modern Ticket Detail Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content.large-modal {
    background: #fff;
    margin: 2vh auto;
    width: 95%;
    max-width: 1100px;
    height: 96vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.modal-header {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 20;
    height: 60px;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 18px;
    color: #1a202c;
    font-weight: 600;
}

.close-modal {
    color: #cbd5e0;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 4px;
}

.close-modal:hover {
    color: #4a5568;
}

/* Modal Body Layout */
.modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #f8fafc;
}

.ticket-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling */
.ticket-sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px;
    gap: 32px;
    flex-shrink: 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section.grow {
    flex: 1;
}

.sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-group label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.description-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
}

/* User Profile Compact */
.user-profile-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #edf2f7;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-muted {
    font-size: 12px;
    color: #94a3b8;
}

/* Conversation Area */
.ticket-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    min-width: 0;
    /* Prevent flex item overflow */
}

/* Messages */
.messages-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: messageSlide 0.2s ease;
}

.message-user {
    align-self: flex-start;
}

.message-admin {
    align-self: flex-end;
    align-items: flex-end;
}

.message-content {
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-user .message-content {
    background: white;
    color: #1e293b;
    border-top-left-radius: 2px;
    border: 1px solid #e2e8f0;
}

.message-admin .message-content {
    background: #3b82f6;
    /* Corporate Blue */
    color: white;
    border-top-right-radius: 2px;
}

.message-meta {
    margin-top: 6px;
    font-size: 11px;
    color: #94a3b8;
}

/* Reply Box Modernized */
.reply-box {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.reply-header span {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.status-select-sm {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    background: #f8fafc;
    cursor: pointer;
}

.reply-box textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    min-height: 100px;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

.reply-box textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.reply-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.toolbar-icons {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    font-size: 16px;
    color: #64748b;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.send-icon {
    font-size: 12px;
}

.reply-actions select {
    width: auto;
    min-width: 150px;
    padding: 10px 36px 10px 16px;
    background-color: #f7fafc;
    border-color: #e2e8f0;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Status colors */
.status-running { color: #48bb78 !important; }
.status-stopped { color: #a0aec0 !important; }
.status-error { color: #f56565 !important; }
.status-starting { color: #ecc94b !important; }

/* Small buttons */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.btn-xs:hover {
    transform: translateY(-1px);
}

.icon-btn-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.icon-btn-sm:hover {
    opacity: 1;
}

.btn-danger {
    background: #f56565 !important;
    color: white !important;
}

.btn-danger:hover {
    background: #e53e3e !important;
}

/* Console Styling */
.console-card {
    border: 1px solid #333;
    overflow: hidden;
    margin-top: 20px;
}

#consoleOutput::-webkit-scrollbar {
    width: 8px;
}

#consoleOutput::-webkit-scrollbar-track {
    background: #1e1e1e;
}

#consoleOutput::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#consoleOutput::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Table Search Input */
.form-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.text-muted {
    color: #a0aec0;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
}