/* =============================================
   Mangasaraja — Bootstrap Dark Theme Overrides
   Premium Heritage Dark Gold Theme v2.0
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Cinzel:wght@400;600;700&display=swap');

:root {
    /* Base Colors & Backgrounds */
    --bs-body-bg: #050508;
    --bs-body-color: #EAE0D5;

    /* Gold Palette - Refined */
    --gold: #D4AF37;
    --gold-light: #F3E5AB;
    --gold-dark: #8C7328;
    --gold-gradient: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);

    /* Surface Colors (Glassmorphism) */
    --bg-glass-heavy: rgba(18, 18, 24, 0.75);
    --bg-glass-medium: rgba(22, 22, 28, 0.60);
    --bg-glass-light: rgba(255, 255, 255, 0.03);

    /* Borders & Separators */
    --border-subtle: rgba(212, 175, 55, 0.15);
    --border-highlight: rgba(212, 175, 55, 0.4);

    /* Text Colors */
    --text-primary: #EAE0D5;
    --text-secondary: #9A9488;
    --text-muted: #6B655C;

    /* Shadows & Glows */
    --glow-gold: 0 0 20px rgba(212, 175, 55, 0.15);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background Pattern - Modernized */
.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(212, 175, 55, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(140, 115, 40, 0.03) 0%, transparent 40%),
        linear-gradient(to bottom, #050508 0%, rgba(10, 10, 15, 0) 50%, #050508 100%);
    opacity: 0.8;
}

.bg-pattern::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23D4AF37' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    mask-image: linear-gradient(to bottom, black 20%, transparent 90%);
}

/* =============================================
   Scrollbar - Sleek
   ============================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

/* =============================================
   Glassmorphism Cards
   ============================================= */
.card {
    background: var(--bg-glass-heavy) !important;
    border: 1px solid var(--border-subtle) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(212, 175, 55, 0.3) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), var(--glow-gold);
}

.card-header {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 18px 24px !important;
}

.card-body {
    padding: 24px !important;
}

/* =============================================
   Premium Buttons
   ============================================= */
.btn {
    border-radius: 12px !important;
    padding: 10px 24px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary,
.btn-warning {
    background: var(--gold-gradient) !important;
    border: none !important;
    color: #1A1A1A !important;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover,
.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px) !important;
    filter: brightness(1.1);
}

.btn-primary:active,
.btn-warning:active {
    transform: translateY(0) !important;
}

.btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    background: transparent !important;
    color: var(--bs-body-color) !important;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: #fff !important;
    color: #fff !important;
}

/* =============================================
   Inputs & Forms
   ============================================= */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--bs-body-color) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    transition: all 0.2s ease !important;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1) !important;
    color: #fff !important;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px !important;
}

/* =============================================
   Navbar - Floating & Glass
   ============================================= */
.pub-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 0;
    transition: all 0.4s ease;
}

.pub-navbar.scrolled {
    padding: 10px 0;
    background: rgba(5, 5, 8, 0.85);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 15px;
    padding: 8px 18px !important;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold) !important;
    background: rgba(212, 175, 55, 0.08);
}

/* Responsive Logo */
.navbar-logo {
    height: 50px;
    width: auto;
    transition: height 0.3s ease;
}

@media (max-width: 991px) {
    .navbar-logo {
        height: 40px;
    }
}

/* =============================================
   Hero Section
   ============================================= */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 160px 0 100px;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 4vw, 4rem);
    /* Reduced max size */
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(to bottom, #fff, #d4d4d4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    /* Tighter letter spacing */
}

.hero-title span {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    margin-top: 8px;
    /* Add space between lines */
}

.hero-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.8;
    /* Increased line height for readability */
    color: var(--text-secondary);
    max-width: 650px;
    /* Limit width for optimal reading length */
    margin-bottom: 32px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 50px;
    color: var(--gold);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
    backdrop-filter: blur(4px);
}

/* Hero Stat Item */
.hero-stat {
    text-align: center;
    padding: 20px;
    background: var(--bg-glass-light);
    border-radius: 16px;
    border: 1px solid rgba(255, y 255, 255, 0.05);
}

.hero-stat-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

.hero-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* =============================================
   Tree View Container
   ============================================= */
.tree-view-wrapper {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border-subtle), 0 20px 40px rgba(0, 0, 0, 0.4);
    background: rgba(10, 10, 14, 0.6);
    height: 70vh;
    min-height: 500px;
}

@media (max-width: 768px) {
    .tree-view-wrapper {
        height: 60vh;
        min-height: 400px;
    }
}

.tree-controls button {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(20, 20, 25, 0.9);
    color: var(--gold);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.tree-controls button:hover {
    background: var(--gold);
    color: #000;
}

/* =============================================
   Typography & Sections
   ============================================= */
.section-title-wrapper {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #fff;
    margin-bottom: 16px;
}

.section-divider {
    height: 2px;
    width: 80px;
    background: var(--gold-gradient);
    margin: 0 auto;
    border-radius: 2px;
}

/* Glass Card Utility */
.glass-card {
    background: var(--bg-glass-medium);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

/* Stat Card */
.stat-card {
    background: var(--bg-glass-medium);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold);
}

.stat-icon {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =============================================
   Utilities
   ============================================= */
.text-gold {
    color: var(--gold) !important;
}

.text-muted-gold {
    color: #8a7a5a !important;
}

/* Animation Utility */
.animate-fade-up {
    animation: fadeUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* Mobile Optimizations */
@media (max-width: 991px) {
    .container {
        padding-left: 16px;
        /* Reduced for tighter mobile feel */
        padding-right: 16px;
    }

    .pub-navbar {
        padding: 12px 0;
        background: rgba(5, 5, 8, 0.95);
        border-bottom: 1px solid var(--border-subtle);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .pub-navbar .container {
        /* flex-wrap: wrap; Removed for single line layout */
    }

    .navbar-brand {
        /* width: 100%; Removed */
        margin-right: 0;
    }

    .navbar-brand img {
        height: 45px !important;
        /* Slightly larger for visibility */
        width: auto !important;
        display: block !important;
    }

    .navbar-brand .fw-bold {
        font-size: 16px !important;
        /* Scaled down text */
    }

    .navbar-brand div[style*="font-size:12px"] {
        font-size: 10px !important;
        /* Scaled down subtitle */
    }

    .hero-section {
        padding-top: 70px;
        /* Reduced top padding */
        text-align: center;
        background-position: center top !important;
        /* Focus on top part of image */
    }

    .hero-title {
        font-size: 2.5rem;
        /* prevent huge text on mobile */
    }

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
        font-size: 1rem;
        padding: 0 10px;
    }

    .hero-stat {
        margin-bottom: 0;
        padding: 15px 10px;
    }

    .hero-stat-val {
        font-size: 1.5rem;
    }

    .nav-link {
        padding: 12px !important;
        margin: 4px 0;
        background: rgba(255, 255, 255, 0.03);
        text-align: center;
        /* Center links in mobile menu */
    }

    .navbar-toggler {
        display: block !important;
        border: none;
        padding: 0;
    }

    .navbar-toggler:focus {
        box-shadow: none;
    }

    .navbar-collapse {
        background: rgba(10, 10, 15, 0.95);
        padding: 20px;
        border-radius: 20px;
        margin-top: 10px;
        border: 1px solid var(--border-subtle);
        backdrop-filter: blur(20px);
    }
}

/* =============================================
   Backend Layout
   ============================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: rgba(10, 10, 15, 0.95);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Branding */
.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.05), transparent);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 24px 16px 12px;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.sidebar-link.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.sidebar-link-icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Sidebar User Profile */
.sidebar-user {
    padding: 20px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gold-gradient);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-muted);
}

/* Mobile Sidebar */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 24px;
    margin-bottom: 20px;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .mobile-menu-btn {
        display: block;
    }
}

/* Tables - Backend Only */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-secondary);
    --bs-table-border-color: var(--border-subtle);
}

.table> :not(caption)>*>* {
    padding: 16px 24px;
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.table th {
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-subtle) !important;
}

.table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(212, 175, 55, 0.05);
    color: #fff;
}

/* Badges */
.notification-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* =============================================
   Birthday Components
   ============================================= */
.birthday-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.birthday-card:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.05);
}

.birthday-card.today {
    background: linear-gradient(to right, rgba(39, 174, 96, 0.1), rgba(39, 174, 96, 0.05));
    border-left: 3px solid #2ecc71;
}

.birthday-card.tomorrow {
    background: linear-gradient(to right, rgba(230, 126, 34, 0.1), rgba(230, 126, 34, 0.05));
    border-left: 3px solid #e67e22;
}

.bday-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    color: #1a1a24;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.bday-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-today,
.badge-tomorrow {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-today {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.badge-tomorrow {
    background: rgba(230, 126, 34, 0.2);
    color: #e67e22;
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.month-btn {
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border: 1px solid transparent;
    flex: 1;
    text-align: center;
    min-width: 60px;
}

.month-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.month-btn.active {
    background: var(--gold);
    color: #000;
    font-weight: 700;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* =============================================
   Contribution / Iuran Styles
   ============================================= */
.fw-mono {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    letter-spacing: 0.5px;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bg-success {
    background-color: #2ecc71 !important;
    color: #fff;
}

.bg-danger {
    background-color: #e74c3c !important;
    color: #fff;
}

.bg-warning {
    background-color: #f1c40f !important;
    color: #000;
}

.bg-primary {
    background-color: #3498db !important;
    color: #fff;
}

.bg-secondary {
    background-color: #95a5a6 !important;
    color: #fff;
}

.text-success {
    color: #2ecc71 !important;
}

.text-warning {
    color: #f1c40f !important;
}