/* LESO LABS Support Dashboard - Professional LESOLABS Design */

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

:root {
    /* LESO Labs Brand Colors */
    --color-bg: #050a10;
    --color-bg-light: #0a1628;
    --color-primary: #2d628c;
    --color-primary-dark: #1e4a6d;
    --color-accent: #3a7cb0;
    --color-accent-glow: #5a9fd4;
    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.6);
    --color-border: rgba(45, 98, 140, 0.2);
    --color-border-hover: rgba(45, 98, 140, 0.5);
    
    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    
    /* Typography */
    --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(90, 159, 212, 0.3);
    --glow-hover: 0 0 30px rgba(90, 159, 212, 0.5);
    
    /* Spacing */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 24px;
}

html {
    scroll-behavior: smooth;
}

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

.container {
    max-width: 1800px;
    margin: 0 auto;
}

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

header {
    background: rgba(10, 22, 40, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    padding: 16px 32px;
    border-radius: var(--radius);
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-left h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.header-left h1 .logo-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(var(--glow-primary));
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-left: 44px;
}

.app-selector-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-selector-container label {
    font-weight: 600;
    color: var(--color-text);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.app-selector {
    padding: 10px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(10px);
    cursor: pointer;
    min-width: 200px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--color-text);
}

.app-selector:hover {
    border-color: var(--color-border-hover);
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

.app-selector:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--glow-hover);
}

/* User Info (Authentication) */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 20px;
    padding-right: 20px;
    border-right: 1px solid var(--color-border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
}

.user-email {
    font-size: 13px;
    color: var(--color-text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* ==========================================
   STATS GRID - GLASSMORPHIC CARDS
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
    margin-bottom: 48px;
}

.stat-card {
    background: rgba(10, 22, 40, 0.5);
    backdrop-filter: blur(20px);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent-glow));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(90, 159, 212, 0.1), transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-lg), var(--glow-hover);
    border-color: var(--color-border-hover);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card:active {
    transform: translateY(-3px) scale(1.01);
}

.stat-icon {
    display: none;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
    font-family: var(--font-heading);
    margin-bottom: 6px;
}

.stat-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 400;
}

/* ==========================================
   TICKETS SECTION
   ========================================== */

.tickets-section {
    background: rgba(10, 22, 40, 0.5);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-body);
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-border-hover);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    text-align: center;
}

/* ==========================================
   TICKETS LIST
   ========================================== */

#tickets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 28px;
}

.ticket-card {
    background: rgba(15, 26, 46, 0.6);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.ticket-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-accent-glow));
    border-radius: var(--radius) 0 0 var(--radius);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ticket-card:hover {
    border-color: var(--color-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), 0 0 30px rgba(45, 98, 140, 0.2);
}

.ticket-card:hover::before {
    opacity: 1;
}

.ticket-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ticket-number {
    font-weight: 700;
    color: var(--color-accent-glow);
    font-size: 15px;
    font-family: var(--font-heading);
}

.ticket-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--color-text);
    line-height: 1.4;
}

.ticket-preview {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 18px;
}

.ticket-meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   BADGES
   ========================================== */

.badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.badge-open {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-in_progress,
.badge-progress {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-waiting,
.badge-waiting_user {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-resolved {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-closed {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.badge-app {
    background: linear-gradient(135deg, var(--color-accent-glow), var(--color-primary));
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 0 16px rgba(90, 159, 212, 0.4);
    border: none;
}

/* ==========================================
   TICKET DETAIL
   ========================================== */

.ticket-detail {
    background: rgba(10, 22, 40, 0.5);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 32px;
}

/* ==========================================
   MESSAGES
   ========================================== */

.messages-column {
    display: flex;
    flex-direction: column;
}

.messages-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.05em;
}

.messages-container {
    background: rgba(5, 10, 16, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 28px;
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: 28px;
    border: 1px solid var(--color-border);
}

.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(45, 98, 140, 0.5);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 98, 140, 0.7);
}

.message {
    margin-bottom: 24px;
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    backdrop-filter: blur(20px);
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.message:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.message-user {
    background: rgba(10, 22, 40, 0.6);
    border-color: rgba(90, 159, 212, 0.3);
}

.message-admin {
    background: rgba(45, 98, 140, 0.15);
    border-color: var(--color-primary);
}

.message-ai {
    background: rgba(90, 159, 212, 0.1);
    border-color: var(--color-accent-glow);
}

.message-ai::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent-glow));
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.message-time {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
}

.message-content {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    white-space: pre-wrap;
}

.ai-badge {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================
   REPLY BOX
   ========================================== */

.reply-box {
    background: rgba(10, 22, 40, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.reply-box textarea {
    width: 100%;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 18px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(5, 10, 16, 0.8);
    backdrop-filter: blur(10px);
    color: var(--color-text);
}

.reply-box textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--glow-primary);
    background: rgba(5, 10, 16, 0.95);
}

.reply-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================
   INFO COLUMN
   ========================================== */

.info-column {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.info-card {
    background: rgba(15, 26, 46, 0.6);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.info-card h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--color-text);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 14px;
    gap: 16px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    color: var(--color-text-muted);
    font-weight: 600;
}

.info-row span:last-child {
    text-align: right;
    color: var(--color-text);
    font-weight: 500;
}

/* ==========================================
   LOADING & EMPTY STATES
   ========================================== */

.loading,
.empty-state,
.error {
    text-align: center;
    padding: 80px 40px;
    color: var(--color-text-muted);
    font-size: 16px;
}

.loading::before {
    content: '⏳';
    display: block;
    font-size: 56px;
    margin-bottom: 20px;
    filter: drop-shadow(var(--glow-primary));
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 56px;
    margin-bottom: 20px;
}

.error {
    color: var(--color-danger);
}

.error::before {
    content: '⚠️';
    display: block;
    font-size: 56px;
    margin-bottom: 20px;
}

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

@media (max-width: 1400px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .info-column {
        order: -1;
    }
}

@media (max-width: 1024px) {
    #tickets-list {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 28px;
    }
    
    .subtitle {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ticket-card {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
.stat-card:nth-child(6) { animation-delay: 0.30s; }

/* ==========================================
   KNOWLEDGE BASE MANAGEMENT
   ========================================== */

.kb-section {
    background: rgba(10, 22, 40, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-top: 48px;
    box-shadow: var(--shadow-lg);
}

.kb-section h2 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.kb-description {
    color: var(--color-text-muted);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.6;
}

.kb-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.kb-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.kb-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glow-primary);
}

.kb-btn svg {
    flex-shrink: 0;
}

.kb-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    margin-left: auto;
}

.kb-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.kb-checkbox span {
    font-size: 14px;
    font-weight: 500;
}

.kb-status {
    display: none;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    border-left: 4px solid;
}

.kb-status-success {
    background: rgba(16, 185, 129, 0.15);
    border-left-color: var(--color-success);
    color: var(--color-success);
}

.kb-status-error {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: var(--color-danger);
    color: var(--color-danger);
}

.kb-status-info {
    background: rgba(45, 98, 140, 0.15);
    border-left-color: var(--color-primary);
    color: var(--color-primary);
}

.kb-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.kb-stat-card {
    background: rgba(5, 10, 16, 0.6);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.kb-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-hover);
}

.kb-stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-accent-glow);
    margin-bottom: 8px;
    font-family: var(--font-heading);
}

.kb-stat-label {
    font-size: 13px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
