/* ========================================
   TICKET TRIAGE SYSTEM - STYLES
   Modern, Premium Design
   ======================================== */

:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --accent: #f59e0b;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Neutral Colors */
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-info: linear-gradient(135deg, #3b82f6, #60a5fa);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.5rem;
    background: var(--gradient-primary);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========================================
   TICKET FORM
   ======================================== */

/* Solution Section Styles */
.solution-section {
    margin-bottom: 2rem;
}

.solution-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.solution-card .card-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.solution-badge {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
}

.badge-generated {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-retrieved {
    background: #dcfce7;
    color: #15803d;
}

.badge-escalated {
    background: #fee2e2;
    color: #b91c1c;
}

/* Progressive streaming states */
.badge-processing {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.badge-solving {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Animated solving dots */
.solving-dots span {
    display: inline-block;
    animation: solvingBounce 1.2s infinite;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--primary-light);
    margin: 0 1px;
}

.solving-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.solving-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes solvingBounce {

    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

.solving-pulse {
    color: var(--text-secondary);
    font-style: italic;
}

/* Solution card pop-in when answer arrives */
@keyframes solutionPopIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.solution-arrived {
    animation: solutionPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.solution-content {
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
}

.solution-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.confidence-label {
    font-size: 0.875rem;
    color: #64748b;
}

.confidence-label span {
    color: #0f172a;
    font-weight: 600;
}

.copy-btn {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.ticket-form-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 30px;
}

.ticket-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.submit-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESULTS SECTION
   ======================================== */

.results-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.result-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.card-icon {
    font-size: 1.3rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.priority-card .card-value {
    background: var(--gradient-warning);
    -webkit-background-clip: text;
    background-clip: text;
}

.queue-card .card-value {
    background: var(--gradient-info);
    -webkit-background-clip: text;
    background-clip: text;
    font-size: 1.2rem;
}

.card-confidence {
    display: flex;
    align-items: center;
    gap: 12px;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-success);
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

.confidence-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--success);
    min-width: 45px;
}

/* ========================================
   TAGS SECTION
   ======================================== */

.tags-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.tags-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(129, 140, 248, 0.1);
    color: var(--primary-light);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(129, 140, 248, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tag:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.tag-score {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

/* ========================================
   DASHBOARD LAYOUT (HORIZONTAL)
   ======================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left,
.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.navbar h2 {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 20px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

.nav-item {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* CTA Button */
.nav-item.cta-button {
    background: var(--gradient-primary);
    color: white;
    padding: 10px 20px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: none;
    transform: translateY(0);
}

.nav-item.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    color: white;
}

.nav-item.cta-button.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

/* Standalone CTA Button (for usage outside navbar) */
.cta-button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-family);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    filter: brightness(1.1);
}

.cta-button:active {
    transform: translateY(0);
}

.cta-button.danger {
    background: var(--gradient-danger);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.cta-button.danger:hover {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    filter: brightness(1.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-info);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Main Content Area */
.dashboard-main {
    flex: 1;
    margin-left: 0;
    /* Reset margin */
    padding: 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.icon-green {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.05);
    color: #a78bfa;
}

.icon-orange {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-change.positive {
    color: var(--success);
}

/* Recent Activity */
.recent-activity {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recent-activity h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-table td {
    padding: 16px 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-table tr:last-child td {
    border-bottom: none;
}

.status-resolved {
    color: var(--success);
}

.status-pending {
    color: var(--warning);
}

.status-escalated {
    color: var(--danger);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-incident {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.badge-request {
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
}

.badge-problem {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

/* Placeholder Views */
.placeholder-content {
    text-align: center;
    padding: 60px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.placeholder-content h2 {
    margin-bottom: 10px;
}

.placeholder-content p {
    color: var(--text-secondary);
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }

    .sidebar h2,
    .nav-item span:not(.nav-icon),
    .model-status span:not(.status-dot) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .nav-icon {
        font-size: 1.4rem;
    }

    .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    .dashboard-main {
        margin-left: 80px;
    }
}

/* View Transitions */
.view-section {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-section.active {
    opacity: 1;
}

/* ========================================
   PRIORITY COLORS
   ======================================== */

.priority-high {
    color: var(--danger) !important;
    -webkit-text-fill-color: var(--danger) !important;
}

.priority-medium {
    color: var(--warning) !important;
    -webkit-text-fill-color: var(--warning) !important;
}

.priority-low {
    color: var(--success) !important;
    -webkit-text-fill-color: var(--success) !important;
}

/* ========================================
   SUBMIT ANOTHER BUTTON
   ======================================== */

.submit-another-section {
    margin-top: 30px;
    text-align: center;
}

.submit-another-btn {
    background: transparent;
    color: var(--primary-light);
    border: 2px solid var(--primary);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.submit-another-btn:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ========================================
   HISTORY VIEW STYLES
   ======================================== */

.history-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-style: italic;
}

.history-row {
    transition: background 0.2s ease;
}

.history-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 10% auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.ticket-summary {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: var(--radius-md);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.summary-item .label {
    color: var(--text-secondary);
}

.summary-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

.ticket-solution h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.ticket-solution p {
    color: var(--text-primary);
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* Chat UI Improvements */
.chat-input-area {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

#chatInput {
    flex-grow: 1;
    height: 50px;
    resize: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    padding: 8px;
}

#chatInput:focus {
    outline: none;
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.send-btn span {
    display: none;
}

.send-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: var(--shadow-glow);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Centered Chat Interface (Gemini/ChatGPT Style) */
.chat-interface {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 60vh;
    position: relative;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    padding-bottom: 100px;
    /* Space for floating input */
}

/* Chat Bubbles */
.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    position: relative;
    font-size: 1rem;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-bubble.ai {
    align-self: flex-start;
    background: var(--bg-card);
    /* Neutral/Dark for AI */
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.chat-meta {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

/* Floating Input Area */
.chat-input-area {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    background: var(--bg-card);
    /* Match card bg */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    /* Pill shape */
    padding: 8px 8px 8px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

#chatInput {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    height: 40px;
    /* One line height initially */
    max-height: 120px;
    padding: 8px 0;
    resize: none;
}

#chatInput:focus {
    outline: none;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* Hide scrollbar for cleaner look */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ========================================
   RESPONSIVE DATA TABLES
   ======================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

/* ========================================
   MOBILE UI OPTIMIZATIONS (< 768px)
   ======================================== */

@media (max-width: 768px) {
    /* 1. Global Spacing & Layout */
    .dashboard-main {
        padding: 15px !important;
        margin-left: 0 !important;
    }
    
    .container {
        padding: 12px;
    }
    
    .badge {
        white-space: nowrap;
    }

    /* 2. Top Navigation Bar */
    .navbar {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .navbar-left {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }

    .navbar h2 {
        font-size: 1.1rem;
        margin-right: auto;
    }
    
    .navbar-nav {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide scrollbar for nav but keep swipable */
    .navbar-nav::-webkit-scrollbar {
        height: 0px;
    }
    
    .nav-item {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .navbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 12px;
    }

    .user-profile span {
        font-size: 0.8rem;
    }

    .cta-button {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    /* 3. Grids & Cards */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .recent-activity {
        padding: 15px;
    }

    .section-header h2 {
        font-size: 1.25rem;
    }

    /* 4. Forms */
    .ticket-form-section {
        padding: 15px;
    }

    .form-group input, 
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
    }

    .submit-btn {
        width: 100%;
        padding: 14px;
    }

    /* 5. Modals */
    .modal-content.ticket-details-modal {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
    }

    .chat-interface {
        height: 50vh; /* Adjust for smaller screens */
    }

    .chat-input-area {
        width: 100%;
        bottom: 10px;
        padding: 6px 6px 6px 15px;
    }
    
    .summary-item {
        flex-direction: column;
        gap: 2px;
    }
    
    .info-row {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .status-badge {
        align-self: flex-start;
    }

    /* 6. Admin Filter Controls */
    .filter-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filter-chips-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-chips-row::-webkit-scrollbar {
        height: 0px;
    }
}

/* Very Small Devices */
@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}