/* =============================================
   UloomulAakhirah — Admin CSS
   ============================================= */

:root {
    --admin-sidebar-bg: #1B5E20;
    --admin-sidebar-width: 260px;
    --admin-topbar-height: 64px;
    --primary-dark: #1B5E20;
    --accent-gold: #C8A951;
    --transition: 0.25s ease;
}

/* ---- Base ---- */
body { font-family: 'Inter', system-ui, sans-serif; background: #f0f2f5; }

/* ---- Color Utilities ---- */
.text-primary-dark { color: var(--primary-dark) !important; }
.text-accent-gold  { color: var(--accent-gold) !important; }
.bg-primary-dark   { background-color: var(--primary-dark) !important; }

/* ---- Layout ---- */
/* .admin-wrapper is a flex row (d-flex, set in the HTML). The sidebar and
   .admin-main are plain flex children — NO fixed positioning and NO
   margin-left compensation. That old fixed+margin combo is what was
   causing the large gray gap between the sidebar and the content. */
.admin-wrapper {
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    min-width: var(--admin-sidebar-width);
    flex-shrink: 0;
    background-color: var(--admin-sidebar-bg);
    transition: width var(--transition);
    overflow-x: hidden;
    /* NOTE: no position:fixed here anymore — the sidebar is an in-flow
       flex item so the browser lays out sidebar + main side by side
       automatically. It stretches to full height because .admin-wrapper
       is a flex row with default align-items: stretch. */
}

.admin-sidebar.collapsed { width: 70px; min-width: 70px; }
.admin-sidebar.collapsed .sidebar-brand span,
.admin-sidebar.collapsed .nav-link span,
.admin-sidebar.collapsed .sidebar-divider,
.admin-sidebar.collapsed .nav-link .bi + *  { display: none; }

/* Nav Links */
.admin-nav-link {
    color: rgba(255,255,255,0.75) !important;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.admin-nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff !important;
}
.admin-nav-link.active {
    background: rgba(200,169,81,0.2);
    color: var(--accent-gold) !important;
    font-weight: 600;
}
.admin-nav-link i { font-size: 1.1rem; flex-shrink: 0; }

/* ---- Main Content ---- */
.admin-main {
    /* No margin-left here — flex layout already positions this correctly
       right after the sidebar in the row. Adding margin-left on top of
       flex positioning was what doubled the gap. */
    min-width: 0;   /* allows content (tables etc.) to shrink/scroll instead of overflowing the flex item */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--admin-topbar-height);
}

.admin-content {
    min-height: calc(100vh - var(--admin-topbar-height));
}

/* ---- Cards ---- */
.card { border-radius: 12px !important; }

/* ---- Stat Cards ---- */
.stat-icon { border-radius: 12px !important; }

/* ---- Tables ---- */
.table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border: none;
}
.table-hover tbody tr:hover { background-color: rgba(27,94,32,0.04); }

/* ---- Buttons ---- */
.btn-primary-dark {
    background-color: var(--primary-dark);
    color: #fff;
    border: none;
    transition: all var(--transition);
}
.btn-primary-dark:hover {
    background-color: #2E7D32;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27,94,32,0.3);
}

.btn-outline-primary-dark {
    border: 1.5px solid var(--primary-dark);
    color: var(--primary-dark);
    background: transparent;
    transition: all var(--transition);
}
.btn-outline-primary-dark:hover {
    background: var(--primary-dark);
    color: #fff;
}

/* ---- Login Page ---- */
.admin-login-body {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #1a472a 100%);
    min-height: 100vh;
}

/* ---- Responsive ---- */
/* Sidebar becomes an off-canvas drawer only below the tablet breakpoint.
   This is the ONE place position:fixed is appropriate for the sidebar,
   because on mobile it needs to overlay the content rather than sit
   beside it in the flex row. Toggle the "mobile-open" class from JS
   (in addition to "collapsed") if you want a slide-in drawer on mobile;
   otherwise the sidebar simply stacks/scrolls with the page. */
@media (max-width: 992px) {
    .admin-wrapper {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
    }
    .admin-main {
        min-height: auto;
    }
}

/* ---- Form Overrides ---- */
.form-control:focus, .form-select:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(27,94,32,0.15);
}

/* ---- Badge Colors ---- */
.badge.bg-primary-dark { background-color: var(--primary-dark) !important; }

/* ---- Image preview on forms ---- */
.img-preview {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 4px;
}