/* ===== Base Styles ===== */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(99,102,241,0.3);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --text-muted: #94a3b8;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f1f5f9;
    margin: 0;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
}

[dir="ltr"] .sidebar {
    right: auto;
    left: 0;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 80px;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

/* ===== Sidebar Navigation ===== */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    text-align: center;
    padding: 8px 0;
}

.sidebar.collapsed .nav-section-title span {
    display: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 3px 0 0 3px;
}

[dir="ltr"] .nav-link.active::before {
    right: auto;
    left: 0;
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.nav-text {
    flex: 1;
    font-size: 14px;
    transition: opacity 0.2s;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}

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

.user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .user-info {
    justify-content: center;
    padding: 10px 5px;
}

/* ===== Toggle Button ===== */
.sidebar-toggle {
    position: absolute;
    top: 90px;
    left: -14px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    border: 3px solid #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 10;
}

[dir="ltr"] .sidebar-toggle {
    left: auto;
    right: -14px;
}

.sidebar-toggle:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-toggle:hover {
    transform: rotate(180deg) scale(1.1);
}

/* ===== Main Content ===== */
.main-wrapper {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="ltr"] .main-wrapper {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}

.sidebar.collapsed ~ .main-wrapper {
    margin-right: var(--sidebar-collapsed-width);
}

[dir="ltr"] .sidebar.collapsed ~ .main-wrapper {
    margin-right: 0;
    margin-left: var(--sidebar-collapsed-width);
}

/* ===== Top Header ===== */
.top-header {
    background: #fff;
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-switcher {
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-btn:hover, .lang-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ===== Content Area ===== */
.content-area {
    padding: 24px;
}

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    background: #fff;
    margin-bottom: 24px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: 18px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ===== Stat Cards ===== */
.stat-card {
    min-height: 120px;
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

[dir="ltr"] .stat-card .stat-icon {
    left: auto;
    right: 20px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

/* ===== Tables ===== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ===== Buttons ===== */
.btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ===== Badges ===== */
.badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
}

.badge.text-bg-light {
    background: #f1f5f9 !important;
    color: #475569;
}

/* ===== Forms ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
    font-size: 14px;
}

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
}

/* ===== Page Actions ===== */
.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ===== Quick Links ===== */
.quick-links a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.quick-links a:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    [dir="ltr"] .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    .mobile-toggle {
        display: flex !important;
    }
    
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    
    .sidebar.mobile-open ~ .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
}

.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #475569;
}

/* ===== List Group ===== */
.list-group-item {
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    padding: 14px 16px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    margin: 20px;
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .top-header, .page-actions, .btn {
        display: none !important;
    }
    .main-wrapper {
        margin: 0 !important;
    }
    .content-area {
        padding: 0;
    }
}
