/* ========= Theme ========= */
:root {
    --primary: #1f2937;
    --primary-dark: #115e59;
    --bg: #f1f5f9;
    --text: #0f172a;
    --radius: 0.75rem;
    --shadow: 0 0.25rem 0.6rem rgba(15, 23, 42, 0.08);

    --sidebar-width: 230px;
    --navbar-height: 56px;   /* ارتفاع شريط التنقل العلوي */
}

/* ========= Layout ========= */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* لضمان امتداد الفوتر */
}

/* ========= Main Wrapper ========= */
#page-wrapper {
    flex: 1 0 auto; /* يملأ المساحة بين الهيدر والفوتر */
    margin-left: 0; /* افتراضي بدون إزاحة */
    padding: 1.5rem;
    padding-top: calc(var(--navbar-height) + 1.5rem);
    box-sizing: border-box;
    transition: margin-left 0.3s ease, padding 0.3s ease;
}

/* إذا كانت الصفحة داخل النظام ولها سايدبار */
body.with-sidebar #page-wrapper {
    margin-left: var(--sidebar-width);
}

/* ========= Navbar ========= */
.bg-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.navbar {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 0.25rem 0.5rem rgba(15, 23, 42, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.navbar-nav {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.navbar-nav .nav-link {
    font-size: 0.95rem;
    color: rgba(241, 245, 249, 0.9);
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #fff;
}

/* ========= Sidebar ========= */
.sidebar {
    width: var(--sidebar-width);
    background: #1f2937;
    color: #e5e7eb;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    height: calc(100% - var(--navbar-height));
    padding: 1.2rem 1rem;
    box-shadow: 0 0.25rem 0.6rem rgba(15,23,42,0.08);
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* Sidebar Header/Menu */
.sidebar-header {
    margin-bottom: 0.75rem;
    padding: 0 0.25rem 0.5rem;
    border-bottom: 1px solid #374151;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li {
    margin-bottom: 0.35rem;
}

.sidebar a {
    display: block;
    padding: 0.6rem 0.75rem;
    color: #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.sidebar a:hover,
.sidebar a.active {
    background: #374151;
    text-decoration: none;
}

/* ========= Cards ========= */
.card {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 0;
    background: #fff;
    margin-bottom: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(15, 23, 42, 0.15);
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    font-weight: 600;
}

/* ========= Hero ========= */
.hero {
    padding: 3rem 2rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #f9fafb;
    margin-bottom: 2rem;
    text-align: center;
    transition: padding 0.3s ease;
}

.hero h1 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero p {
    max-width: 600px;
    margin: 0 auto;
}

/* ========= Buttons ========= */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

/* ========= Tables ========= */
.table {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.table thead th {
    background: #e0f2f1;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #0f3f3b;
    padding: 0.75rem 1rem;
    text-align: left;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
}

/* ========= Forms ========= */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1px solid #cbd5f5;
    padding: 0.5rem 0.75rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.25);
    outline: none;
}

/* ========= Status Badges ========= */
.badge-status {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    display: inline-block;
}

.badge-status.Pending {
    background: #fef9c3;
    color: #854d0e;
}

.badge-status.Approved {
    background: #dcfce7;
    color: #166534;
}

.badge-status.Rejected {
    background: #fee2e2;
    color: #b91c1c;
}

/* ========= Footer ========= */
footer {
    background: var(--primary);
    padding: 0.75rem 0;
    color: #e0f2f1;
    text-align: center;
    flex-shrink: 0;
}

/* ========= Responsive ========= */
@media (max-width: 768px) {
    .hero {
        padding: 2rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    #page-wrapper {
        margin-left: 0 !important; /* إزالة أي إزاحة تلقائي */
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: calc(var(--navbar-height) + 1rem);
    }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: var(--navbar-height);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}
