/* ============================================
   MSP Help Desk - Modern Design System
   ============================================ */

/* CSS Variables - Light Theme (Default) */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    
    /* Accent Colors */
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Priority Colors */
    --priority-low: #eab308;
    --priority-medium: #f97316;
    --priority-high: #ef4444;
    --priority-critical: #7f1d1d;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    
    /* Font */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #312e81;
    --primary-dark: #c7d2fe;
    
    --accent: #22d3ee;
    --accent-hover: #06b6d4;
    
    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #78350f;
    --danger: #f87171;
    --danger-light: #7f1d1d;
    --info: #60a5fa;
    --info-light: #1e3a5f;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --border-light: #334155;
    --border-medium: #475569;
    --border-dark: #64748b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-logo-img {
    max-width: 150px;
    max-height: 40px;
    object-fit: contain;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    border-color: var(--primary);
}

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

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

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

.btn-success:hover {
    background: #059669;
    color: white;
}

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

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Aliases for Tailwind-style class names */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover td {
    background: var(--bg-secondary);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Status Badges */
.status-new { background: #3b82f6; color: #ffffff; }
.status-open { background: #8b5cf6; color: #ffffff; }
.status-inprogress { background: #06b6d4; color: #ffffff; }
.status-pending { background: #f59e0b; color: #ffffff; }
.status-resolved { background: #10b981; color: #ffffff; }
.status-closed { background: #3b82f6; color: #ffffff; }
.status-cancelled { background: #ef4444; color: #ffffff; }
.status-blocked { background: #ef4444; color: #ffffff; }
.status-completed { background: #10b981; color: #ffffff; }
.status-duplicate { background: #10b981; color: #ffffff; }
.status-bydesign { background: #3b82f6; color: #ffffff; }
.status-wontfix { background: #f97316; color: #ffffff; }

/* Priority Badges */
.priority-low { background: #fef9c3; color: #a16207; }
.priority-medium { background: #fed7aa; color: #c2410c; }
.priority-high { background: #fecaca; color: #dc2626; }
.priority-critical { background: #7f1d1d; color: #fef2f2; }

/* Modern Badge-Style Select Dropdowns */
.inline-status, .inline-priority, .inline-assignee {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    border-radius: 20px;
    padding: 0.35rem 1.8rem 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    min-width: auto;
    text-align: left;
}

.inline-status:hover, .inline-priority:hover, .inline-assignee:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.inline-status:focus, .inline-priority:focus, .inline-assignee:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Status Select Colors */
.status-select-new { background: #3b82f6; color: #ffffff; }
.status-select-open { background: #8b5cf6; color: #ffffff; }
.status-select-inprogress { background: #06b6d4; color: #ffffff; }
.status-select-pending { background: #f59e0b; color: #ffffff; }
.status-select-resolved { background: #10b981; color: #ffffff; }
.status-select-closed { background: #3b82f6; color: #ffffff; }
.status-select-cancelled { background: #ef4444; color: #ffffff; }

/* Priority Select Colors */
.priority-select-low { 
    background: #fef9c3; 
    color: #a16207; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a16207' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.priority-select-medium { 
    background: #fed7aa; 
    color: #c2410c; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c2410c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.priority-select-high { 
    background: #fecaca; 
    color: #dc2626; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.priority-select-critical { 
    background: #7f1d1d; 
    color: #fef2f2; 
}

/* Assignee Select - Neutral style with avatar look */
.inline-assignee {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding-left: 0.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.inline-assignee:hover {
    background-color: var(--bg-tertiary);
    filter: none;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: #b45309;
    border: 1px solid var(--warning);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid var(--info);
}

/* Ticket List */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ticket-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.ticket-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.ticket-priority {
    width: 4px;
    height: 40px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.ticket-priority.low { background: var(--priority-low); }
.ticket-priority.medium { background: var(--priority-medium); }
.ticket-priority.high { background: var(--priority-high); }
.ticket-priority.critical { background: var(--priority-critical); }

.ticket-info {
    flex: 1;
    min-width: 0;
}

.ticket-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ticket-subject {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Charts Container */
.chart-container {
    height: 300px;
    position: relative;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-light);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.625rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-primary);
}

.timeline-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.timeline-author {
    font-weight: 600;
    font-size: 0.875rem;
}

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

.timeline-body {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Login Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
}

.auth-logo-img {
    max-width: 200px;
    max-height: 80px;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.5rem 0;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--transition-fast);
}

.modal-backdrop.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .top-bar {
        padding: 1rem;
    }
    
    .table-container {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Print */
@media print {
    .sidebar,
    .top-bar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal);
}

.animate-slide-up {
    animation: slideUp var(--transition-normal);
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   COMPACT SPACING MODE
   ============================================ */
.compact-mode .page-content { padding: 1rem; }
.compact-mode .card-header { padding: 0.75rem 1rem; }
.compact-mode .card-body { padding: 1rem; }
.compact-mode .card-footer { padding: 0.75rem 1rem; }
.compact-mode .stat-card { padding: 1rem; gap: 0.75rem; }
.compact-mode .stats-grid { gap: 1rem; margin-bottom: 1rem; }
.compact-mode .form-group { margin-bottom: 0.75rem; }
.compact-mode .table th, .compact-mode .table td { padding: 0.5rem 0.75rem; }
.compact-mode h1 { font-size: 1.5rem; }
.compact-mode h2 { font-size: 1.25rem; }
.compact-mode h3 { font-size: 1rem; }
.compact-mode .mb-4 { margin-bottom: 0.75rem !important; }
.compact-mode .mb-3 { margin-bottom: 0.5rem !important; }
.compact-mode .gap-3 { gap: 0.5rem !important; }
.compact-mode .gap-4 { gap: 0.75rem !important; }

/* ============================================
   ACCESSIBILITY SETTINGS
   ============================================ */

/* High Contrast Mode */
[data-high-contrast="true"] {
    --text-primary: #000000;
    --text-secondary: #1a1a1a;
    --text-muted: #333333;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --border-light: #000000;
    --border-medium: #000000;
    --primary: #0000cc;
    --success: #006600;
    --warning: #996600;
    --danger: #cc0000;
}

[data-theme="dark"][data-high-contrast="true"] {
    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --text-muted: #cccccc;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --border-light: #ffffff;
    --border-medium: #ffffff;
    --primary: #6699ff;
    --success: #66ff66;
    --warning: #ffcc00;
    --danger: #ff6666;
}

/* Large Text Mode */
[data-large-text="true"] {
    font-size: 18px !important;
}
[data-large-text="true"] h1 { font-size: 2.5rem !important; }
[data-large-text="true"] h2 { font-size: 2rem !important; }
[data-large-text="true"] h3 { font-size: 1.5rem !important; }
[data-large-text="true"] .btn { font-size: 1rem !important; padding: 0.75rem 1.25rem !important; }
[data-large-text="true"] .form-control { font-size: 1rem !important; padding: 0.75rem !important; }
[data-large-text="true"] .table { font-size: 1rem !important; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
[data-reduce-motion="true"] *, 
[data-reduce-motion="true"] *::before, 
[data-reduce-motion="true"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Focus Indicators (Enhanced) */
[data-focus-visible="true"] *:focus {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px !important;
}

/* Dyslexia-Friendly Font */
[data-dyslexia-font="true"] {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
    line-height: 1.8;
}

/* Link Underlines (always visible) */
[data-underline-links="true"] a {
    text-decoration: underline !important;
}

/* Cursor Size */
[data-large-cursor="true"] * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23000' d='M8 2l16 14-8 2-4 8-4-24z'/%3E%3C/svg%3E") 0 0, auto !important;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
    top: 0;
}


/* ============================================
   CUSTOM DATE PICKER - MODERN DESIGN
   ============================================ */

.cdp-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.cdp-wrapper.open .cdp-dropdown { display: block; }

.cdp-input {
    cursor: pointer !important;
    padding-right: 40px !important;
}

.cdp-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
}

.cdp-icon:hover { color: var(--text); }

.cdp-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 10000;
    background: #2d3748;
    border-radius: 12px;
    padding: 16px;
    min-width: 240px;
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
    animation: cdpSlideIn 0.2s ease-out;
}

[data-theme="light"] .cdp-dropdown {
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
}

@keyframes cdpSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.cdp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cdp-month-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f7fafc;
    letter-spacing: -0.025em;
}

[data-theme="light"] .cdp-month-label { color: #1a202c; }

.cdp-year-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cdp-year-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    min-width: 45px;
    text-align: center;
}

.cdp-year-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.15s;
}

.cdp-year-btn:hover { color: #f7fafc; }
[data-theme="light"] .cdp-year-btn:hover { color: #1a202c; }

/* Weekdays */
.cdp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
}

.cdp-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: #718096;
    padding: 4px 0;
}

/* Days Grid */
.cdp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cdp-day {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #e2e8f0;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s;
    margin: 0 auto;
}

[data-theme="light"] .cdp-day { color: #2d3748; }

.cdp-day:hover:not(.cdp-other):not(.cdp-selected) {
    background: rgba(102, 126, 234, 0.2);
}

.cdp-day.cdp-other {
    color: #4a5568;
    cursor: default;
}

[data-theme="light"] .cdp-day.cdp-other { color: #cbd5e0; }

.cdp-day.cdp-today {
    border: 1px solid #718096;
    border-radius: 4px;
}

.cdp-day.cdp-selected {
    background: #667eea;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 50%;
}

.cdp-day.cdp-selected:hover { background: #5a67d8; }

/* Month Navigation Row */
.cdp-nav-row {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

[data-theme="light"] .cdp-nav-row { border-color: #e2e8f0; }

.cdp-month-nav-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
}

.cdp-month-nav-btn svg {
    width: 14px;
    height: 14px;
}

.cdp-month-nav-btn:hover {
    color: #f7fafc;
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .cdp-month-nav-btn:hover {
    color: #1a202c;
    background: #edf2f7;
}

/* Time Section */
.cdp-time-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

[data-theme="light"] .cdp-time-section { border-color: #e2e8f0; }

.cdp-time-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.cdp-time-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cdp-time-arrow {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
}

.cdp-time-arrow svg {
    width: 10px;
    height: 10px;
}

.cdp-time-arrow:hover {
    color: #f7fafc;
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .cdp-time-arrow:hover {
    color: #1a202c;
    background: #edf2f7;
}

.cdp-time-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f7fafc;
    min-width: 32px;
    text-align: center;
    padding: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

[data-theme="light"] .cdp-time-val {
    color: #1a202c;
    background: #edf2f7;
}

.cdp-time-colon {
    font-size: 0.9rem;
    font-weight: 700;
    color: #718096;
    padding: 0 2px;
}

.cdp-ampm-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid #667eea;
    border-radius: 4px;
    color: #a3bffa;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 6px;
}

.cdp-ampm-btn:hover {
    background: rgba(102, 126, 234, 0.3);
}

[data-theme="light"] .cdp-ampm-btn {
    background: #ebf4ff;
    color: #5a67d8;
}

/* Actions */
.cdp-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

[data-theme="light"] .cdp-actions { border-color: #e2e8f0; }

.cdp-action-btn {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.15s;
}

.cdp-action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #f7fafc;
}

[data-theme="light"] .cdp-action-btn:hover {
    background: #edf2f7;
    color: #1a202c;
}

.cdp-action-btn.cdp-action-primary {
    background: #667eea;
    color: #fff;
}

.cdp-action-btn.cdp-action-primary:hover {
    background: #5a67d8;
}
