:root {
    /* Light Theme Variables */
    --bg-overlay: rgba(255, 250, 245, 0.30);
    --text-primary: #2d3748;
    --text-muted: #6c757d;
    --card-bg: rgba(255, 255, 255, 0.33);
    --card-border: rgba(203, 213, 224, 0.33);
    --input-bg: rgba(255, 255, 255, 0.9);
    --content-bg: rgba(255, 255, 255, 0.47);

    /* Nav Buttons - Light */
    --nav-btn-bg-start: #f0f4f8;
    --nav-btn-bg-end: #e1e8ed;
    --nav-btn-border: #cbd5e0;
    --nav-btn-text: #2d3748;
    --nav-btn-hover-start: #e3edf7;
    --nav-btn-hover-end: #d4dde6;
    --nav-btn-hover-border: #4a90e2;
    --nav-btn-active-start: rgba(74, 144, 226, 0.6);
    --nav-btn-active-end: rgba(53, 122, 189, 0.6);

    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --text-primary: #e2e8f0;
    --text-muted: #a0aec0;
    --card-bg: rgba(30, 41, 59, 0.8);
    --card-border: rgba(71, 85, 105, 0.5);
    --input-bg: rgba(0, 0, 0, 0.25);
    --content-bg: rgba(15, 23, 42, 0.8);

    /* Nav Buttons - Dark */
    --nav-btn-bg-start: #2d3748;
    --nav-btn-bg-end: #1a202c;
    --nav-btn-border: #4a5568;
    --nav-btn-text: #e2e8f0;
    --nav-btn-hover-start: #4a5568;
    --nav-btn-hover-end: #2d3748;
    --nav-btn-hover-border: #63b3ed;
    --nav-btn-active-start: rgba(66, 153, 225, 0.5);
    --nav-btn-active-end: rgba(49, 130, 206, 0.5);

    --shadow-color: rgba(0, 0, 0, 0.4);
}

body {
    /* Light wood texture with cream overlay - Heritage meets modern */
    background-image:
        linear-gradient(to bottom, var(--bg-overlay), var(--bg-overlay)),
        url(../images/wood.jpg);
    background-repeat: repeat;
    background-attachment: scroll;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: color 0.3s ease, background-image 0.3s ease;
}

/* Ensure links have no default decoration */
a {
    text-decoration: none !important;
}

a:hover,
a:focus,
a:active,
a:visited {
    text-decoration: none !important;
}

.btn {
    text-decoration: none !important;
}

.btn:hover,
.btn:focus,
.btn:active {
    text-decoration: none !important;
}

/* Icon spacing in buttons and nav elements */
.btn i,
.nav-btn i {
    margin-left: 5px;
    vertical-align: middle;
}

.btn i.bi,
.nav-btn i.bi {
    font-size: 1em;
    line-height: 1;
}

/* Force no text decoration on share buttons and all link containers */
.share-section a,
.share-btn,
.info-box a,
.inner-card a,
.welcome-card a,
.text-decoration-none {
    text-decoration: none !important;
}

/* Remove underline from all anchor elements in all contexts */
* a,
div a,
span a,
small a {
    text-decoration: none !important;
}


/* Header sections */
.header-section {
    background: transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card styling for consistent look */
.card {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    color: var(--text-primary);
}

.form-control {
    background-color: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.form-control:focus {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
}

/* Override text-muted to follow theme variables */
.text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* Ensure text-primary is readable in dark mode (lighter blue) */
[data-theme="dark"] .text-primary {
    color: #90cdf4 !important;
}

/* Content areas */
.content-area {
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 20px;
}

/* ===================================
   PROFILE AVATARS
   =================================== */

/* ===================================
   PROFILE AVATARS
   =================================== */

.person-avatar,
.thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 3px solid #b3d7ff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

.person-avatar:hover,
.thumbnail:hover {
    opacity: 0.9;
}

/* ===================================
   BADGES & STATISTICS
   =================================== */

.stat-badge {
    background-color: rgba(255, 255, 255, 0.5);
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
    margin: 0 3px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(203, 213, 224, 0.4);
}

/* ===================================
   NAVIGATION BUTTONS
   =================================== */

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 15px;
    max-width: 100%;
}

.nav-row-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 5px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--nav-btn-bg-start) 0%, var(--nav-btn-bg-end) 100%);
    border: 2px solid var(--nav-btn-border);
    text-decoration: none;
    color: var(--nav-btn-text);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 50px;
    line-height: 1.3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover {
    background: linear-gradient(135deg, var(--nav-btn-hover-start) 0%, var(--nav-btn-hover-end) 100%);
    border-color: var(--nav-btn-hover-border);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-color);
    text-decoration: none;
    color: var(--text-primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--nav-btn-active-start) 0%, var(--nav-btn-active-end) 100%);
    border: 2px solid rgba(44, 90, 160, 0.8);
    color: #1a202c;
    /* Keep dark text for contrast on blue active state, or adjust if needed */
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(74, 144, 226, 0.4);
}

.nav-btn.inactive {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(200, 200, 200, 0.2);
    border-color: rgba(150, 150, 150, 0.3);
}

.nav-btn.inactive:hover {
    transform: none;
    background: rgba(200, 200, 200, 0.2);
    border-color: rgba(150, 150, 150, 0.3);
}

/* Navigation Group Theming - Very Subtle Visual Distinction */
.nav-btn.nav-group-1 {
    background: linear-gradient(135deg, var(--nav-btn-bg-start) 0%, var(--nav-btn-bg-end) 100%) !important;
    border-color: var(--nav-btn-border) !important;
}

.nav-btn.nav-group-1:hover,
.nav-btn.nav-group-1.active {
    background: linear-gradient(135deg, var(--nav-btn-hover-start) 0%, var(--nav-btn-hover-end) 100%) !important;
    border-color: var(--nav-btn-hover-border) !important;
}

.nav-btn.nav-group-2 {
    background: linear-gradient(135deg, var(--nav-btn-bg-start) 0%, var(--nav-btn-bg-end) 100%) !important;
    border-color: var(--nav-btn-border) !important;
}

.nav-btn.nav-group-2:hover,
.nav-btn.nav-group-2.active {
    background: linear-gradient(135deg, var(--nav-btn-hover-start) 0%, var(--nav-btn-hover-end) 100%) !important;
    border-color: var(--nav-btn-hover-border) !important;
}

.nav-btn.nav-group-3 {
    background: linear-gradient(135deg, var(--nav-btn-bg-start) 0%, var(--nav-btn-bg-end) 100%) !important;
    border-color: var(--nav-btn-border) !important;
}

.nav-btn.nav-group-3:hover,
.nav-btn.nav-group-3.active {
    background: linear-gradient(135deg, var(--nav-btn-hover-start) 0%, var(--nav-btn-hover-end) 100%) !important;
    border-color: var(--nav-btn-hover-border) !important;
}

/* ===================================
   NASAB PAGE STYLES
   =================================== */

.transparent-card {
    background-color: rgba(255, 255, 255, 0.33);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-section {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1), rgba(108, 117, 125, 0.1));
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

.profile-image {
    border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

.person-name-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 1rem 0;
}

.lineage-section {
    background-color: rgba(255, 255, 255, 0.27);
    border: 2px solid rgba(13, 110, 253, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.lineage-text {
    font-size: 1.1rem;
    line-height: 2;
    color: #2c3e50;
}

.lineage-text a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lineage-text a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.lineage-count {
    display: inline-block;
    background-color: rgba(13, 110, 253, 0.15);
    border: 1px solid rgba(13, 110, 253, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    color: #0d6efd;
}

.alert-warning-custom {
    background-color: rgba(220, 53, 69, 0.1);
    border: 2px dashed rgba(220, 53, 69, 0.5);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #dc3545;
}

.share-section {
    background-color: rgba(108, 117, 125, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    text-align: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    margin: 0.25rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.copy-btn {
    background-color: rgba(13, 110, 253, 0.15);
    color: #0d6efd;
    border: 1px solid rgba(13, 110, 253, 0.3);
}

.whatsapp-btn {
    background-color: rgba(37, 211, 102, 0.15);
    color: #25d366;
    border: 1px solid rgba(37, 211, 102, 0.3);
}

.rahima-badge {
    display: inline-block;
    margin: 0.5rem 0;
}

/* ===================================
   COMMENTS PAGE STYLES
   =================================== */

.form-label {
    font-weight: 600;
}

.required {
    color: red;
}

/* ===================================
   RESPONSIVE NAVIGATION
   =================================== */

@media (max-width: 768px) {
    .nav-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 10px;
    }

    .nav-btn {
        padding: 12px 8px;
        font-size: 16px;
        min-height: 45px;
    }
}

@media (max-width: 480px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-btn {
        padding: 10px 6px;
        font-size: 15px;
        min-height: 42px;
    }
}

/* ===================================
   COLORIZED ICONS - SITE-WIDE
   =================================== */

/* Helper/Info Icons - Cyan/Blue tones */
.bi-question-circle-fill,
.bi-question-circle {
    color: #17a2b8 !important;
}

.bi-info-circle-fill,
.bi-info-circle {
    color: #0dcaf0 !important;
}

.bi-eye-fill,
.bi-eye {
    color: #0d6efd !important;
}

.bi-search {
    color: #0d6efd !important;
}

/* Success/Confirm Icons - Green tones */
.bi-check-circle-fill,
.bi-check-circle {
    color: #198754 !important;
}

.bi-save-fill,
.bi-save {
    color: #198754 !important;
}

.bi-person-plus-fill,
.bi-person-plus {
    color: #198754 !important;
}

.bi-download {
    color: #198754 !important;
}

.bi-cash-stack {
    color: #198754 !important;
}

.bi-cloud-upload-fill,
.bi-cloud-upload {
    color: #0d6efd !important;
}

/* Danger/Delete Icons - Red tones */
.bi-trash-fill,
.bi-trash {
    color: #dc3545 !important;
}

.bi-x-circle-fill,
.bi-x-circle {
    color: #dc3545 !important;
}

.bi-person-x-fill,
.bi-person-x {
    color: #dc3545 !important;
}

.bi-person-dash-fill,
.bi-person-dash {
    color: #dc3545 !important;
}

.bi-box-arrow-right {
    color: #dc3545 !important;
}

/* Edit/Update Icons - Cyan tones */
.bi-pencil-square {
    color: #0dcaf0 !important;
}

.bi-image-fill,
.bi-image {
    color: #0dcaf0 !important;
}

/* Navigation Icons - Blue tones */
.bi-arrow-right {
    color: #0d6efd !important;
}

.bi-arrow-left {
    color: #0d6efd !important;
}

.bi-display-fill,
.bi-display {
    color: #0d6efd !important;
}

.bi-journal-text {
    color: #0d6efd !important;
}

.bi-people-fill,
.bi-people {
    color: #0d6efd !important;
}

.bi-house-door-fill,
.bi-house-door {
    color: #0d6efd !important;
}

.bi-person-circle {
    color: #0d6efd !important;
}

.bi-gear-fill,
.bi-gear {
    color: #6c757d !important;
}

/* Special/Feature Icons - Purple/Orange tones */
.bi-diagram-3-fill,
.bi-diagram-3 {
    color: #6f42c1 !important;
}

.bi-list-task {
    color: #6f42c1 !important;
}

.bi-bar-chart-fill,
.bi-bar-chart {
    color: #6f42c1 !important;
}

.bi-person-lines-fill {
    color: #6f42c1 !important;
}

.bi-sliders {
    color: #fd7e14 !important;
}

.bi-link-45deg {
    color: #fd7e14 !important;
}

.bi-activity {
    color: #fd7e14 !important;
}

/* Social Media Icons */
.bi-youtube {
    color: #ff0000 !important;
}

.bi-whatsapp {
    color: #25d366 !important;
}

.bi-facebook {
    color: #1877f2 !important;
}

.bi-twitter {
    color: #1da1f2 !important;
}

.bi-instagram {
    color: #e4405f !important;
}

/* Other Common Icons */
.bi-heart-fill,
.bi-heart {
    color: #dc3545 !important;
}

.bi-star-fill,
.bi-star {
    color: #ffc107 !important;
}

.bi-upload {
    color: #0d6efd !important;
}

/* ===================================
   FAMILY TREE SEARCH FUNCTIONALITY
   =================================== */

.highlight {
    background-color: yellow;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
}

.hidden {
    display: none !important;
}

.search-section-demo {
    padding-bottom: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(13, 110, 253, 0.1);
}

.search-input {
    border: 2px solid rgba(13, 110, 253, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.btn-clear-search {
    background-color: transparent;
    border: 2px solid #dc3545;
    color: #dc3545;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-clear-search:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* ===================================
   ADMIN HEADER BUTTONS DARK MODE
   =================================== */
/* ===================================
   ADMIN HEADER BUTTONS DARK MODE
   =================================== */
[data-theme="dark"] .card .btn-outline-info {
    background-color: transparent !important;
    border-color: rgba(13, 202, 240, 0.8) !important;
    /* Visible cyan border */
    color: #0dcaf0 !important;
}

[data-theme="dark"] .card .btn-outline-secondary {
    background-color: transparent !important;
    border-color: rgba(173, 181, 189, 0.8) !important;
    /* Visible gray border */
    color: #adb5bd !important;
}

[data-theme="dark"] .card .btn-outline-danger {
    background-color: transparent !important;
    border-color: rgba(220, 53, 69, 0.8) !important;
    /* Visible red border */
    color: #dc3545 !important;
}

[data-theme="dark"] .card .btn-outline-info:hover,
[data-theme="dark"] .card .btn-outline-secondary:hover,
[data-theme="dark"] .card .btn-outline-danger:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    /* Subtle hover background */
    border-color: rgba(255, 255, 255, 0.9) !important;
    /* Stronger border on hover */
}

/* ===================================
   CALLIGRAPHY DARK MODE IMAGES
   =================================== */
[data-theme="dark"] .rahimallah-m {
    content: url('../images/rahimallah_m_dark.png');
}

[data-theme="dark"] .rahimallah-f {
    content: url('../images/rahimallah_f_dark.png');
}

[data-theme="dark"] .rahimallah-a {
    content: url('../images/rahimallah_a_dark.png');
}