/* ========================================
   MODERN PROFESSIONAL DESIGN SYSTEM
   AI Help Desk - Complete CSS
   ======================================== */

/* ========================================
   1. CSS VARIABLES & RESET
   ======================================== */

:root {
    /* Primary Colors */
    --primary: #2B7F68;
    --primary-dark: #1a5c4a;
    --primary-light: #e8f5f1;
    --primary-gradient: linear-gradient(135deg, #2B7F68 0%, #1a5c4a 100%);
    --primary-hover: #236B58;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-light: #dcfce7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-active-bg: rgba(43, 127, 104, 0.15);
    --sidebar-border: rgba(255,255,255,0.06);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   2. SIDEBAR - PROFESSIONAL
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--sidebar-border);
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: white;
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 17px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.logo-sub {
    font-size: 9px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.5;
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--sidebar-text);
    text-transform: capitalize;
    opacity: 0.6;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 12px 8px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li {
    margin: 1px 0;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.sidebar-nav ul li a i {
    width: 18px;
    font-size: 15px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-nav ul li a span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav ul li a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-nav ul li a:hover i {
    opacity: 1;
}

.sidebar-nav ul li a.active {
    background: var(--sidebar-active-bg);
    color: white;
    font-weight: 600;
}

.sidebar-nav ul li a.active i {
    color: var(--primary);
    opacity: 1;
}

.sidebar-nav ul li a.active .nav-indicator {
    position: absolute;
    right: 14px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.sidebar-nav ul li a.logout-link {
    color: #ef4444;
}

.sidebar-nav ul li a.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.nav-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 6px 14px;
}

.nav-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-text);
    opacity: 0.3;
    padding: 8px 14px 4px;
    font-weight: 700;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    font-size: 11px;
}

.version {
    color: var(--sidebar-text);
    opacity: 0.3;
    font-weight: 500;
}

.status-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sidebar-text);
    opacity: 0.6;
    font-size: 11px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Sidebar Toggle (Mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--gray-50);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.sidebar-close:hover {
    color: white;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   3. MAIN CONTENT
   ======================================== */

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main {
    padding: 24px 32px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   4. TOP BAR
   ======================================== */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding: 14px 24px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 12px;
}

.topbar h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar h1 i {
    color: var(--primary);
    font-size: 22px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.profile .user-name-display {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.profile .role-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.profile .date-display {
    font-size: 13px;
    color: var(--gray-500);
}

/* ========================================
   5. CARDS
   ======================================== */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.card {
    background: var(--white);
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.card .card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.card:nth-child(1) .card-icon { background: #dcfce7; color: #16a34a; }
.card:nth-child(2) .card-icon { background: #fef3c7; color: #f59e0b; }
.card:nth-child(3) .card-icon { background: #dbeafe; color: #2563eb; }
.card:nth-child(4) .card-icon { background: #fee2e2; color: #dc2626; }

.card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.card .card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.card .card-change {
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

.card .card-change.up {
    color: var(--success);
    background: var(--success-light);
}

.card .card-change.down {
    color: var(--danger);
    background: var(--danger-light);
}

/* ========================================
   6. TABLES
   ======================================== */

.table-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    margin-bottom: 28px;
}

.table-section .table-header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.table-section .table-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-section .table-header h3 i {
    color: var(--primary);
}

.table-wrapper {
    overflow-x: auto;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-50);
}

table th {
    padding: 10px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

table td {
    padding: 10px 18px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-700);
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status-badge {
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.open { background: var(--danger-light); color: var(--danger); }
.status-badge.in_progress { background: var(--warning-light); color: var(--warning); }
.status-badge.resolved { background: var(--success-light); color: var(--success); }
.status-badge.closed { background: var(--gray-100); color: var(--gray-600); }

/* ========================================
   7. BUTTONS
   ======================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(43, 127, 104, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-secondary:hover {
    background: var(--gray-200);
    transform: translateY(-2px);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.view-btn:hover {
    background: var(--primary);
    color: white;
}

/* ========================================
   8. AUTH PAGES (Login/Signup)
   ======================================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    background: var(--white);
    padding: 40px 36px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    animation: fadeInUp 0.5s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    padding: 10px;
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.auth-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid var(--danger);
}

.auth-success {
    background: var(--success-light);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid var(--success);
}

.auth-error i,
.auth-success i {
    margin-right: 8px;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-700);
}

.auth-form .input-wrapper {
    position: relative;
}

.auth-form .input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
}

.auth-form .input-wrapper input {
    width: 100%;
    padding: 11px 14px 11px 44px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
    background: var(--gray-50);
    font-family: var(--font-family);
}

.auth-form .input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(43, 127, 104, 0.1);
}

.auth-form .input-wrapper input::placeholder {
    color: var(--gray-400);
}

.auth-form .password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.auth-form .password-toggle:hover {
    color: var(--gray-700);
}

.auth-form .input-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0 24px;
    font-size: 14px;
}

.auth-options .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    cursor: pointer;
}

.auth-options .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.auth-options a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-options a:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 13px;
    font-size: 15px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--gray-600);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Password Strength */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 8px;
    background: var(--gray-200);
    overflow: hidden;
}

.password-strength .bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* ========================================
   9. RESPONSIVE BREAKPOINTS
   ======================================== */

/* Desktop - Sidebar Visible */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
    }
    .sidebar-close {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
}

/* Tablet & Mobile */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.3);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Main */
    .main-wrapper {
        margin-left: 0;
    }
    
    .main {
        padding: 16px;
        margin-top: 60px;
    }
    
    .topbar {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .topbar h1 {
        font-size: 18px;
    }
    
    .profile {
        justify-content: flex-start;
        gap: 8px;
    }
    
    .profile .date-display {
        font-size: 12px;
    }
    
    /* Cards */
    .cards {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .card {
        padding: 16px 18px;
    }
    
    .card .card-value {
        font-size: 24px;
    }
    
    /* Tables */
    .table-section .table-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }
    
    table th,
    table td {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Auth */
    .auth-card {
        padding: 30px 24px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .main {
        padding: 10px;
        margin-top: 56px;
    }
    
    .topbar h1 {
        font-size: 16px;
    }
    
    .profile .user-name-display {
        font-size: 13px;
    }
    
    .cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .card .card-value {
        font-size: 22px;
    }
    
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
    
    .sidebar-toggle {
        top: 12px;
        left: 12px;
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .auth-card {
        padding: 24px 16px;
    }
    
    .auth-logo h1 {
        font-size: 20px;
    }
    
    table th:nth-child(3),
    table td:nth-child(3),
    table th:nth-child(5),
    table td:nth-child(5) {
        display: none;
    }
}

/* ========================================
   10. ANIMATIONS
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.5s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }

/* ========================================
   11. UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.flex-center { display: flex; align-items: center; gap: 10px; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }