:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f3f4f6;
    --text: #1f2937;
    --muted: #6b7280;
    --surface: #ffffff;
    --sidebar-bg: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 0.5rem;
    --sidebar-w: 260px;
    --header-h: 60px;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

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

/* Menu Toggle Button */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1200;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.menu-icon {
    width: 100%;
    height: 100%;
    stroke: var(--text);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
}

.sidebar-logo { font-size: 1.5rem; }
.sidebar-title { font-size: 1.1rem; font-weight: 700; }

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: var(--space-sm) 0;
}

.sidebar-section {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: var(--space-sm);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: #94a3b8;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: #334155;
    color: #fff;
}

.link-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.link-text { flex: 1; }

.sidebar-footer {
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-notif {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: #94a3b8;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-notif:hover { background: #334155; color: #fff; }

.notif-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    flex-shrink: 0;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: all 0.2s;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.lang-flag { font-size: 1rem; }
.lang-code { font-weight: 500; }

.chevron {
    width: 14px;
    height: 14px;
    stroke: var(--muted);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    display: none;
    z-index: 1000;
}

.lang-dropdown.show { display: block; }

.lang-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--primary);
    color: #fff;
}

/* Header Icons */
.header-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: all 0.2s;
}

.header-icon:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.header-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--text);
}

.icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.user-btn:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

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

.user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show { display: block; }

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

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

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Components */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #475569; }

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 12px 14px;
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

tr:hover { background: #f8fafc; }

/* Responsive */
@media (min-width: 900px) {
    .menu-toggle { display: none !important; }
    .sidebar { position: relative; transform: none !important; }
    .main-area { margin-left: 0; }
}

@media (min-width: 768px) and (max-width: 899px) {
    .menu-toggle { display: flex; }
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w));
        top: 0;
        height: 100vh;
        z-index: 1100;
    }
    .sidebar.open { transform: translateX(var(--sidebar-w)); }
    .main-area { margin-left: 0; }
    .top-bar { padding-left: 70px; padding-right: var(--space-md); }
    .user-role { display: none; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .menu-toggle { display: flex; }
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w));
        top: 0;
        height: 100vh;
        z-index: 1100;
    }
    .sidebar.open { transform: translateX(var(--sidebar-w)); }
    .main-area { margin-left: 0; }
    .top-bar {
        padding: var(--space-sm) var(--space-md);
        padding-left: 70px;
        height: auto;
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    .page-title { width: 100%; font-size: 1rem; }
    .header-actions { width: 100%; justify-content: flex-end; }
    .user-role { display: none; }
    .content-area { padding: var(--space-md); }
}

@media (max-width: 575px) {
    .menu-toggle {
        display: flex;
        width: 36px;
        height: 36px;
        top: 8px;
        left: 8px;
    }
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w));
        top: 0;
        height: 100vh;
        z-index: 1100;
        width: var(--sidebar-w);
    }
    .sidebar.open { transform: translateX(var(--sidebar-w)); }
    .main-area { margin-left: 0; }
    .top-bar {
        padding: var(--space-sm);
        padding-left: 55px;
        flex-wrap: wrap;
        gap: var(--space-xs);
        height: auto;
    }
    .header-left { width: 100%; }
    .header-title { font-size: 1rem; }
    .header-right { width: 100%; justify-content: space-between; }
    .user-menu-info { display: none; }
    .lang-text { display: none; }
    .user-name { font-size: 0.8rem; }
    .content-area { padding: var(--space-sm); }
    .card { padding: var(--space-sm); border-radius: var(--radius-md); }
    th, td { padding: var(--spacing-xs) var(--spacing-sm); font-size: 0.8rem; }
    .btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--sidebar-bg));
    padding: var(--space-md);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255,255,255,0.95);
    padding: var(--space-lg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; margin-bottom: var(--space-xs); font-weight: 500; font-size: 0.9rem; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
