/* Global Styles */
:root {
    --primary-color: #4F46E5;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --light-bg: #F9FAFB;
    --dark-text: #111827;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'NRT Reg', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

html {
    font-family: 'NRT Reg', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .navbar {
    left: auto;
    right: 0;
}

[dir="rtl"] .navbar-menu {
    margin-right: auto;
    margin-left: 0;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 250px;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #7C3AED);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 40px 30px 30px;
    background: linear-gradient(135deg, var(--primary-color), #7C3AED);
    color: white;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: white;
    padding: 10px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 30px;
}

.login-footer {
    padding: 20px 30px;
    background: var(--light-bg);
    text-align: center;
}

/* Sidebar */
.navbar {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #F59E0B 100%);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    z-index: 1100;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.navbar-container {
    width: 100%;
    height: 100%;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    padding: 6px 10px;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.navbar-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FBBF24;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #FBBF24;
}

.sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1200;
    background: #0F172A;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.sidebar-toggle:hover {
    background: #1E293B;
    color: #FBBF24;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1250;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 10px 4px;
    flex-direction: column;
    align-items: stretch;
}

.navbar-user > * {
    width: 100%;
}

.language-switcher {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
}

.lang-btn {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s;
}

.lang-btn.active,
.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FBBF24;
}

.user-dropdown {
    position: relative;
}

.user-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--light-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

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

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1200;
}

.user-dropdown:hover .dropdown-menu,
.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--dark-text);
    text-decoration: none;
    transition: all 0.3s;
}

.dropdown-menu a:hover {
    background: var(--light-bg);
}

/* Main Content */
.main-content {
    max-width: calc(100% - 250px);
    width: calc(100% - 250px);
    margin: 0;
    padding: 30px 20px;
    min-height: calc(100vh - 140px);
    margin-left: 250px;
    margin-right: 0;
    transition: margin-left 0.3s ease, margin-right 0.3s ease;
}

.container {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    padding-right: 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 28px;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: visible;
    position: relative;
    max-width: 100%;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
}

.card-header h2,
.card-header h3 {
    font-size: 20px;
    color: var(--dark-text);
}

.card-body {
    padding: 20px;
    min-height: 250px;
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-primary .stat-icon { background: var(--primary-color); }
.stat-success .stat-icon { background: var(--success-color); }
.stat-info .stat-icon { background: var(--info-color); }
.stat-warning .stat-icon { background: var(--warning-color); }

.stat-content h3 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-content p {
    color: var(--secondary-color);
    font-size: 14px;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
    padding: 10px;
}

.chart-container {
    min-height: 250px;
    position: relative;
    margin-bottom: 20px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'NRT Reg', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Autocomplete Suggestions */
.autocomplete-suggestions {
    position: absolute;
    top: calc(100% - 20px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: scroll;
    display: none;
    z-index: 1000;
}

/* Custom scrollbar styling */
.autocomplete-suggestions::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'NRT Reg', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
}

.suggestion-item:hover {
    background: var(--light-bg);
}

.suggestion-item:last-child {
    border-radius: 0 0 8px 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.filter-form {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
}

/* Autocomplete */
.autocomplete {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.suggestion-item:hover {
    background: var(--light-bg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'NRT Reg', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #4338CA;
}

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

.btn-secondary:hover {
    background: #4B5563;
}

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

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

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

.btn-danger:hover {
    background: #DC2626;
}

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

.btn-warning:hover {
    background: #D97706;
}

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

.btn-info:hover {
    background: #2563EB;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

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

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

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

.table thead {
    background: var(--light-bg);
}

.table th {
    font-weight: 600;
    color: var(--dark-text);
}

.table tbody tr:hover {
    background: var(--light-bg);
}

.text-center {
    text-align: center !important;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin,
.badge-active,
.badge-create {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-user {
    background: #E0E7FF;
    color: #5B21B6;
}

.badge-inactive {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-login {
    background: #D1FAE5;
    color: #065F46;
}

.badge-logout {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-update {
    background: #FEF3C7;
    color: #92400E;
}

.badge-delete {
    background: #FEE2E2;
    color: #991B1B;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.alert-dismissible {
    position: relative;
    padding-right: 40px;
}

.alert-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination .btn-sm {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark-text);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.pagination .btn-sm.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
}

.pagination .btn-sm.btn-primary:hover {
    background: #4338CA;
    border-color: #4338CA;
    color: white;
}

.pagination-info {
    padding: 8px 16px;
    background: var(--light-bg);
    border-radius: 8px;
    font-size: 14px;
    color: var(--secondary-color);
    margin: 0 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 900px;
}

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

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--secondary-color);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Quick Actions */
.quick-actions {
    margin-top: 30px;
}

.quick-actions h3 {
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Entry Details */
.entry-details {
    display: grid;
    gap: 15px;
}

.detail-row {
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
}

.detail-row strong {
    color: var(--secondary-color);
    margin-right: 10px;
}

/* Footer */
.footer {
    background: white;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        transform: translateX(-100%);
        z-index: 1300;
    }
    
    [dir="rtl"] .navbar {
        transform: translateX(100%);
    }
    
    .navbar.open {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0;
        margin-right: 0;
        padding-top: 70px;
        max-width: 100%;
        width: 100%;
    }
    
    [dir="rtl"] .main-content {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
    }
    
    .modal-content {
        width: 95%;
    }
}

@media print {
    .navbar,
    .page-header .btn,
    .export-buttons,
    .action-buttons,
    .pagination,
    .footer {
        display: none !important;
    }
}
