/* ================================================================
   AYHA Platform - Admin Area Styles
   Brand Identity: Controlled Stability (Direction A - Pure Authority)
   ================================================================ */

:root {
    /* Color Palette - LOCKED (same as public) */
    --color-primary: #1a2332;
    --color-secondary: #64748b;
    --color-base: #ffffff;
    --color-accent: #0891b2;
    --color-text-primary: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-sidebar-bg: #f8fafc;
    --color-sidebar-hover: #e2e8f0;
}

/* ================================================================
   Admin Layout
   ================================================================ */

/* Ensure body uses full viewport height with flexbox */
html {
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* Navbar - Fixed at top */
.navbar-ayha {
    flex-shrink: 0;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Content area wrapper - fills space between navbar and footer */
.flex-fill {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Admin wrapper - takes full height */
.admin-wrapper {
    flex: 1;
    display: flex;
    height: calc(100vh - 64px - 49px); /* viewport minus navbar minus footer */
    overflow: hidden;
}

/* Sidebar - fixed width, scrollable */
.admin-sidebar {
    width: 250px;
    flex-shrink: 0;
    background-color: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    padding: 1.5rem 0;
    overflow-y: auto;
    height: 100%;
}

/* Content - scrollable, fills remaining space */
.admin-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
    background-color: var(--color-base);
    height: 100%;
}

/* Custom scrollbar styling for content area */
.admin-content::-webkit-scrollbar {
    width: 8px;
}

.admin-content::-webkit-scrollbar-track {
    background: var(--color-sidebar-bg);
}

.admin-content::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 4px;
}

.admin-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Firefox scrollbar styling */
.admin-content {
    scrollbar-width: thin;
    scrollbar-color: var(--color-secondary) var(--color-sidebar-bg);
}

/* Footer - fixed at bottom, never scrolls */
.footer-fixed {
    flex-shrink: 0 !important;
    position: sticky;
    bottom: 0;
    z-index: 999;
    width: 100%;
}

/* ================================================================
   Admin Sidebar - Slate Gray Theme
   ================================================================ */

.sidebar-heading {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background-color: var(--color-sidebar-hover);
    color: var(--color-primary);
}

.sidebar-nav-link.active {
    background-color: var(--color-sidebar-hover);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    font-weight: 600;
}

.sidebar-nav-link svg {
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* ================================================================
   Admin Content Area
   ================================================================ */

.admin-content {
    flex: 1;
    padding: 2rem;
    background-color: var(--color-base);
    overflow-y: auto; /* Content scrolls, not the whole page */
    height: calc(100vh - 64px); /* Full height minus navbar */
}

.admin-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.admin-title {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.admin-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

/* ================================================================
   Cards & Tables
   ================================================================ */

.admin-card {
    background-color: var(--color-base);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card-title {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.table-ayha {
    border-collapse: separate;
    border-spacing: 0;
}

.table-ayha thead th {
    background-color: var(--color-sidebar-bg);
    color: var(--color-text-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--color-border);
    padding: 0.75rem 1rem;
}

.table-ayha tbody tr {
    transition: background-color 0.2s ease;
}

.table-ayha tbody tr:hover {
    background-color: var(--color-sidebar-bg);
}

.table-ayha tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

/* ================================================================
   Stats Cards
   ================================================================ */

.stat-card {
    background-color: var(--color-base);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.stat-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(26, 35, 50, 0.08);
}

.stat-label {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--color-primary);
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-change {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background-color: var(--color-sidebar-bg);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    flex-shrink: 0;
}

/* ================================================================
   Buttons - Consistent with Public
   ================================================================ */

.btn-ayha-primary {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-base);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-ayha-primary:hover {
    background-color: #0e7490;
    border-color: #0e7490;
    color: var(--color-base);
}

.btn-ayha-secondary {
    background-color: transparent;
    border: 2px solid var(--color-secondary);
    color: var(--color-secondary);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-ayha-secondary:hover {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-base);
}

.btn-ayha-danger {
    background-color: transparent;
    border: 2px solid #dc2626;
    color: #dc2626;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-ayha-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: var(--color-base);
}

/* ================================================================
   Badges
   ================================================================ */

.badge-ayha {
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 0.25rem;
}

.badge-ayha-primary {
    background-color: var(--color-accent);
    color: var(--color-base);
}

.badge-ayha-secondary {
    background-color: var(--color-sidebar-bg);
    color: var(--color-text-primary);
}

.badge-ayha-success {
    background-color: #10b981;
    color: var(--color-base);
}

.badge-ayha-warning {
    background-color: #f59e0b;
    color: var(--color-base);
}

.badge-ayha-danger {
    background-color: #dc2626;
    color: var(--color-base);
}

/* ================================================================
   Responsive Adjustments
   ================================================================ */

/* Prevent horizontal scrolling */
.admin-content > * {
    max-width: 100%;
}

/* Ensure dashboard cards don't overflow */
.row.g-4 {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

.row.g-4 > * {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Make tables responsive */
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .admin-wrapper {
        height: auto;
        min-height: calc(100vh - 64px - 49px);
    }

    .admin-sidebar {
        position: fixed;
        left: -250px;
        z-index: 1000;
        transition: left 0.3s ease;
        height: calc(100vh - 64px);
    }
    
    .admin-sidebar.show {
        left: 0;
    }
    
    .admin-content {
        padding: 1rem;
        width: 100%;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .admin-header {
        margin-bottom: 1.5rem;
    }
}