@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800&family=Poppins:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');
/* family-details/assets/css/style.css */
/* Fonts inherited from ../css/cssStyle.css */

:root {
    /* Main variables are already defined in cssStyle.css, but we can map local ones */
    --primary-color: #ffffe3;
    --secondary-color: #fffff8;

    /* Updated Palette to match Main Site (Teal/Gold/Cream) */
    --main-color: #04415e;
    --main-color-rgb: 4, 65, 94;
    /* Matching --bold-color */
    --accent-color: #bcb88a;
    /* Matching --card-bttom or similar gold tone */

    --card-bg: #ffffff;
    --text-primary: #04415e;
    /* --bold-color */
    --text-secondary: #786c3b;
    /* --font-color-three */

    --line-color: #8c8c7a;
    /* Muted version of font color for lines */

    --card-radius: 12px;
    --shadow: 0 4px 15px rgba(4, 65, 94, 0.1);
    /* Shadow tinted with main color */
    --shadow-hover: 0 10px 25px rgba(4, 65, 94, 0.15);

    --text-on-main: #ffffff;
    --modal-backdrop: rgba(255, 255, 255, 0.4);
}

body.dark {
    --primary-color: #2b2b21;
    --secondary-color: #737359;
    --main-color: #ffffe3;
    --accent-color: #57c785;
    --card-bg: #2b2b21;
    --text-primary: #fffff8;
    --text-secondary: #e4e4c0;
    --line-color: #a3a3a3;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.7);

    --text-on-main: #2b2b21;
    --modal-backdrop: rgba(0, 0, 0, 0.6);
}

/* Re-applying variable overrides for Tree View specifically if needed */
/* The main css defines --primary-color. We might want to respect it or override it for the tree context. */
/* Using specific tree variables to avoid collision */

body {
    margin: 0;
    color: var(--text-primary);
    background-color: #fcfbf9;
    /* Integrated warm background */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Prevent horizontal scroll only */
    overflow-y: auto;
    /* Allow vertical scroll */
}

body.dark {
    background-color: #24201d;
    /* Integrated dark background */
}


/* Specific Page Overrides */
.page-family-tree {
    overflow: hidden;
    height: 100vh;
}

/* Reset IMG styles from main css which forces width: 100% */
img {
    width: auto;
    height: auto;
    overflow: visible;
}

/* Fix for Header Profile Image being reset by above rule */
.show-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

a {
    text-decoration: none;
}

.tree-viewport {
    flex: 1;
    /* Fill remaining space */
    width: 100%;
    margin: 0;
    /* No margins */
    padding-top: 80px;
    /* Space for fixed header if needed, or rely on flex if header isn't fixed. Keeping consistent with previous spacing logic */
    border-radius: 0;

    /* Warm Heritage Theme - Full Screen */
    background-color: #fcfbf9;

    /* Grid Lines Pattern */
    background-image:
        linear-gradient(rgba(210, 200, 180, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(210, 200, 180, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;

    box-shadow: none;
    /* No shadow */

    overflow: hidden;
    position: relative;
    cursor: grab;
}

@media (max-width: 768px) {
    .member-names h4 {
        font-size: 11px;
    }

    .member-card .member-imgs {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-radius: 8px;
    }

    .couple-container {
        padding: 4px 8px;
    }

    /* Responsive Controls */
    .search-wrapper {
        width: 85% !important;
        /* Slightly smaller to avoid edge touch */
        top: 6rem;
    }

    .controls-filter {
        top: auto !important;
        bottom: 20px !important;
        left: 20px !important;
        right: auto !important;
        align-items: flex-start !important;
    }

    /* Make dropdown open UPWARDS on mobile since it's at the bottom */
    .controls-filter .dropdown-options {
        top: auto !important;
        bottom: calc(100% + 10px) !important;
        transform: translateY(10px) !important;
    }

    .controls-filter .custom-dropdown.active .dropdown-options {
        transform: translateY(0) !important;
    }
}

body.dark .tree-viewport {
    background-color: #24201d;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    box-shadow: none;
}

.tree-viewport:active {
    cursor: grabbing;
}

.tree-container {
    padding: 100px;
    position: absolute;
    transform-origin: 0 0;
}

/* Tree Structure */
ul.tree {
    display: flex;
    justify-content: center;
    padding-top: 40px;
    position: relative;
}

ul.tree ul {
    display: flex;
    justify-content: center;
    padding-top: 40px;
    position: relative;
}

ul.tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 40px 10px 0 10px;
    transition: all 0.3s;
}

/* Connectors - The Lines */
ul.tree li::before,
ul.tree li::after {
    content: "";
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid var(--line-color);
    width: 50%;
    height: 40px;
}

ul.tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid var(--line-color);
}

/* Connector Exclusions */
ul.tree li:only-child::after,
ul.tree li:only-child::before {
    display: none;
}

ul.tree li:only-child {
    padding-top: 0;
}

ul.tree li:first-child::before,
ul.tree li:last-child::after {
    border: 0 none;
}

/* Rounded Corners for Connectors */
ul.tree li:last-child::before {
    border-right: 2px solid var(--line-color);
    border-radius: 0 15px 0 0;
}

ul.tree li:first-child::after {
    border-radius: 15px 0 0 0;
}

/* Downward Line from Parent */
ul.tree ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--line-color);
    width: 0;
    height: 40px;
}

/* Card Container - Unified "One Card" Look */
.couple-container {
    display: inline-flex;
    align-items: stretch;
    justify-content: center;
    background: var(--card-bg);
    padding: 0;
    border-radius: 16px;
    /* Larger radius for modern look */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.05);
    /* Soft double shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 2;
    gap: 0;
    overflow: hidden;
    /* Ensure children don't bleed */
    min-width: 200px;
}

.couple-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.05);
    z-index: 10;
    /* Bring to front */
}

/* Remove Connector between Couple */
.couple-container.has-spouse::after {
    display: none;
    /* Handled by flex layout */
}

/* Individual Member Items (Inside the Unified Card) */
.member-card {
    display: flex;
    flex-direction: row;
    /* Vertical Stacking */
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    padding: 15px 12px 28px 12px;
    /* Bottom padding for generation badge */
    background: transparent;
    transition: background 0.2s;
    min-width: 100px;
    position: relative;
    justify-content: center;
    /* Center content horizontally if needed, though row handles it */
}

.member-card:hover {
    background: linear-gradient(to bottom, var(--card-bg), var(--primary-color));
}

/* Image Wrapper for better control */
.member-card .member-imgs {
    width: 64px;
    height: 64px;
    min-height: 64px;
    min-width: 64px;
    position: relative;
    border-radius: 12px;
    /* Rounded Square */
    background: var(--card-bg);
    padding: 0;
    border: 2px solid var(--accent-color);
    /* Moved from img */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Clips the image */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.member-card img {
    width: 100%;
    height: 100%;
    border-radius: 0;
    /* Inherit clipping from container */
    object-fit: cover;
    display: block;
}

.member-names {
    text-align: left;
    /* Align text left next to image since it's row */
    width: auto;
    padding-left: 10px;
}

.member-names h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Generation Badge - Modern Pill Style (Absolute Bottom) */
.member-card .generation {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-block;
    font-size: 10px;
    color: var(--text-on-main);
    background-color: var(--main-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    opacity: 0.9;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Removed unused .role style */

/* Divider between spouses - Vertical Line */
.spouse-card {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    margin-left: 0;
    padding-left: 12px;
}

/* Action Buttons Overlay - only show on hover of the card */
.node-actions {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: var(--card-bg);
    padding: 4px 8px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: all 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.couple-container:hover .node-actions {
    bottom: 5px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}

.action-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--main-color);
    color: var(--text-on-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: transform 0.2s, background 0.2s;
}

.action-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}


/* --- Search Bar --- */
.search-wrapper {
    position: absolute;
    top: 6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 95;
    width: 350px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.search-wrapper input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    /* Added left padding for icon */
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 253, 245, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(60, 50, 40, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.5);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
    color: var(--text-primary);
    box-sizing: border-box;
    text-align: left;
    /* Changed from center to accommodate icon */
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 10;
    transition: all 0.3s;
}

.search-wrapper input:focus {
    background: #fff;
    box-shadow: 0 8px 25px rgba(60, 50, 40, 0.1), 0 0 0 1px rgba(var(--main-color), 0.2);
    width: 100%;
    transform: scale(1.02);
}

.search-wrapper input:focus+#searchResults~.search-icon,
.search-wrapper input:focus~.search-icon {
    color: var(--main-color);
}

.search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--card-bg);
    margin-top: 0;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
}

.search-results.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.search-result-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background 0.1s;
}

.search-result-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.search-result-item .avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* --- Controls Layout --- */

/* 1. Top Right: Filters - Moved down to avoid Header overlapping */
/* 1. Top Right: Filters - Moved down to avoid Header overlapping */
/* 1. Top Right: Filters */
.controls-filter {
    position: absolute;
    /* Relative to viewport container now */
    top: 6rem;
    right: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
    /* Allow clicks to pass through */
}

.filter-group {
    display: flex;
    gap: 10px;
    pointer-events: auto;
    /* Re-enable clicks on the buttons */
}

/* 2. Bottom Right: Navigation Pills */
/* 2. Bottom Right: Navigation Pills */
.controls-nav {
    position: absolute;
    /* Relative to viewport container */
    bottom: 20px;
    /* Inside the rounded corner */
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-end;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

/* Glassmorphism with Warm Tint */
.control-group {
    background: rgba(255, 253, 245, 0.85);
    /* Warm white glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px;
    border-radius: 16px;
    box-shadow:
        0 4px 6px -1px rgba(60, 50, 40, 0.1),
        0 2px 4px -1px rgba(60, 50, 40, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

.control-group:hover {
    box-shadow:
        0 10px 15px -3px rgba(60, 50, 40, 0.12),
        0 4px 6px -2px rgba(60, 50, 40, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

body.dark .control-group {
    background: rgba(40, 36, 34, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Specific: View Toggles (Group 1) -> Horizontal row */
.controls-nav .control-group:first-child {
    flex-direction: row;
}

/* Specific: Zoom (Group 2) -> Vertical stack */
.controls-nav .control-group:last-child {
    flex-direction: column;
}

/* Custom Dropdowns */
.custom-dropdown {
    position: relative;
    width: 200px;
    /* Or auto/min-width */
    font-family: inherit;
}

.dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 253, 245, 0.9);
    /* Warm glass */
    backdrop-filter: blur(10px);
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(60, 50, 40, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
    user-select: none;
}

.dropdown-trigger:hover {
    background: #fff;
    box-shadow: 0 8px 20px rgba(60, 50, 40, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

body.dark .dropdown-trigger {
    background: rgba(45, 40, 38, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.dropdown-trigger i {
    color: var(--main-color);
    margin-left: 10px;
    transition: transform 0.2s;
    font-size: 12px;
}

.custom-dropdown.active .dropdown-trigger i {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 8px;
    z-index: 200;
    max-height: 250px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.custom-dropdown.active .dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.option-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-item:hover {
    background: #f4fce8;
    color: var(--main-color);
}

.option-item.selected {
    background: #e4e4c0;
    color: var(--main-color);
    font-weight: 600;
}

/* Scrollbar for dropdown */
.dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-options::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* Old Input style kept for search input if needed, or remove if unused here */
/* .filter-container input: handled below */

.filter-container select:hover,
.filter-container input:hover,
.filter-container input:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    /* Softer corners */
    background: transparent;
    box-shadow: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    /* Slightly larger icon */
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--main-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark .btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Separators inside the group? Optional. */
/* Just spacing gap handled by flex gap */

/* Elegant Minimalist Modal Design */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-backdrop);
    /* Very light overlay */
    backdrop-filter: blur(12px);
    /* Stronger blur for "Glass" effect */
    animation: fadeIn 0.3s;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10vh auto;
    padding: 40px;
    /* More padding for airy feel */
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Very subtle border */
    width: 90%;
    max-width: 500px;
    /* Wider for 2-column grid */
    border-radius: 20px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.1), 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: visible;
    /* Allow avatar to pop out if needed, but here we keep inside */
    position: relative;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button - Minimalist */
.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eee;
}

.close-modal:hover {
    background: var(--main-color);
    color: #fff;
    transform: rotate(90deg);
}

/* Minimalist Header (No block background) */
.profile-header {
    height: 80px;
    /* Just space for avatar top */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: transparent;
    margin-bottom: 50px;
    /* Push body down to make room for Avatar */
}

/* Avatar - Clean & Elegant */
.profile-avatar-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
}

.profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 15px;
    object-fit: cover;
    display: block;
    border: 3px solid var(--accent-color);
    box-sizing: border-box;
    /* Ensure border is included in size */
    overflow: hidden;
    /* strict clipping */
    /* Elegant Gold Ring */
}

/* Body Content */
.profile-body {
    padding: 0;
    text-align: center;
}

.profile-body h2 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: var(--main-color);
    /* Dark Teal Name */
    /* Serif for elegance if available, else standard */
    letter-spacing: -0.5px;
}

/* Grid Layout - 2 Columns */
.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 Columns */
    gap: 15px;
    margin-top: 30px;
    text-align: left;
}

/* Full width items in grid */
.profile-info-row.full-width,
.profile-info-row:nth-last-child(1):nth-child(odd) {
    /* If odd last item, span full */
    grid-column: span 2;
}

.profile-info-row {
    background: var(--secondary-color);
    /* Very light cream/gold tint */
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(188, 184, 138, 0.2);
    /* Subtle Gold Border */
    display: flex;
    flex-direction: column;
    /* Stack Label/Value inside the box */
    gap: 4px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-info-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background: var(--card-bg);
    border-color: var(--accent-color);
}

.label {
    color: var(--text-secondary);
    /* Gold/Brown */
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    flex-shrink: 0;
    /* Keep label stable */
    margin-right: 15px;
    max-width: 40%;
    /* Prevent label expansion */
    padding-top: 4px;
    /* Align with text */
}

.value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    /* Allow wrapping */
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    /* Flex layout */
    display: flex;
    flex: 1;
    /* Take remaining space */
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right;
    gap: 4px;
}

/* Links inside values */
.value .profile-link {
    color: var(--main-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--main-color);
    cursor: pointer;
    transition: all 0.2s;
}

.value .profile-link:hover {
    background: rgba(4, 65, 94, 0.05);
    border-bottom-style: solid;
}

.value button {
    opacity: 0.5;
    transition: opacity 0.2s;
    margin-left: auto;
    /* Push copy button to edge */
}

.value button:hover {
    opacity: 1;
}


/* --- Hierarchical Mode (Vertical List) --- */

.tree-container.hierarchical-mode {
    overflow: auto;
    cursor: default;
    /* No pan needed usually, but keeping it is fine */
}

/* Main List */
.tree-container.hierarchical-mode ul.tree {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    width: auto;
}

/* Nested Lists */
.tree-container.hierarchical-mode ul.tree ul {
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-left: 40px;
    /* Indentation depth */
    position: relative;
    /* Remove default connector space */
    margin-top: 5px;
}

/* List Items */
.tree-container.hierarchical-mode ul.tree li {
    float: none;
    display: flex;
    flex-direction: column;
    /* Stack Card + Children vertically */
    align-items: flex-start;
    padding: 5px 0;
    text-align: left;
    position: relative;
}

/* Disable existing connectors */
.tree-container.hierarchical-mode ul.tree li::before,
.tree-container.hierarchical-mode ul.tree li::after,
.tree-container.hierarchical-mode ul.tree ul::before {
    display: none;
}

/* Custom Guide Lines for Hierarchical View */
/* 1. Vertical line for children list */
.tree-container.hierarchical-mode ul.tree ul {
    border-left: 2px solid #ddd;
    margin-left: 10px;
    /* Offset the border from the parent's alignment */
}

/* 2. Optional: Horizontal dash to child items? */
/* Can add if requested, but folder structure usually implies it by indent. */

/* Adjust Card Container */
.tree-container.hierarchical-mode .couple-container {
    margin: 0;
    padding: 10px 16px;
    /* Increased padding */
    border-radius: 12px;
}

/* Larger member images in hierarchical view */
.tree-container.hierarchical-mode .member-card .member-imgs {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    border-radius: 10px;

}

/* Larger text in hierarchical view */
.tree-container.hierarchical-mode .member-names h4 {
    font-size: 15px;
}

/* Override transform for pan/zoom if needed? 
   Actually pan/zoom might still be useful if the list is huge. 
   But usually vertical scroll is native. 
   We will keep zoom/pan active as it's on the container. */

/* View Profile Button */
.btn-view-profile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--main-color), #065b83);
    color: #fff;
    /* Always white on this gradient */
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(4, 65, 94, 0.3);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    gap: 8px;
}

.btn-view-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(4, 65, 94, 0.4);
    background: linear-gradient(135deg, #065b83, var(--main-color));
}

.btn-view-profile:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(4, 65, 94, 0.2);
}

.btn-view-profile i {
    font-size: 14px;
    transition: transform 0.3s;
}

.btn-view-profile:hover i {
    transform: translateX(4px);
}

/* View Profile Button */
.btn-view-profile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--main-color), #065b83);
    color: #fff;
    /* Always white on this gradient */
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(4, 65, 94, 0.3);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    gap: 8px;
}

.btn-view-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(4, 65, 94, 0.4);
    background: linear-gradient(135deg, #065b83, var(--main-color));
}

.btn-view-profile:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(4, 65, 94, 0.2);
}

.btn-view-profile i {
    font-size: 14px;
    transition: transform 0.3s;
}

.btn-view-profile:hover i {
    transform: translateX(4px);
}

/* Dark mode adjustment if needed, but the gradient stands out well on dark too */
body.dark .btn-view-profile {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* --- Full Page Member Profile Redesign (Clean Layout) --- */

.page-member-profile {
    background-color: var(--secondary-color);
    min-height: 100vh;
    padding-top: 100px;
    /* Clear fixed navbar */
    padding-bottom: 50px;
    overflow-y: auto !important;
    /* Override body overflow:hidden */
    height: auto !important;
    /* Unlock height */
}

.profile-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

/* Back Button - styled as a pill button */
.back-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    background: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.back-nav:hover {
    background: var(--main-color);
    color: #fff;
    transform: translateX(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Main Profile Header Card - Premium Design */
.main-profile-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.02);
    /* Multi-layer shadow */
    padding: 0 0 40px 0;
    /* Remove top padding, handled by banner */
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: none;
    position: relative;
    overflow: hidden;
}

/* Decorative Banner Top */
.main-profile-card::before {
    content: '';
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, var(--main-color), #096894, var(--accent-color));
    display: block;
    margin-bottom: -70px;
    /* Pull content up */
}

/* Wrapper for positioning icon outside clipped area */
.profile-image-wrapper {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    position: relative;
    z-index: 20;
    /* High z-index to ensure menu floats over member name */
}

/* Container for actual image - CLIPS content */
.profile-image-container {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Move Border Here */
    border: 5px solid #fff;
    box-sizing: border-box;
    /* Add a subtle outer glow/shadow to the container to lift it */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    /* CRITICAL: Clips image to border-radius */
    position: relative;
}

.profile-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Border handled by container */
}

.member-name {
    font-size: 2.4rem;
    color: var(--text-primary);
    margin: 0 0 5px 0;
    font-weight: 600;
    /* Slightly lighter for Poppins */
    letter-spacing: -0.5px;
    position: relative;
    z-index: 2;
    font-family: 'Poppins', sans-serif;
    /* Modern Font */
}

.family-name {
    font-size: 1.1rem;
    color: var(--main-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.gen-badge {
    background: linear-gradient(45deg, var(--main-color), #096894);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(4, 65, 94, 0.2);
    letter-spacing: 0.5px;
}

/* Info Grid Layout - Clean & Standardized */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
}

.info-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.03);
    height: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    /* For alignment */
    flex-direction: column;
}

.info-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border-color: rgba(188, 184, 138, 0.3);
    /* Accent border */
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header i {
    font-size: 1.1rem;
    color: var(--main-color);
    background: rgba(4, 65, 94, 0.08);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--main-color);
    font-weight: 600;
}

/* Data Rows */
.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.data-row:last-child {
    margin-bottom: 0;
}

.data-label {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    width: 40%;
}

.data-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    width: 60%;
}

.data-value a {
    color: var(--main-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--main-color);
    transition: all 0.2s;
}

.data-value a:hover {
    background: rgba(4, 65, 94, 0.08);
    /* Main color tint */
}

/* Dark Mode Overrides */
body.dark .page-member-profile {
    background-color: #1a1a15;
}

body.dark .back-nav {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.dark .back-nav:hover {
    background: var(--main-color);
    color: var(--text-on-main);
}

body.dark .main-profile-card,
body.dark .info-card {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .profile-image-container {
    background: var(--card-bg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.dark .card-header i {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.dark .data-value a {
    color: var(--text-on-main);
    border-color: var(--text-on-main);
}

body.dark .main-profile-card::before {
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    /* Deep Dark Teal Gradient */
}

/* --- New Dashboard Action Grid Template --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.action-card {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border-color: rgba(188, 184, 138, 0.3);
}

.action-icon-box {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(4, 65, 94, 0.05), rgba(4, 65, 94, 0.1));
    color: var(--main-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.action-card:hover .action-icon-box {
    background: var(--main-color);
    color: #fff;
    transform: scale(1.1) rotate(5deg);
}

.action-content {
    display: flex;
    flex-direction: column;
}

.action-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--main-color);
    margin-bottom: 5px;
    line-height: 1.2;
}

.action-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Dark Mode support for new elements */
body.dark .action-card {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .action-icon-box {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.dark .action-card:hover .action-icon-box {
    background: var(--main-color);
    color: var(--text-on-main);
}

/* --- Notification Panel Styles --- */
.notification-panel {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    /* Space before action grid */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    /* Slightly smaller than main headers */
    color: var(--main-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: rgba(188, 184, 138, 0.2);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    /* Scroll if too many */
}

.notification-item {
    display: flex;
    gap: 15px;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(4, 65, 94, 0.08);
    /* Light Main Color */
    color: var(--main-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.notif-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.notif-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 5px 0;
    line-height: 1.4;
}

.notif-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.8;
}

/* Dark Mode Support */
body.dark .notification-panel {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .panel-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark .panel-header h3 {
    color: var(--text-primary);
}

body.dark .notification-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.dark .notif-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

body.dark .notif-text {
    color: var(--text-on-main);
}

body.dark .notif-date {
    color: var(--text-secondary);
}

/* --- Tree Viewport & Controls --- */
.tree-viewport {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    /* Full height minus navbar */
    overflow: hidden;
    background: var(--bg-color);
    cursor: grab;
}

.tree-controls {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.tree-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tree-controls button:hover {
    background: var(--main-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(184, 134, 11, 0.3);
}

body.dark .tree-controls button {
    background: #2d2d2d;
    color: #f0f0f0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

body.dark .tree-controls button:hover {
    background: var(--main-color);
    color: #fff;
}

/* Active state for toggleable buttons (e.g., Full Ancestry) */
.tree-controls button.active {
    background: var(--main-color);
    color: var(--text-on-main);
    box-shadow: 0 4px 15px rgba(4, 65, 94, 0.4);
    transform: translateY(-2px);
}

body.dark .tree-controls button.active {
    box-shadow: 0 4px 15px rgba(255, 255, 227, 0.3);
    transform: rotate(180deg);
}

/* Tree Container Base */
.tree-container {
    transform-origin: 0 0;
    position: absolute;
    top: 0;
    left: 0;
}


/* Floating Back Button */
/* Floating Back Button - Styled like .back-nav */
.tree-back-btn {
    position: absolute;
    top: 6rem;
    left: 20px;
    z-index: 100;

    /* Visuals from .back-nav */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    background: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.tree-back-btn:hover {
    background: var(--main-color);
    color: #fff;
    transform: translateX(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.tree-back-btn i {
    color: inherit;
    /* Allow color change on hover */
    transition: transform 0.3s ease;
}

body.dark .tree-back-btn {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark .tree-back-btn:hover {
    background: var(--main-color);
    color: var(--text-on-main);
}

/* --- Modern Form Styles for Modals --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fdfdfd;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--main-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(4, 65, 94, 0.1);
    outline: none;
}

.form-group textarea {
    min-height: 80px;
}

/* Save Button */
.btn-save {
    background: linear-gradient(135deg, var(--main-color), #096894);
    color: #fff;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(4, 65, 94, 0.2);
    width: 100%;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(4, 65, 94, 0.3);
    background: linear-gradient(135deg, #096894, var(--main-color));
}

.btn-save:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(4, 65, 94, 0.1);
}

/* Success/Error Messages */
.success-message {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid rgba(46, 204, 113, 0.2);
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

.error-message {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid rgba(231, 76, 60, 0.2);
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

/* Floating Action Button */
.edit-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 5px 20px rgba(4, 65, 94, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
    border: none;
}

.edit-fab:hover {
    transform: scale(1.1);
    background: var(--accent-color);
}

/* Profile Actions Wrapper */
.profile-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.edit-btn-card {
    background: var(--main-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 0;
    /* Handled by wrapper */
}

.edit-btn-card:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.view-tree-btn {
    background: #fff;
    color: var(--main-color);
    border: 2px solid var(--main-color);
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.view-tree-btn:hover {
    background: var(--main-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Overrides */
body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

body.dark .form-group input:focus,
body.dark .form-group select:focus,
body.dark .form-group textarea:focus {
    border-color: var(--main-color);
    background: rgba(0, 0, 0, 0.2);
}

/* --- Custom Dropdowns (Like Add Member) --- */
.input-sec {
    position: relative;
    width: 100%;
    margin-bottom: 2px;
}

.input-sec .down-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--main-color);
    font-size: 0.9rem;
}

.input-sec ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 0;
    margin: 5px 0 0 0;
    list-style: none;
    z-index: 100;
}

.input-sec ul li {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.1s;
}

.input-sec ul li:last-child {
    border-bottom: none;
}

.input-sec ul li:hover {
    background: var(--primary-color);
    color: var(--main-color);
}

.pointer-cursor {
    cursor: pointer;
}

/* Dark mode for dropdowns */
body.dark .input-sec ul {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .input-sec ul li {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .input-sec ul li:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Profile Image Edit Overlay --- */
.profile-image-container {
    position: relative;
    display: inline-block;
}

.edit-icon-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #fff;
    color: var(--main-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    border: 2px solid var(--main-color);
    z-index: 10;
    font-size: 1.2rem;
}

.edit-icon-overlay:hover {
    transform: scale(1.1);
    background: var(--main-color);
    color: #fff;
}

/* Image Options Menu */
.image-options-menu {
    display: none;
    position: absolute;
    bottom: -80px;
    /* Position below the icon */
    right: -20px;
    background: #fff;
    width: 180px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeInMenu 0.2s ease;
}

@keyframes fadeInMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--primary-color);
    color: var(--main-color);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* View Image Modal (Enhanced) */
.modal.from-gallery {
    background: rgba(0, 0, 0, 0.85);
    /* Dark semi-transparent bg */
    backdrop-filter: blur(15px);
    /* Glass blur effect */
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content-img {
    max-width: 85%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    transform: scale(1);
    animation: zoomInImage 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomInImage {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.caption {
    margin-top: 20px;
    text-align: center;
    color: #fff;
    animation: slideUpCaption 0.4s ease-out 0.1s backwards;
}

@keyframes slideUpCaption {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.caption h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.caption p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.close-view-modal {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10002;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-view-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Dark Mode */
body.dark .image-options-menu {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .menu-item {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark .menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Crop Modal Image Container */
.img-container img {
    display: block;
    max-width: 100%;
}

/* Edit Button on Member Card details */
.card-edit-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: all 0.2s;
    z-index: 5;
    font-size: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-edit-btn:hover {
    background: var(--main-color);
    color: var(--text-on-main);
    transform: scale(1.1);
}

/* Show edit button on hover of the specific card (member or spouse section) */
.member-card:hover .card-edit-btn {
    opacity: 1;
}

/* Adjust if spouse card */
.spouse-card .card-edit-btn {
    right: 5px;
}

/* --- Premium Tree Loader Animation --- */
#tree-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(252, 251, 249, 0.9);
    /* Warm background */
    backdrop-filter: blur(10px);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#tree-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(188, 184, 138, 0.2);
    /* Accent color transparent */
    border-top: 4px solid var(--main-color);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loader-icon {
    font-size: 40px;
    color: var(--text-secondary);
    /* Gold/Brown */
    animation: pulse 2s ease-in-out infinite;
}

.loader-text {
    margin-top: 20px;
    font-family: 'Poppins', sans-serif;
    color: var(--main-color);
    font-weight: 500;
    letter-spacing: 1px;
    font-size: 14px;
    animation: fadeInUp 0.5s ease-out 0.2s backwards;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* --- Updates & Notification Grid --- */
.updates-grid {
    display: flex;
    gap: 30px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    .updates-grid {
        flex-direction: column;
        gap: 20px;
    }
}

.notification-panel {
    flex: 1;
    min-width: 0;
    /* Fix flex overflow */
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.7;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Message Styles */
.message-item {
    align-items: flex-start;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.msg-author {
    margin: 0 0 2px 0;
    font-size: 0.95rem;
    color: var(--main-color);
    font-weight: 600;
}

/* Tiny Action Button */
.action-btn-small {
    background: rgba(4, 65, 94, 0.1);
    color: var(--main-color);
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn-small:hover {
    background: var(--main-color);
    color: #fff;
}

body.dark .action-btn-small {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

body.dark .action-btn-small:hover {
    background: var(--main-color);
    color: var(--text-on-main);
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dim backdrop */
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    background: #f9f9f9;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--main-color);
    font-size: 1.2rem;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 25px;
}

#msgText {
    width: 100%;
    height: 120px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-family: inherit;
    resize: none;
    margin-bottom: 20px;
    background: #fcfbf9;
}

#msgText:focus {
    outline: none;
    border-color: var(--main-color);
    background: #fff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    background: var(--main-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--accent-color);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark .modal-card {
    background: var(--card-bg);
}

body.dark .modal-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark .modal-header h3 {
    color: var(--text-primary);
}

body.dark #msgText {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}


/* Message Avatar */
.msg-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 40px;
}

.action-card {
    background: var(--card-bg);
    padding: 20px 15px;
    /* Reduced padding */
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: row;
    /* Horizontal layout for compactness */
    align-items: center;
    justify-content: flex-start;
    /* Align left */
    gap: 15px;
    /* Space between icon and text */
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    text-align: left;
    /* Align text left */
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    /* Vertical stripe on left instead of top */
    height: 100%;
    background: linear-gradient(180deg, var(--main-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(var(--main-color-rgb), 0.1);
}

.action-card:hover::before {
    opacity: 1;
}

.action-icon-box {
    width: 50px;
    /* Reduced from 65px */
    height: 50px;
    /* Reduced from 65px */
    background: rgba(var(--main-color-rgb), 0.05);
    border-radius: 12px;
    /* Slightly smaller radius */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    /* No bottom margin needed for row layout */
    color: var(--main-color);
    font-size: 1.4rem;
    /* Reduced font size */
    transition: all 0.4s ease;
    box-shadow: inset 0 0 0 1px rgba(var(--main-color-rgb), 0.1);
    flex-shrink: 0;
    /* Prevent icon shrinking */
}

.action-card:hover .action-icon-box {
    background: var(--main-color);
    color: #fff;
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 5px 15px rgba(var(--main-color-rgb), 0.3);
    border-radius: 50%;
}

.action-card h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    /* Slightly smaller */
    font-weight: 700;
    color: var(--main-color);
}

.action-card p {
    margin: 0;
    font-size: 0.8rem;
    /* Smaller desc */
    color: var(--text-secondary);
    line-height: 1.3;
    opacity: 0.8;
}