/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-bg: #f8fafc;
    --dark-bg: #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #334155;
    --text-main: #334155;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --header-height: 60px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Noto Kufi Arabic', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

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

a:hover {
    color: var(--primary-hover);
}

/* ---------------- Login Page ---------------- */
.login-page {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

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

.login-box {
    background: #ffffff;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    max-width: 120px;
    margin-bottom: 20px;
}

.login-box h2 {
    color: var(--dark-bg);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
}

/* ---------------- Form Controls ---------------- */
.form-group {
    margin-bottom: 20px;
    text-align: right;
}

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #fff;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    color: #991b1b;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
}

.alert-success {
    color: #065f46;
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
}

/* ---------------- Dashboard Layout ---------------- */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #0b1120;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar .sidebar-header h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 5px;
    font-weight: 700;
}

#sidebar .sidebar-header small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar ul p {
    color: var(--text-muted);
    padding: 10px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
    margin-bottom: 5px;
}

#sidebar ul li a {
    padding: 12px 20px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

#sidebar ul li a:hover,
#sidebar ul li.active a {
    color: #fff;
    background: var(--sidebar-hover);
    border-right-color: var(--primary-color);
}

/* Main Content Area */
#content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s;
    background-color: var(--light-bg);
}

/* Top Navbar */
.top-navbar {
    height: var(--header-height);
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

#sidebarCollapse {
    background: transparent;
    color: var(--text-main);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

#sidebarCollapse:hover {
    background: var(--light-bg);
}

.main-content-inner {
    padding: 30px;
    flex-grow: 1;
}

/* ---------------- Components ---------------- */
/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    overflow: hidden;
}

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

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card h4 {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.stat-card h2 {
    color: var(--dark-bg);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stat-card.primary { border-top: 4px solid var(--primary-color); }
.stat-card.success { border-top: 4px solid var(--success-color); }
.stat-card.warning { border-top: 4px solid var(--warning-color); }
.stat-card.danger { border-top: 4px solid var(--danger-color); }

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

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    background-color: #fff;
}

.table th,
.table td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-success { background-color: var(--success-color); }
.badge-danger { background-color: var(--danger-color); }
.badge-warning { background-color: var(--warning-color); color: #000; }
.badge-info { background-color: #0dcaf0; color: #000; }

/* Grid Utilities */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col {
    flex: 1 0 0%;
    padding-right: 15px;
    padding-left: 15px;
}

.col-md-6 { flex: 0 0 auto; width: 50%; padding: 0 15px; }
.col-md-4 { flex: 0 0 auto; width: 33.333333%; padding: 0 15px; }
.col-md-3 { flex: 0 0 auto; width: 25%; padding: 0 15px; }
.col-12 { flex: 0 0 auto; width: 100%; padding: 0 15px; }

.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.gap-2 { gap: 0.5rem !important; }

/* Footer */
.main-footer {
    padding: 20px;
    text-align: center;
    background: #fff;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    margin-top: auto;
}

.main-footer a {
    color: var(--primary-color);
    font-weight: 500;
}

/* ---------------- Responsive Design ---------------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Mobile & Tablet */
@media (max-width: 991px) {
    #sidebar {
        position: fixed;
        left: 100%;
        height: 100vh;
    }

    #sidebar.active {
        left: calc(100% - var(--sidebar-width));
    }

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

    .row {
        flex-direction: column;
    }

    .col-md-6, .col-md-4, .col-md-3 {
        width: 100%;
        margin-bottom: 20px;
    }

    .main-content-inner {
        padding: 15px;
    }
}