/* Custom CSS for Services Section Modification */

.features-item {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    /* Create a new stacking context */
    border: none !important;
    /* Remove default border if any */
}

.features-item-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.7;
    /* Default opacity as requested */
    z-index: -2;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* Hover effect for background image */
.features-item:hover .features-item-bg {
    transform: scale(1.1);
    opacity: 0.8;
}

.features-item-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    /* Gradient height */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: -1;
    transition: opacity 0.3s ease;
}

/* Light mode adjustments */
html:not(.dark) .features-item-gradient {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 100%);
}

.features-item .title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    margin: 0;
    z-index: 1;
    color: white;
    /* Default text color for dark mode/dark gradient */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Light mode text color */
html:not(.dark) .features-item .title {
    color: #1a1a1a;
    /* Dark text for light mode */
    text-shadow: none;
}

/* Remove the icon box styles if they interfere, though we are removing the HTML element */

/* Fix scroll position for anchor links with fixed header */
:target {
    scroll-margin-top: 150px;
}

/* Ensure sidebar links don't get covered */
.uc-sidebar {
    z-index: 10;
}

/* Mobile Navigation Select - Glassmorphism Edition */
.mobile-nav-select-wrapper {
    display: block;
    position: sticky;
    top: 80px;
    z-index: 998;
    margin-bottom: 1rem;
    padding: 0;
}

/* Light Mode - Glassmorphism */
.mobile-nav-select {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(23, 141, 114, 0.3);
    border-radius: 1rem;
    color: #178d72;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16'%3E%3Cpath fill='%23178d72' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(23, 141, 114, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mobile-nav-select:hover {
    background-color: rgba(255, 255, 255, 0.85);
    border-color: rgba(23, 141, 114, 0.5);
    box-shadow: 0 6px 16px rgba(23, 141, 114, 0.12), 0 3px 6px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.mobile-nav-select:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.9);
    border-color: #178d72;
    box-shadow: 0 0 0 3px rgba(23, 141, 114, 0.15), 0 8px 20px rgba(23, 141, 114, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Dark Mode - Glassmorphism */
html.uc-dark .mobile-nav-select {
    background-color: rgba(31, 41, 55, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16'%3E%3Cpath fill='%2334d399' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 20px rgba(16, 185, 129, 0.05);
}

html.uc-dark .mobile-nav-select:hover {
    background-color: rgba(31, 41, 55, 0.85);
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 30px rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

html.uc-dark .mobile-nav-select:focus {
    background-color: rgba(31, 41, 55, 0.95);
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2), 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(16, 185, 129, 0.15);
}

.mobile-nav-select option {
    background-color: #ffffff;
    color: #1f2937;
    padding: 0.5rem;
}

html.uc-dark .mobile-nav-select option {
    background-color: #1f2937;
    color: #e5e7eb;
}

@media (min-width: 768px) {
    .mobile-nav-select-wrapper {
        display: none;
    }
}

@media (max-width: 767px) {

    /* Hide sidebar on mobile */
    .uc-sidebar {
        display: none !important;
    }

    /* Fixed Mobile Navigation */
    .mobile-nav-select-wrapper {
        display: block;
        position: fixed;
        top: 80px;
        /* Adjust based on header height */
        left: 0;
        right: 0;
        width: 100%;
        z-index: 990;
        padding: 10px 16px;
        margin: 0;
        pointer-events: none;
        /* Allow clicks to pass through wrapper */
    }

    .mobile-nav-select {
        pointer-events: auto;
        /* Re-enable clicks on select */
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        background-color: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    html.uc-dark .mobile-nav-select {
        background-color: rgba(31, 41, 55, 0.9);
    }

    /* Add space for the fixed nav */
    .section-inner {
        padding-top: 60px;
    }
}

/* Page Navigation (Footer Next/Prev) */
.page-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

html.uc-dark .page-navigation {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    max-width: 45%;
}

.nav-btn.prev {
    align-items: flex-start;
    text-align: left;
}

.nav-btn.next {
    align-items: flex-end;
    text-align: right;
    margin-left: auto;
}

.nav-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

html.uc-dark .nav-label {
    color: #9ca3af;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #178d72;
    line-height: 1.3;
    transition: color 0.2s;
}

html.uc-dark .nav-title {
    color: #34d399;
}

.nav-btn:hover .nav-title {
    color: #0f5c4a;
}

html.uc-dark .nav-btn:hover .nav-title {
    color: #6ee7b7;
}

/* Services Page Enhancements */

/* Glassmorphism for Service Cards */
/* Glassmorphism for Service Cards */
/* Glassmorphism for Service Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.dark .glass-card {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Zoom Effect on Scroll */
.zoom-effect {
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    transform: scale(0.9);
    opacity: 0.8;
}

.zoom-effect.active {
    transform: scale(1.05);
    opacity: 1;
}


/* Mobile Layout Fixes */
@media (max-width: 991px) {
    .features-item .row {
        flex-direction: column;
    }

    .features-item .order-0 {
        order: 0 !important;
    }

    .features-item .order-1 {
        order: 1 !important;
    }

    .sticky-card {
        position: relative;
        /* Disable sticky on mobile if needed, or keep it */
        top: 0;
        margin-bottom: 2rem;
        height: auto !important;
        /* Ensure content isn't cut off */
        overflow: visible !important;
    }

    .features-item {
        height: 200px !important;
        min-height: 200px !important;
    }

    /* Force full width for columns on mobile/tablet */
    .features-item .col-12.sm\:col-5 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Donate Button in Service Cards */
.service-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Mashrab-e-Chisht Page Redesign Styles */

/* 1. Glassmorphism & Visual Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

html.uc-dark .glass-panel {
    background: rgba(30, 30, 35, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
    color: #e5e7eb !important;
    /* Force light text */
}

/* Ensure headings inside dark glass panels are white or very light */
html.uc-dark .glass-panel h1,
html.uc-dark .glass-panel h2,
html.uc-dark .glass-panel h3,
html.uc-dark .glass-panel h4,
html.uc-dark .glass-panel h5,
html.uc-dark .glass-panel h6 {
    color: #f3f4f6 !important;
}

html.uc-dark .glass-panel p,
html.uc-dark .glass-panel span {
    color: #d1d5db !important;
}

html.uc-dark .glass-panel .text-primary {
    color: #34d399 !important;
    /* Lighter primary for dark mode */
}

.frosted-bg {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
}

html.uc-dark .frosted-bg {
    background: rgba(17, 24, 39, 0.85);
}

.text-gradient-primary {
    background: linear-gradient(135deg, #178d72 0%, #0f5c4a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.uc-dark .text-gradient-primary {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-gold {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 2. Key Values Cards */
.value-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(23, 141, 114, 0.1);
}

html.uc-dark .value-card {
    border-color: rgba(255, 255, 255, 0.1);
}

.value-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(23, 141, 114, 0.15);
    border-color: rgba(23, 141, 114, 0.3);
}

html.uc-dark .value-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(52, 211, 153, 0.3);
}

/* 3. Vertical Timeline */
.timeline-wrapper {
    position: relative;
    padding: 3rem 0;
    /* Increased padding */
}

.timeline-line {
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent 0%, rgba(23, 141, 114, 0.3) 15%, rgba(23, 141, 114, 0.3) 85%, transparent 100%);
}

html.uc-dark .timeline-line {
    background: linear-gradient(to bottom, transparent 0%, rgba(52, 211, 153, 0.2) 15%, rgba(52, 211, 153, 0.2) 85%, transparent 100%);
}

@media (min-width: 992px) {
    .timeline-line {
        left: 50%;
        transform: translateX(-50%);
    }
}

.timeline-item {
    position: relative;
    margin-bottom: 4rem;
    /* Increased margin for better spacing */
}

.timeline-dot {
    position: absolute;
    left: 16px;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #178d72;
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px rgba(23, 141, 114, 0.2);
    z-index: 2;
}

html.uc-dark .timeline-dot {
    background: #34d399;
    border-color: #1f2937;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

@media (min-width: 992px) {
    .timeline-dot {
        left: 50%;
        transform: translateX(-50%);
    }
}

.timeline-content {
    margin-left: 60px;
    position: relative;
}

@media (min-width: 992px) {
    .timeline-item:nth-child(odd) .timeline-content {
        margin-left: 0;
        margin-right: 50%;
        padding-right: 60px;
        /* Increased padding */
        text-align: right;
    }

    .timeline-item:nth-child(even) .timeline-content {
        margin-left: 50%;
        padding-left: 60px;
        /* Increased padding */
        text-align: left;
    }

    .timeline-item:nth-child(odd) .timeline-content .card-wrapper {
        margin-left: auto;
    }
}

.timeline-year {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    background: rgba(23, 141, 114, 0.1);
    color: #178d72;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

html.uc-dark .timeline-year {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

/* 4. Modern Tree Visualization */
.tree-wrapper {
    position: relative;
    padding: 3rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    /* Increased gap */
}

.modern-node {
    position: relative;
    padding: 1.75rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 600px;
    /* Slightly wider */
    transition: all 0.3s ease;
    z-index: 2;
}

html.uc-dark .modern-node {
    background: #1f2937 !important;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    color: #e5e7eb !important;
}

/* Fix text colors inside modern-node for dark mode */
html.uc-dark .modern-node h3,
html.uc-dark .modern-node h4,
html.uc-dark .modern-node h5,
html.uc-dark .modern-node h6 {
    color: #f3f4f6 !important;
}

html.uc-dark .modern-node p,
html.uc-dark .modern-node div {
    color: #d1d5db;
    /* Light gray for non-heading text */
}

/* Keep primary text color active */
html.uc-dark .modern-node .text-primary {
    color: #34d399 !important;
}

.modern-node:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(23, 141, 114, 0.15);
    border-color: rgba(23, 141, 114, 0.3);
}

html.uc-dark .modern-node:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(52, 211, 153, 0.3);
}

.modern-node.root-node {
    background: linear-gradient(135deg, #178d72 0%, #0c4a3b 100%);
    color: white;
}

html.uc-dark .modern-node.root-node {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%) !important;
    color: #111827 !important;
}

html.uc-dark .modern-node.root-node * {
    color: #111827 !important;
    /* Force nearly black text on bright green background */
}

.modern-node.current-node {
    border: 2px solid #fbbf24;
    position: relative;
    overflow: hidden;
}

html.uc-dark .modern-node.current-node {
    border-color: #d97706;
}

.modern-node.current-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #fbbf24;
}

/* Tree Connectors */
.connector-line {
    width: 2px;
    height: 3rem;
    /* Longer connectors */
    background: #e5e7eb;
    position: relative;
}

html.uc-dark .connector-line {
    background: #4b5563;
}

.connector-line.active {
    background: #178d72;
}

html.uc-dark .connector-line.active {
    background: #34d399;
}

/* Expanded details */
.node-expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.modern-node.active .node-expand-content {
    max-height: 300px;
    /* increased safety margin */
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

html.uc-dark .modern-node.active .node-expand-content {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Custodian Profile Enhancements */
.custodian-card {
    position: relative;
    overflow: hidden;
}

.custodian-bg-pattern {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

}

/* Mobile Optimizations for Mashrab-e-Chisht */
@media (max-width: 767px) {

    /* Reduce container padding and gaps */
    .section.panel {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .timeline-wrapper,
    .tree-wrapper {
        padding: 1rem 0 !important;
        gap: 1.5rem !important;
    }

    /* Timeline Compact View */
    .timeline-item {
        margin-bottom: 2.5rem !important;
    }

    .timeline-line {
        left: 20px !important;
    }

    .timeline-dot {
        left: 12px !important;
    }

    .timeline-content {
        margin-left: 44px !important;
        padding-right: 0 !important;
    }

    .timeline-content .card-wrapper {
        padding: 1.25rem !important;
    }

    /* Tree Compact View */
    .modern-node {
        padding: 1.25rem !important;
        max-width: 100% !important;
    }

    .connector-line {
        height: 1.5rem !important;
    }

    /* Prevent Horizontal Overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .col-12 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Rendering Performance / Glitch Prevention */
    .glass-panel,
    .glass-card,
    .mobile-nav-select {
        backdrop-filter: none !important;
        /* Disable on mobile if causing glitches */
        -webkit-backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.95) !important;
        /* Solid fallback */
    }

    html.uc-dark .glass-panel,
    html.uc-dark .glass-card,
    html.uc-dark .mobile-nav-select {
        background: rgba(31, 41, 55, 0.95) !important;
    }

    .custodian-card .custodian-bg-pattern {
        opacity: 0.15 !important;
        /* Boost visibility since gradient might be subtle */
    }
}