/**
 * Modern Enhanced CSS for Toko Amanah Admin (v2.0)
 * Theme: Slate Premium Dark
 * Layout: Full Width Flexbox
 */

:root {
    /* Color Palette - Slate Inspired */
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;

    /* Backgrounds */
    --bg-app: var(--slate-900);
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 1);

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: var(--slate-400);

    /* Accents */
    --accent-primary: #3b82f6;
    /* Blue */
    --accent-success: #10b981;
    /* Emerald */
    --accent-warning: #f59e0b;
    /* Amber */
    --accent-danger: #ef4444;
    /* Red */
    --accent-purple: #8b5cf6;
    /* Violet */

    /* Glass Effect */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --glass-backdrop: blur(12px);

    /* Layout Dimensions */
    --sidebar-width: 260px;
    --content-padding: 2rem;
}

/* =========================================
   1. CORE LAYOUT (FLEXBOX FULL VIEWPORT)
   ========================================= */
* {
    box-sizing: border-box;
}

/* V4: Perfected Floating Glass Layout */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Poppins', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* V5: Ultra-Professional Premium Sidebar */
:root {
    --sidebar-bg: rgba(15, 23, 42, 0.9);
    --sidebar-hover: rgba(255, 255, 255, 0.04);
    --sidebar-active: rgba(59, 130, 246, 0.1);
    --sidebar-border: rgba(255, 255, 255, 0.08);
}

.sidebar {
    position: fixed;
    top: 15px;
    left: 15px;
    width: var(--sidebar-width);
    height: calc(100vh - 30px);
    background: var(--sidebar-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--sidebar-border) !important;
    border-radius: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Brand Header --- */
.sidebar-header {
    padding: 2.25rem 1.5rem 1.75rem;
    position: relative;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.brand-text-wrapper small {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* --- Profile Section --- */
.sidebar-user {
    padding: 0 1.2rem 2rem;
}

.sidebar-user-info {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: #1e293b;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #3b82f6;
}

.sidebar-user-details {
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role .badge {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.6rem;
    padding: 3px 6px;
}

/* --- Navigation --- */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem 1.5rem;
}

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

.sidebar-menu-item {
    margin-bottom: 4px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    color: #94a3b8 !important;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    position: relative;
}

.sidebar-menu-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 12px;
    display: flex;
    justify-content: center;
}

.sidebar-menu-link:hover {
    background: var(--sidebar-hover);
    color: #fff !important;
}

/* Active State with Indicator Bar */
.sidebar-menu-item.active .sidebar-menu-link {
    background: var(--sidebar-active);
    color: #3b82f6 !important;
    font-weight: 600;
}

.sidebar-menu-item.active .sidebar-menu-link::after {
    content: '';
    position: absolute;
    left: -12px;
    top: 25%;
    height: 50%;
    width: 3px;
    background: #3b82f6;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 10px rgba(59, 130, 246, 0.5);
}

.sidebar-menu-item.active .sidebar-menu-link i {
    color: #3b82f6;
}

/* --- Layout Adjustments --- */
.main-content {
    margin-left: calc(var(--sidebar-width) + 35px);
    padding: 2.5rem !important;
    min-height: 100vh;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Collapsed Support --- */
.sidebar.collapsed {
    width: 85px;
}

.sidebar.collapsed~.main-content {
    margin-left: 120px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .brand-text-wrapper small,
.sidebar.collapsed .sidebar-user-details,
.sidebar.collapsed .sidebar-menu-link span {
    display: none !important;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar.collapsed .sidebar-user-info {
    padding: 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu-link {
    justify-content: center;
    padding: 15px 0;
}

.sidebar.collapsed .sidebar-menu-link i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar.collapsed .sidebar-menu-item.active .sidebar-menu-link::after {
    left: 0;
}

/* Tablet & Mobile (< 992px) */
@media (max-width: 992px) {
    .sidebar {
        left: -320px;
        top: 15px;
        height: calc(100vh - 30px);
        width: 280px !important;
        border-radius: 20px;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: fixed !important;
    }

    .sidebar.active {
        left: 15px;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        width: 100%;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 900;
        transition: opacity 0.3s ease;
    }

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

/* User Profile Card */
.sidebar-user {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.avatar-holder img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* Navigation Menu */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0.8rem;
}

.menu-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--slate-500);
    letter-spacing: 1.5px;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem 1rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--slate-300) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white !important;
    transform: translateX(4px);
}

.menu-icon {
    width: 24px;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    margin-right: 12px;
    color: var(--slate-400);
}

.menu-item.active .menu-link {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary) !important;
    font-weight: 600;
}

.menu-item.active .menu-icon {
    color: var(--accent-primary);
}

.container-fluid {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

/* =========================================
   2. TYPOGRAPHY & UTILITIES
   ========================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.text-white-50 {
    color: var(--slate-400) !important;
}

/* =========================================
   3. COMPONENTS
   ========================================= */

/* Topbar Refined */
.topbar {
    width: 100%;
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 0.75rem 2rem !important;
    margin-bottom: 2rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.btn-logout-modern {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    padding: 0.6rem 1.25rem !important;
    border-radius: 12px !important;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-logout-modern:hover {
    background: #ef4444 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.header-icon {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* Modern Card */
.card-modern {
    background: var(--bg-card) !important;
    backdrop-filter: var(--glass-backdrop);
    border: var(--glass-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--glass-shadow);
    transition: all 0.2s ease;
}

.card-modern:hover {
    transform: translateY(-3px);
    background: var(--bg-card-hover) !important;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

/* Stat Card Content */
.stat-card-modern {
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
}

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

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-icon-bg {
    position: absolute;
    right: 0;
    bottom: 0;
    font-size: 5rem;
    opacity: 0.05;
    transform: rotate(-10deg) translate(10px, 10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.card-modern:hover .stat-icon-bg {
    opacity: 0.1;
    transform: rotate(0deg) translate(0, 0);
}

/* Alert */
.alert-modern-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--accent-danger);
    color: #fca5a5;
    border-radius: 8px;
    padding: 1rem 1.5rem;
}

/* Button Global */
.btn {
    border-radius: 50px !important;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple)) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

/* =========================================
   4. RESPONSIVE MEDIA QUERIES
   ========================================= */

/* =========================================
   5. GLOBAL TEXT & CONTRAST OVERRIDES
   ========================================= */

/* Force all standard text to be light */
body,
p,
li,
span,
div {
    color: var(--text-primary);
}

/* Muted text should still be readable */
.text-muted {
    color: var(--slate-400) !important;
}

/* Override Bootstrap Dark Text Utilities */
.text-dark {
    color: var(--text-primary) !important;
}

.text-black-50 {
    color: var(--slate-400) !important;
}

/* =========================================
   6. TABLE & DATA MODERNIZATION
   ========================================= */
.table {
    color: #cbd5e1 !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
}

.table thead th {
    background: rgba(30, 41, 59, 0.8) !important;
    color: #94a3b8 !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 1.25rem 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.table td {
    padding: 1.25rem 1rem !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--bs-table-hover-bg) !important;
}

/* =========================================
   7. PREMIUM FORM INPUTS
   ========================================= */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
    border-radius: 12px !important;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
}

.form-label {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

.input-group-text {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #64748b !important;
    border-radius: 12px !important;
}

/* Glass Card Enhancements */
.glass-card,
.card {
    background: rgba(30, 41, 59, 0.4) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 1.5rem !important;
}

/* =========================================
   8. MEDIA QUERIES (Handled Above)
   ========================================= */