/* =====================================================
   AlNabaE - نظام إدارة اشتراكات الإنترنت
   Main Stylesheet
   ===================================================== */

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --secondary: #00897B;
    --success: #2E7D32;
    --warning: #F57F17;
    --danger: #C62828;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --navbar-height: 60px;
    --font-family: 'Cairo', sans-serif;
    --bg-light: #F5F7FA;
    --card-shadow: 0 2px 15px rgba(0,0,0,0.08);
    --border-radius: 12px;
}

/* ===================== Base ===================== */
* { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-light);
    color: #2c3e50;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ===================== Navbar ===================== */
.navbar {
    height: var(--navbar-height);
    z-index: 1040;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
}

/* ===================== Wrapper ===================== */
.wrapper {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
    padding-top: 0;
    margin-top: var(--navbar-height);
}

/* ===================== Sidebar ===================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: #1A237E;
    position: fixed;
    top: var(--navbar-height);
    right: 0;
    z-index: 1030;
    overflow-y: auto;
    transition: all 0.3s ease;
    box-shadow: -3px 0 15px rgba(0,0,0,0.15);
    scrollbar-width: thin;
    scrollbar-color: #3949AB transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #3949AB; border-radius: 2px; }

.sidebar-header {
    padding: 18px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #90CAF9;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #B3C5E8;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-menu li a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-right-color: var(--primary-light);
}

.sidebar-menu li a.active {
    background: rgba(66,165,245,0.2);
    color: #42A5F5;
    border-right-color: #42A5F5;
    font-weight: 700;
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* ===================== Main Content ===================== */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 25px;
    min-height: calc(100vh - var(--navbar-height));
    width: calc(100% - var(--sidebar-width));
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-right: 0;
    width: 100%;
}

/* ===================== Cards ===================== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { box-shadow: 0 4px 25px rgba(0,0,0,0.12); }

.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 700;
    padding: 14px 20px;
}

/* ===================== Stat Cards ===================== */
.stat-card {
    border-radius: var(--border-radius);
    padding: 22px;
    color: white;
    position: relative;
    overflow: hidden;
    cursor: default;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-3px); }

.stat-card .stat-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    opacity: 0.15;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.88rem;
    opacity: 0.9;
    margin-top: 4px;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    opacity: 0.75;
    margin-top: 6px;
}

.bg-gradient-primary { background: linear-gradient(135deg, #1565C0, #42A5F5); }
.bg-gradient-success { background: linear-gradient(135deg, #1B5E20, #43A047); }
.bg-gradient-warning { background: linear-gradient(135deg, #E65100, #FFA726); }
.bg-gradient-danger  { background: linear-gradient(135deg, #B71C1C, #EF5350); }
.bg-gradient-info    { background: linear-gradient(135deg, #006064, #00ACC1); }
.bg-gradient-purple  { background: linear-gradient(135deg, #4A148C, #9C27B0); }

/* ===================== Tables ===================== */
.table-responsive { border-radius: var(--border-radius); overflow: hidden; }

.table { margin-bottom: 0; }

.table thead th {
    background: #1A237E;
    color: white;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 12px 15px;
    border: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 11px 15px;
    vertical-align: middle;
    font-size: 0.9rem;
    border-color: #f0f2f5;
}

.table tbody tr:hover { background-color: #EEF2FF; }

/* ===================== Buttons ===================== */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 7px 16px;
    transition: all 0.2s;
}

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ===================== Forms ===================== */
.form-control, .form-select {
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.92rem;
    border-color: #dee2e6;
    padding: 9px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(21,101,192,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #495057;
    margin-bottom: 5px;
}

/* ===================== Page Header ===================== */
.page-header {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px 22px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h4 {
    margin: 0;
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1.15rem;
}

/* ===================== Badges ===================== */
.badge { font-size: 0.78rem; font-weight: 600; border-radius: 6px; padding: 4px 8px; }

/* ===================== Alerts ===================== */
.alert { border-radius: 10px; border: none; font-weight: 500; }

/* ===================== Modal ===================== */
.modal-content { border-radius: var(--border-radius); border: none; }
.modal-header { border-radius: var(--border-radius) var(--border-radius) 0 0; padding: 15px 22px; }

/* ===================== Sidebar Overlay (Mobile) ===================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1029;
}

.sidebar-overlay.show { display: block; }

/* ===================== Print Styles ===================== */
@media print {
    .navbar, .sidebar, #sidebarToggle, .no-print, .btn, .sidebar-overlay { display: none !important; }
    .main-content { margin: 0 !important; width: 100% !important; padding: 10px !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    body { background: white !important; }
}

/* ===================== Responsive ===================== */
@media (max-width: 991.98px) {
    .sidebar {
        right: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        right: 0;
    }
    .main-content {
        margin-right: 0;
        width: 100%;
        padding: 15px;
    }
}

@media (max-width: 575.98px) {
    .main-content { padding: 10px; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .page-header { padding: 12px 15px; }
    .table thead th, .table tbody td { padding: 8px 10px; font-size: 0.82rem; }
}

/* ===================== Custom Scrollbar ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #adb5bd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===================== Account Statement ===================== */
.statement-table .debit { color: #C62828; font-weight: 600; }
.statement-table .credit { color: #2E7D32; font-weight: 600; }
.statement-table .balance-positive { color: #1565C0; font-weight: 700; }
.statement-table .balance-negative { color: #C62828; font-weight: 700; }

/* ===================== Treasury ===================== */
.treasury-in { background: #E8F5E9; color: #1B5E20; }
.treasury-out { background: #FFEBEE; color: #B71C1C; }

/* ===================== Login Page ===================== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 3rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 10px;
}

.login-title {
    text-align: center;
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.login-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: 0.88rem;
    margin-bottom: 30px;
}

/* ===================== DataTable Search ===================== */
.search-box {
    position: relative;
}
.search-box .form-control {
    padding-right: 38px;
}
.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

/* ===================== Loading Spinner ===================== */
.spinner-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================== Chart Container ===================== */
.chart-container {
    position: relative;
    min-height: 280px;
}
