/* ============================================
   Yukatel IT Ticket System - Professional UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Primary - Corporate Blue */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    
    /* Neutral - Slate */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* LIGHT MODE (Default) */
html[data-theme="light"], html:not([data-theme="dark"]) {
    --bg-body: var(--slate-100);
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: var(--slate-50);
    --bg-active: var(--primary-50);
    
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-500);
    --text-muted: var(--slate-400);
    --text-inverse: #ffffff;
    
    --border-color: var(--slate-200);
    --border-focus: var(--primary-500);
    --divider: var(--slate-200);
    
    --sidebar-border: var(--slate-200);
    --header-bg: rgba(255, 255, 255, 0.8);
    --header-backdrop: blur(12px);
}

/* DARK MODE */
html[data-theme="dark"] {
    --bg-body: var(--slate-900);
    --bg-card: var(--slate-800);
    --bg-sidebar: var(--slate-800);
    --bg-input: var(--slate-700);
    --bg-hover: var(--slate-700);
    --bg-active: rgba(37, 99, 235, 0.15);
    
    --text-primary: var(--slate-50);
    --text-secondary: var(--slate-400);
    --text-muted: var(--slate-500);
    --text-inverse: var(--slate-900);
    
    --border-color: var(--slate-700);
    --border-focus: var(--primary-400);
    --divider: var(--slate-700);
    
    --sidebar-border: var(--slate-700);
    --header-bg: rgba(15, 23, 42, 0.8);
    --header-backdrop: blur(12px);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   AUTH PAGES (Login/Register)
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-900) 100%);
    padding: 1.5rem;
    position: relative;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

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

.auth-logo {
    width: 56px;
    height: 56px;
    background: var(--primary-600);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.3);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lang-switcher {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    text-decoration: none;
    backdrop-filter: blur(4px);
}

.lang-btn:hover, .lang-btn.active {
    background: white;
    color: var(--primary-700);
}

/* ============================================
   SIDEBAR LAYOUT
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-600);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

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

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
    margin-bottom: 0.125rem;
    position: relative;
}

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

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary-600);
    font-weight: 600;
}

html[data-theme="dark"] .nav-item.active {
    color: var(--primary-400);
}

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

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.nav-badge.warning {
    background: var(--warning);
    color: var(--slate-900);
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s;
}

.page-header {
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: var(--header-backdrop);
    -webkit-backdrop-filter: var(--header-backdrop);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

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

.page-content {
    padding: 1.5rem 2rem;
    flex: 1;
}

/* Mobile */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .page-content { padding: 1rem; }
    .page-header { padding: 0 1rem; }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-body {
    padding: 1.5rem;
}

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

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

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

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.stat-box:hover {
    border-color: var(--primary-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-50); color: var(--primary-600); }
html[data-theme="dark"] .stat-icon.blue { background: rgba(37, 99, 235, 0.15); color: var(--primary-400); }

.stat-icon.yellow { background: #fef3c7; color: #d97706; }
html[data-theme="dark"] .stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-icon.green { background: #d1fae5; color: #059669; }
html[data-theme="dark"] .stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.stat-icon.red { background: #fee2e2; color: #dc2626; }
html[data-theme="dark"] .stat-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
html[data-theme="dark"] .stat-icon.purple { background: rgba(147, 51, 234, 0.15); color: #c084fc; }

.stat-icon.indigo { background: #e0e7ff; color: #4f46e5; }
html[data-theme="dark"] .stat-icon.indigo { background: rgba(79, 70, 229, 0.15); color: #818cf8; }

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.form-input, .form-select {
    width: 100%;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.5;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--bg-active);
}

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

.form-input:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

select.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

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

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}

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

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.1);
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--slate-300);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    margin-bottom: 1rem;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

html[data-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

html[data-theme="dark"] .alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* ============================================
   TABLES & LISTS
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

/* ============================================
   BADGES & STATUS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.25;
}

.badge-blue { background: var(--primary-50); color: var(--primary-700); }
html[data-theme="dark"] .badge-blue { background: rgba(37, 99, 235, 0.15); color: var(--primary-400); }

.badge-green { background: #f0fdf4; color: #15803d; }
html[data-theme="dark"] .badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.badge-yellow { background: #fefce8; color: #a16207; }
html[data-theme="dark"] .badge-yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.badge-red { background: #fef2f2; color: #b91c1c; }
html[data-theme="dark"] .badge-red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.badge-gray { background: var(--slate-100); color: var(--slate-700); }
html[data-theme="dark"] .badge-gray { background: var(--slate-700); color: var(--slate-300); }

/* ============================================
   TICKET ITEMS
   ============================================ */
.ticket-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
    cursor: pointer;
}

.ticket-item:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

.ticket-item.priority-critical { border-left: 3px solid var(--danger); }
.ticket-item.priority-high { border-left: 3px solid #f97316; }
.ticket-item.priority-medium { border-left: 3px solid var(--warning); }
.ticket-item.priority-low { border-left: 3px solid var(--success); }

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ============================================
   DROP ZONE
   ============================================ */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-body);
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-400);
    background: var(--bg-active);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0; visibility: hidden;
    transition: all 0.2s;
    padding: 1rem;
}

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

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    transform: scale(0.95);
    transition: all 0.2s;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

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

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
}

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

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

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

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin: 0 auto 1rem;
    color: var(--slate-300);
}

html[data-theme="dark"] .empty-state svg {
    color: var(--slate-600);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 9999px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--slate-600); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* Animations */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Print */
@media print {
    .sidebar, .no-print { display: none !important; }
    .main-wrapper { margin-left: 0; }
}