@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.98);
    
    /* Text Colors */
    --text-dark: #1f2937;   /* For Headings and Main Text */
    --text-body: #4b5563;   /* For Paragraphs */
    --text-light: #6b7280;  /* For Muted Labels */
    
    --border-color: #e5e7eb;

    /* Typography Standards (Use these everywhere) */
    --font-family: 'Poppins', sans-serif;
    --fs-h1: 24px;
    --fs-h2: 20px;
    --fs-h3: 16px;
    --fs-body: 14px;
    --fs-small: 12px;
    --fs-stat: 28px;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: var(--font-family); 
}

body { 
    font-size: var(--fs-body); 
    color: var(--text-body); 
}

/* --- LOGIN PAGE --- */
body.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-gradient); padding: 20px;
}
.login-container {
    width: 100%; max-width: 420px; background: var(--card-bg); border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); padding: 40px 30px; animation: slideUp 0.6s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h2 { color: var(--text-dark); font-size: var(--fs-h1); font-weight: 700; margin-bottom: 8px; }
.login-header p { color: var(--text-light); font-size: var(--fs-body); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; color: var(--text-dark); font-size: var(--fs-body); font-weight: 500; margin-bottom: 8px; }
.form-control {
    width: 100%; padding: 14px 16px; border: 1px solid var(--border-color); border-radius: 12px;
    font-size: 15px; color: var(--text-dark); transition: all 0.3s; background: #f9fafb;
}
.form-control:focus { outline: none; border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }
.btn-login {
    width: 100%; padding: 15px; background: var(--primary-color); color: white; border: none;
    border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.3s; margin-top: 10px;
}
.btn-login:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3); }
.alert-danger { background-color: #fee2e2; color: #b91c1c; padding: 12px 16px; border-radius: 10px; font-size: var(--fs-body); margin-bottom: 20px; border: 1px solid #f87171; }

/* Password Toggle */
.password-wrapper { position: relative; width: 100%; }
.password-wrapper .form-control { padding-right: 45px; }
.toggle-password { position: absolute; top: 50%; right: 15px; transform: translateY(-50%); cursor: pointer; color: var(--text-light); }
.toggle-password:hover { color: var(--primary-color); }

/* --- DASHBOARD LAYOUT --- */
body.dashboard-body { background-color: #f4f6f9; display: block; min-height: 100vh; }
.dashboard-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 260px; background: #1e293b; color: white; flex-shrink: 0; display: flex; flex-direction: column; transition: left 0.3s ease; }
.sidebar .brand { padding: 20px; text-align: center; font-size: var(--fs-h2); font-weight: 700; border-bottom: 1px solid #334155; color: #fff; }
.sidebar .nav-links { display: flex; flex-direction: column; padding-top: 10px; flex-grow: 1; }
.sidebar .nav-links a { color: #cbd5e1; text-decoration: none; padding: 14px 20px; display: flex; align-items: center; gap: 12px; transition: 0.2s; font-size: 15px; }
.sidebar .nav-links a:hover, .sidebar .nav-links a.active { background: #334155; color: #fff; border-left: 4px solid var(--primary-color); }

/* Main Content Area */
.main-content { flex-grow: 1; padding: 30px; width: 100%; overflow-x: hidden; }
.top-navbar { background: white; padding: 15px 25px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 30px; }
.top-navbar h1 { font-size: var(--fs-h2); color: var(--text-dark); margin: 0; font-weight: 600; }
.btn-logout { background: #ef4444; color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 8px; font-size: var(--fs-body); }
.btn-logout:hover { background: #dc2626; }

/* Stats Grid (No Tables) */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; padding: 25px; border-radius: 16px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); display: flex; align-items: center; gap: 20px; border: 1px solid #f1f5f9; transition: transform 0.3s; }
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.08); }
.stat-icon { width: 60px; height: 60px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.icon-blue { background: #e0e7ff; color: #4f46e5; }
.icon-green { background: #dcfce7; color: #16a34a; }
.icon-purple { background: #f3e8ff; color: #9333ea; }
.stat-info h3 { margin: 0; font-size: var(--fs-body); color: var(--text-light); font-weight: 500; }
.stat-info h2 { margin: 5px 0 0 0; font-size: var(--fs-stat); color: var(--text-dark); font-weight: 700; }

/* --- DATA CARDS (For Properties, Members, etc.) --- */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.data-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.data-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}
.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 12px;
    margin-bottom: 15px;
}
.data-card-header h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: var(--fs-h3);
    font-weight: 600;
}
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: var(--fs-small);
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-info { background: #e0f2fe; color: #0284c7; }
.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: var(--fs-body);
}
.data-row .label { color: var(--text-light); font-weight: 500; }
.data-row .value { color: var(--text-dark); font-weight: 600; }

/* --- MOBILE HAMBURGER & SIDEBAR DRAWER --- */
.mobile-menu-btn {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    margin-right: 15px;
}

.sidebar-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.top-navbar-left {
    display: flex;
    align-items: center;
}

/* --- PERFECT MOBILE RESPONSIVENESS (DRAWER) --- */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block; /* Show hamburger on mobile */
    }
    
    .top-navbar { 
        flex-direction: row; 
        align-items: center; 
        justify-content: space-between;
        padding: 15px; 
    }
    
    .top-navbar-left h1 { font-size: 18px; }

    /* Transform Sidebar into a Slide-out Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Hide it off-screen to the left */
        height: 100vh;
        z-index: 1000;
        width: 260px;
    }

    /* Slide it in when the 'active' class is applied */
    .sidebar.active {
        left: 0;
    }

    /* Show overlay when menu is active */
    .sidebar-overlay.active {
        display: block;
    }

    /* Hide the Welcome text on very small screens to save space */
    .hide-mobile {
        display: none !important;
    }

    /* Ensure stats cards take full width */
    .stats-grid { grid-template-columns: 1fr; }
    .main-content { padding: 15px; }
}


/* =========================================
   GLOBAL TYPOGRAPHY OVERRIDES 
   (Ensures everything follows the standard)
   ========================================= */

/* Force all headings to use the standard sizes */
h1, .h1 { font-size: var(--fs-h1) !important; font-weight: 700 !important; color: var(--text-dark); }
h2, .h2 { font-size: var(--fs-h2) !important; font-weight: 600 !important; color: var(--text-dark); }
h3, .h3 { font-size: var(--fs-h3) !important; font-weight: 600 !important; color: var(--text-dark); }
h4, .h4 { font-size: var(--fs-body) !important; font-weight: 600 !important; color: var(--text-dark); }

/* Force standard size for paragraphs and normal text */
/* Force standard size for paragraphs and normal text */
p, span, div, li, a {
    font-size: var(--fs-body);
}

/* Only apply dark text inside the main content, but NOT to buttons or links */
.main-content p, 
.main-content span, 
.main-content div, 
.main-content li, 
.main-content label {
    color: var(--text-body);
}

/* Ensure buttons and links keep their own colors */
.main-content a, 
.main-content button, 
.main-content .btn-login {
    color: white;
}

/* Make sure labels are slightly smaller and bold */
label { font-size: var(--fs-body); font-weight: 500; color: var(--text-dark); }

/* Buttons use standard font */
button, .btn-login, .btn-logout {
    font-family: var(--font-family);
    font-size: var(--fs-body);
    font-weight: 500;
}

/* Form inputs use standard font */
.form-control, input, textarea, select {
    font-family: var(--font-family);
    font-size: var(--fs-body);
}

/* Ensure the dashboard card numbers are big and bold */
.stat-info h2 {
    font-size: var(--fs-stat) !important;
    font-weight: 700 !important;
}

/* Ensure the data card titles are standard h3 size */
.data-card-header h4 {
    font-size: var(--fs-h3) !important;
}


/* =========================================
   PROFESSIONAL DASHBOARD UI
   ========================================= */

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 30px;
    color: white;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px rgba(30, 41, 59, 0.2);
}
.welcome-banner h2 { color: white !important; margin-bottom: 5px; }
.welcome-banner p { color: #cbd5e1 !important; font-size: var(--fs-body); margin: 0; }
.welcome-banner .date-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: var(--fs-body);
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Quick Actions */
.section-title {
    font-size: var(--fs-h3);
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.action-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.action-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}
.action-btn i {
    font-size: 20px;
    color: var(--primary-color);
    background: #e0e7ff;
    padding: 12px;
    border-radius: 10px;
}

/* Stat Card Enhancements */
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
    transform: skewX(-20deg) translateX(150%);
    transition: 0.5s;
}
.stat-card:hover::after {
    transform: skewX(-20deg) translateX(-150%);
}
.stat-trend {
    font-size: var(--fs-small);
    color: #16a34a;
    font-weight: 600;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}



/* --- SIDEBAR ACCORDION MENU --- */
/* --- SIDEBAR ACCORDION MENU --- */
.dropdown-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.nav-links a.dropdown-toggle {
    color: #cbd5e1;
    text-decoration: none;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.2s;
    font-size: 15px;
    cursor: pointer;
}

.nav-links a.dropdown-toggle:hover, 
.nav-links a.dropdown-toggle.active {
    background: #334155;
    color: #ffffff !important;
    border-left: 4px solid var(--primary-color);
}

.dropdown-toggle span i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    color: #cbd5e1;
}

.nav-links a.dropdown-toggle.active span i {
    color: var(--primary-color);
}

.dropdown-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-right: 5px;
    color: #cbd5e1;
}

.dropdown-container.open .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #0f172a;
    display: flex;
    flex-direction: column;
}

.dropdown-container.open .dropdown-menu {
    max-height: 200px;
}

.dropdown-menu a {
    color: #94a3b8 !important;
    text-decoration: none;
    padding: 12px 20px 12px 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: 0.2s;
    border-left: 4px solid transparent;
}

.dropdown-menu a:hover, 
.dropdown-menu a.active {
    background: #1e293b;
    color: #ffffff !important;
    border-left: 4px solid var(--primary-color);
    font-weight: 500;
}

.dropdown-menu a i {
    font-size: 12px;
    color: #64748b;
}

.dropdown-menu a.active i {
    color: var(--primary-color);
}

/* --- SIDEBAR ACCORDION MENU --- */


/* =========================================
   ADVANCED GENEALOGY TREE (Matches Doc)
   ========================================= */
.tree-wrapper {
    overflow-x: auto;
    padding: 40px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    min-height: 500px;
}

.tree {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.tree ul {
    padding-top: 20px;
    position: relative;
    display: flex;
    justify-content: center;
    transition: all 0.5s;
}

.tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
    transition: all 0.5s;
}

/* Connecting Lines */
.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 20px;
}
.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

/* Remove lines from the first and last children */
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}
.tree li:only-child {
    padding-top: 0;
}
.tree li:first-child::before, .tree li:last-child::after {
    border: 0 none;
}
/* Add back the vertical line for the last child */
.tree li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* Vertical line dropping from the parent */
.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 20px;
    transform: translateX(-50%);
}

/* The Node Card */
.tree-node-card {
    border: 2px solid var(--primary-color);
    padding: 15px 10px;
    text-decoration: none;
    color: #666;
    font-family: arial, sans-serif;
    font-size: 12px;
    display: inline-block;
    border-radius: 12px;
    transition: all 0.5s;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    min-width: 140px;
}

.tree-node-card:hover {
    background: #e0e7ff;
    border-color: var(--primary-hover);
    transform: scale(1.05);
    z-index: 10;
}

.tree-node-card.root {
    border-color: var(--gold);
    background: #fffbeb;
}

.tree-node-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid var(--border-color);
}

.tree-node-card .name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 2px;
}

.tree-node-card .id {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.tree-node-card .rank {
    background: #e0e7ff;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}