:root {
    /* Light mode variables */
    --primary-color: #4a90e2;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --input-bg: #ffffff;
    
    /* Dark mode variables */
    --dark-primary-color: #ffffff;
    --dark-danger-color: #ff6b6b;
    --dark-text-color: #e0e0e0;
    --dark-bg-color: #1a1a1a;
    --dark-card-bg: #2d2d2d;
    --dark-border-color: #404040;
    --dark-input-bg: #333333;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: var(--dark-bg-color);
    color: var(--dark-text-color);
}

/* Flash messages */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.flash-message {
    padding: 10px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: white;
    animation: slideIn 0.3s ease-out;
}

.flash-message.success {
    background-color: #2ecc71;
}

.flash-message.error {
    background-color: #e74c3c;
}

.flash-message.info {
    background-color: #0066cc;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}



/* =============================================
   ISOLATED NAVIGATION SYSTEM - OVERRIDE ALL PAGE CONFLICTS
   ============================================= */

/* Header - Highest Priority */
header {
    background-color: #0066cc !important;
    color: rgb(165, 29, 29) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    z-index: 999 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Mobile-only top header */
.top-header.mobile-only {
    display: none !important; /* Hidden on desktop */
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 10px 15px !important;
    background: inherit !important;
    border: none !important;
    margin: 0 !important;
}

/* Desktop navigation - single line layout */
.desktop-nav {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 10px 20px !important;
    position: relative !important;
    background: inherit !important;
    border: none !important;
    margin: 0 !important;
}

/* Desktop logo (left) */
.desktop-logo {
    flex: 0 0 150px !important;
    margin-right: 20px !important;
    display: flex !important;
    align-items: center !important;
}

/* Desktop search bar (center) */
.desktop-search {
    flex: 1 !important;
    max-width: 700px !important;
    width: 80% !important;
    margin: 0 20px !important;
    margin-left: 200px !important;
    position: relative !important;
}

.desktop-search input {
    width: 90% !important;
    padding: 12px 20px !important;
    border: 2px solid #ddd !important;
    border-radius: 25px !important;
    font-size: 16px !important;
    outline: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
    background: white !important;
    color: #333 !important;
    box-sizing: border-box !important;
}

.desktop-search input:focus {
    border-color: #0066cc !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1) !important;
}

.desktop-search ul {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 15px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    margin-top: 5px !important;
    display: none !important; /* Hide by default */
    list-style: none !important;
    padding: 0 !important;
}

.desktop-search ul:not(:empty) {
    display: block !important; /* Only show when there are results */
}

/* Desktop header buttons (right) - STRONGEST OVERRIDE */
.header-buttons {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 12px !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    white-space: nowrap !important;
}

.header-buttons li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
}

.header-button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    color: rgb(255, 255, 255) !important;
    padding: 10px 15px !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: .9rem !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    justify-content: center !important;

    white-space: nowrap !important;
    position: relative !important;
    background: transparent !important;
    min-width: auto !important;
    max-width: none !important;
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
    font-weight: normal !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

.header-button:hover {
    background-color: #003366 !important;
    color: white !important;
    transform: none !important;
    box-shadow: none !important;
}

.header-button span {
    margin-top: 2px !important;
    color: inherit !important;
    font-weight: inherit !important;
    white-space: nowrap !important;

}

/* Makes emoji scalable */
.emoji {
    font-size: 1.5rem !important;
    line-height: 1 !important;
    display: inline-block !important;


    display: inline-block;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "NotoColorEmoji", "Segoe UI Symbol", "Android Emoji", sans-serif;
}



/* Align emoji and label vertically */
.vertical-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px; /* space between emoji and label */
    text-align: center;
}

.label-text {
    font-size: .9rem !important;/* Reset any absolute positioning */
}



/* NOTIFICATION BADGES - CRITICAL POSITIONING */
.header-button .green-dot,
.bottom-nav-button .green-dot {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    width: 8px !important;
    height: 8px !important;
    background-color: #28a745 !important;
    border-radius: 50% !important;
    z-index: 9 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    border: 1px solid white !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.header-button .notification-count,
.bottom-nav-button .notification-count {
    position: absolute !important;
    top: -22px !important;
    right: -28px !important;
    background-color: #dc3545 !important;
    color: white !important;
    font-size: 0.65rem !important;
    font-weight: bold !important;
    border-radius: 50% !important;
    padding: 2px 5px !important;
    min-width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    line-height: 1 !important;
    transform: none !important;
    box-sizing: border-box !important;
    pointer-events: none !important;
    border: 1px solid white !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide mobile elements on desktop */
.mobile-only,
.mobile-search,
.mobile-logo,
.mobile-profile-container {
    display: none !important;
}

/* Mobile bottom navigation - hidden on desktop */
.mobile-bottom-nav {
    display: none !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background-color: #0066cc !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    z-index: 1000 !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.bottom-nav-buttons {
    display: flex !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 10px !important;
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

.bottom-nav-buttons li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
}

.bottom-nav-button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-decoration: none !important;
    color: white !important;
    padding: 6px 2px !important;
    border-radius: 8px !important;
    transition: background-color 0.3s ease !important;
    position: relative !important;
    min-width: 50px !important;
    max-width: 65px !important;
    text-align: center !important;
    flex: 1 !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: normal !important;
    font-weight: normal !important;
}

.bottom-nav-button span {
    font-size: 11px !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    color: inherit !important;
    font-weight: inherit !important;
}

.bottom-nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Mobile bottom nav notification positioning */
.bottom-nav-button .green-dot {
    top: 8px !important;
    right: 18px !important;
    width: 6px !important;
    height: 6px !important;
}

.bottom-nav-button .notification-count {
    top: -2px !important;
    right: 2px !important;
    font-size: 0.55rem !important;
    padding: 1px 3px !important;
    min-width: 12px !important;
    height: 12px !important;
}

/* Mobile profile button styling */
.mobile-profile-button {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.mobile-profile-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-buttons::-webkit-scrollbar {
    display: none;
}

.profile-dropdown {
    position: relative !important;
    display: inline-block !important;
}

.dropdown-content {
    display: none !important;
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    background-color: white !important;
    color: #333 !important;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2) !important;
    border-radius: 8px !important;
    list-style: none !important;
    padding: 10px 0 !important;
    margin: 5px 0 0 0 !important;
    width: 180px !important;
    z-index: 1000 !important;
    border: 1px solid #ddd !important;
}

.dropdown-content.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
}

.dropdown-content li {
    padding: 0 !important;
    text-align: left !important;
    margin: 0 !important;
    list-style: none !important;
    display: block !important;
    width: 100% !important;
}

.dropdown-content li a, 
.dropdown-content form button {
    display: block !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    width: 100% !important;
    text-align: left !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    color: #333 !important;
    font-family: inherit !important;
    transition: background-color 0.2s ease !important;
    box-sizing: border-box !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
}

.dropdown-content li a:hover, 
.dropdown-content form button:hover {
    background-color: #f5f5f5 !important;
    color: #333 !important;
}

.dropdown-content form {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.relation-button .green-dot,
.notification-button .green-dot {
    height: 8px;
    width: 8px;
    background-color: #28a745;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
}

.notification-button {
    position: relative; /* Set the parent to relative for proper positioning */
    display: inline-block;
}

.notification-count {
    background-color: red;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    position: absolute;
    top: 10;
    right: 100;
    transform: translate(50%, -50%);
    z-index: 10;
}

/* Wrapper for both icon and label */
.icon-label-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    gap: 10px; /* control spacing between icon and label */
}

/* Icon container */
.icon-wrapper {
    position: relative;
    display: inline-block;
}

/* Notification dots */
.icon-wrapper .green-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    border: 1px solid white;
    z-index: 2;
}

.icon-wrapper .notification-count {
    position: absolute;
    top: 12px;
    right: 14px;
    background-color: red;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    line-height: 1;
    z-index: 3;
}

/* Label text */
.label-text {
    font-size: 14px;
    text-align: center;
}



.dropdown-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}
.family-search-bar {
    position: relative;  /* 🟢 This anchors absolutely positioned children */
    display: inline-block; /* Optional: ensures it wraps the input + list tightly */
}

#family-search-input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: 280px;
}

#family-search-results {
    display: none;
    position: absolute;  /* 🟢 Absolutely position relative to .family-search-bar */
    top: 100%;  /* 🟢 Right below the input field */
    left: 0;
    width: 100%;  /* 🟢 Match the input's width */
    background: #fff;
    border: 1px solid #ccc;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);  /* Optional: subtle shadow */
}

#family-search-results li {
    padding: 6px 10px;
    cursor: pointer;
}

#family-search-results li:hover {
    background-color: #f0f0f0;
}




/* Footer */
footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background-color: #0066cc;
    color: white;
    text-align: center;
    padding: 10px;
    z-index: 100;
}

footer p {
    font-size: 1rem;
}


/* Dark mode styles for header/nav */
.dark-mode header, body.dark-mode header {
    background-color: #181c23;
}
.dark-mode nav, body.dark-mode nav {
    background-color: #181c23;
}
.dark-mode .header-button, body.dark-mode .header-button {
    color: #fff;
    background: transparent;
}
.dark-mode .header-button:hover, body.dark-mode .header-button:hover {
    background-color: #23272f;
}
.dark-mode .profile-dropdown, body.dark-mode .profile-dropdown {
    background: transparent;
}
.dark-mode .dropdown-content, body.dark-mode .dropdown-content {
    background-color: #23272f;
    color: #fff;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.4);
}
.dark-mode .dropdown-content li a, .dark-mode .dropdown-content form button, body.dark-mode .dropdown-content li a, body.dark-mode .dropdown-content form button {
    color: #fff;
}
.dark-mode .dropdown-content li a:hover, .dark-mode .dropdown-content form button:hover, body.dark-mode .dropdown-content li a:hover, body.dark-mode .dropdown-content form button:hover {
    background-color: #2d313a;
}
.dark-mode .profile-picture-small, body.dark-mode .profile-picture-small {
    border: 2px solid #23272f;
}

/* Dark mode styles for mobile navigation */
.dark-mode .mobile-bottom-nav, body.dark-mode .mobile-bottom-nav {
    background-color: #181c23;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .bottom-nav-button, body.dark-mode .bottom-nav-button {
    color: #fff;
}

.dark-mode .bottom-nav-button:hover, body.dark-mode .bottom-nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .mobile-profile-button:hover, body.dark-mode .mobile-profile-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .top-header, body.dark-mode .top-header {
    background-color: #181c23;
}

.dark-mode #family-search-input, body.dark-mode #family-search-input {
    background-color: var(--dark-input-bg);
    color: var(--dark-text-color);
    border: 1px solid var(--dark-border-color);
}

.dark-mode #family-search-results, body.dark-mode #family-search-results {
    background-color: var(--dark-card-bg);
    border: 1px solid var(--dark-border-color);
}

/* Also hide mobile search results by default */
.mobile-search ul {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    display: none; /* Hide by default */
}

.mobile-search ul:not(:empty) {
    display: block; /* Only show when there are results */
}

/* Hamburger Menu Styles */
.hamburger-container {
    position: relative;
}

.hamburger-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: #333;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    display: none;
    margin-top: 5px;
}

.mobile-menu.show {
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
}

.mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu li {
    border-bottom: 1px solid #eee;
}

.mobile-menu li:last-child {
    border-bottom: none;
}

.mobile-menu a {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
}

.mobile-menu a:hover {
    background-color: #f5f5f5;
}

/* Dark mode hamburger styles */
body.dark-mode .hamburger-line {
    background-color: #fff;
}

body.dark-mode .mobile-menu {
    background: #2c3e50;
    border-color: #34495e;
}

body.dark-mode .mobile-menu a {
    color: #e8e8e8;
}

body.dark-mode .mobile-menu a:hover {
    background-color: #34495e;
}

body.dark-mode .mobile-menu li {
    border-bottom-color: #34495e;
}

/* MOBILE RESPONSIVE OVERRIDES */
@media (max-width: 900px) {
    /* Show mobile elements */
    .mobile-only,
    .mobile-search,
    .mobile-logo,
    .mobile-profile-container {
        display: block !important;
    }
    
    /* Show mobile top header */
    .top-header.mobile-only {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 10px 15px !important;
    }
    
    /* Hide desktop navigation */
    .desktop-nav,
    .desktop-search,
    .desktop-logo,
    .desktop-profile {
        display: none !important;
    }
    
    /* Hide mobile logo, show hamburger */
    .mobile-logo {
        display: none !important;
    }
    
    .mobile-hamburger {
        display: flex !important;
    }
    
    /* Show mobile bottom navigation */
    .mobile-bottom-nav {
        display: block !important;
    }
    
    /* Hide footer on mobile */
    footer {
        display: none !important;
    }
    
    /* Mobile layout positioning */
    .mobile-hamburger {
        order: 1 !important; /* Move to left */
        flex: 0 0 auto !important;
        margin-right: 10px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .mobile-search {
        order: 2 !important; /* Center */
        flex: 1 !important;
        max-width: none !important;
        margin: 0 10px !important;
        position: relative !important;
    }
    
    .mobile-profile-container {
        order: 3 !important; /* Stay on right */
        flex: 0 0 auto !important;
    }
    
    /* Adjust header layout for mobile */
    header {
        padding: 0 !important;
    }
    
    /* Adjust logo for mobile */
    .logo {
        max-width: 100px !important;
        max-height: 50px !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
    }
    
    /* Mobile search input styling */
    .mobile-search #family-search-input {
        width: 100% !important;
        padding: 6px 8px !important;
        font-size: 12px !important;
        border-radius: 15px !important;
        border: 1px solid #ccc !important;
        background: white !important;
        color: #333 !important;
        outline: none !important;
        box-sizing: border-box !important;
    }
    
    /* Add bottom padding to body to account for bottom nav */
    body {
        padding-bottom: 80px !important;
    }
    
    /* Adjust profile picture size */
    .mobile-profile-container .profile-picture-small {
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
    }
    
    /* Hide left-wrapper on mobile homepage only */
    body.homepage .left-wrapper,
    .homepage-layout .left-wrapper {
        display: none !important;
    }
    
    /* Keep left-wrapper visible on aboutme and user_profile pages */
    body.aboutme .left-wrapper,
    body.user-profile .left-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto 20px auto !important;
    }
    
    /* Mobile profile dropdown adjustments */
    .mobile-profile-container .dropdown-content {
        right: 0 !important;
        top: 100% !important;
        position: absolute !important;
        width: 160px !important;
        margin-top: 5px !important;
        z-index: 9999 !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
    
    /* Ensure mobile dropdown is clickable */
    .mobile-profile-container .dropdown-content.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* Fix mobile dropdown links */
    .mobile-profile-container .dropdown-content li a {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Mobile search results fix */
    #family-search-results {
        z-index: 9998 !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
    
    #family-search-results li {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
    }
}

/* ESSENTIAL COMPONENT STYLES */
.profile-picture-small {
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
    border: none !important;
}

.logo-container {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.logo {
    max-width: 150px !important;
    max-height: 100px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

img {
    border: none !important;
}

/* Mobile profile button styling */
.mobile-profile-button {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    padding: 5px !important;
    border-radius: 50% !important;
    transition: background-color 0.3s ease !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
}

.mobile-profile-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* =============================================
   DARK MODE OVERRIDES - HIGHEST PRIORITY
   ============================================= */

.dark-mode header, 
body.dark-mode header {
    background-color: #1a1a1a !important;
    color: white !important;
    border-bottom: 1px solid #333 !important;
}

.dark-mode .desktop-nav,
body.dark-mode .desktop-nav {
    background-color: #1a1a1a !important;
    border: none !important;
}

.dark-mode .top-header.mobile-only,
body.dark-mode .top-header.mobile-only {
    background-color: #1a1a1a !important;
    border: none !important;
}

.dark-mode .header-button, 
body.dark-mode .header-button {
    color: white !important;
    background: transparent !important;
    border: none !important;
}

.dark-mode .header-button:hover, 
body.dark-mode .header-button:hover {
    background-color: #333 !important;
    color: white !important;
}

.dark-mode .header-button span,
body.dark-mode .header-button span {
    color: white !important;
}

.dark-mode .mobile-bottom-nav, 
body.dark-mode .mobile-bottom-nav {
    background-color: #1a1a1a !important;
    border-top: 1px solid #333 !important;
}

.dark-mode .bottom-nav-button, 
body.dark-mode .bottom-nav-button {
    color: white !important;
    background: transparent !important;
    border: none !important;
}

.dark-mode .bottom-nav-button:hover, 
body.dark-mode .bottom-nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.dark-mode .bottom-nav-button span,
body.dark-mode .bottom-nav-button span {
    color: white !important;
}

.dark-mode .mobile-profile-button:hover, 
body.dark-mode .mobile-profile-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .desktop-search input,
body.dark-mode .desktop-search input {
    background-color: #333 !important;
    color: white !important;
    border: 2px solid #555 !important;
}

.dark-mode .desktop-search input:focus,
body.dark-mode .desktop-search input:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2) !important;
}

.dark-mode .desktop-search ul,
body.dark-mode .desktop-search ul {
    background-color: #333 !important;
    border: 1px solid #555 !important;
    color: white !important;
}

.dark-mode #family-search-input, 
body.dark-mode #family-search-input {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid #555 !important;
}

.dark-mode .mobile-search #family-search-input,
body.dark-mode .mobile-search #family-search-input {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid #555 !important;
}

/* Notification badges remain the same in dark mode */
.dark-mode .header-button .green-dot,
.dark-mode .bottom-nav-button .green-dot,
body.dark-mode .header-button .green-dot,
body.dark-mode .bottom-nav-button .green-dot {
    background-color: #28a745 !important;
}

.dark-mode .header-button .notification-count,
.dark-mode .bottom-nav-button .notification-count,
body.dark-mode .header-button .notification-count,
body.dark-mode .bottom-nav-button .notification-count {
    background-color: red !important;
    color: white !important;
}

/* Dark mode dropdown styles */
.dark-mode .dropdown-content,
body.dark-mode .dropdown-content {
    background-color: #333 !important;
    color: white !important;
    border: 1px solid #555 !important;
}

.dark-mode .dropdown-content li a,
.dark-mode .dropdown-content form button,
body.dark-mode .dropdown-content li a,
body.dark-mode .dropdown-content form button {
    color: white !important;
}

.dark-mode .dropdown-content li a:hover,
.dark-mode .dropdown-content form button:hover,
body.dark-mode .dropdown-content li a:hover,
body.dark-mode .dropdown-content form button:hover {
    background-color: #444 !important;
    color: white !important;
}

/* Additional mobile breakpoint for left-wrapper hiding */
@media (max-width: 900px) {
    body.homepage .left-wrapper,
    .homepage-layout .left-wrapper {
        display: none !important;
    }
    
    /* Keep left-wrapper visible on other pages */
    body.aboutme .left-wrapper,
    body.user-profile .left-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto 20px auto !important;
    }
}

/* Mobile landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    /* Ensure hamburger menu is always visible in landscape */
    .mobile-only,
    .top-header.mobile-only {
        display: flex !important;
    }
    
    .desktop-nav,
    .desktop-logo,
    .desktop-search,
    .header-buttons {
        display: none !important;
    }
    
    /* Ensure header takes full width in landscape */
    header {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .top-header.mobile-only {
        width: 100% !important;
        min-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Mentioned user styling for @ tagging */
.mentioned-user {
    color: #1da1f2;
    background-color: rgba(29, 161, 242, 0.1);
    padding: 1px 3px;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.mentioned-user:hover {
    background-color: rgba(29, 161, 242, 0.2);
    text-decoration: none;
}

/* Dark mode styles for mentioned users */
body.dark-mode .mentioned-user {
    color: #1da1f2;
    background-color: rgba(29, 161, 242, 0.15);
}

body.dark-mode .mentioned-user:hover {
    background-color: rgba(29, 161, 242, 0.25);
}

/* LinkedIn-style reaction display */
.reaction-group {
    display: inline-block;
    margin-right: 8px;
    font-size: 14px;
    font-weight: 500;
}

.reaction-group:last-child {
    margin-right: 0;
}

/* Reaction container spacing */
.reaction-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.like-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.like-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.like-button.liked {
    color: #1da1f2;
    background-color: rgba(29, 161, 242, 0.1);
}

/* LinkedIn-style reaction dropdown */
.reaction-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 30px 16px !important; /* Further increased padding to fully cover emojis */
    display: none; /* Changed from flex to none initially */
    flex-direction: row;
    gap: 6px; /* Further increased gap to ensure spacing within background */
    z-index: 9999; /* Increased z-index to ensure it appears above post wrapper */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    min-width: 360px; /* Ensure adequate width for all emojis */
}

.reaction-dropdown.show {
    display: flex !important; /* Show with flex layout when active */
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.reaction-dropdown button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 26px; /* Slightly larger font size */
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px; /* Slightly larger for better fit */
    height: 48px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    position: relative;
    vertical-align: middle; /* Better vertical alignment */
}

.reaction-dropdown button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.2);
}

.reaction-dropdown button:active {
    transform: scale(1.1);
}

/* Modal reaction dropdown */
.modal-reaction-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 16px; /* Further increased padding to fully cover emojis */
    display: none; /* Changed from flex to none initially */
    flex-direction: row;
    gap: 6px; /* Further increased gap to ensure spacing within background */
    z-index: 9999; /* Increased z-index to ensure it appears above modal content */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    min-width: 360px; /* Ensure adequate width for all emojis */
}

.modal-reaction-dropdown.show {
    display: flex !important; /* Show with flex layout when active */
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.modal-reaction-dropdown button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 26px; /* Slightly larger font size */
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px; /* Slightly larger for better fit */
    height: 48px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    position: relative;
    vertical-align: middle; /* Better vertical alignment */
}

.modal-reaction-dropdown button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.2);
}

.modal-reaction-dropdown button:active {
    transform: scale(1.1);
}

/* Ensure reaction container has relative positioning */
.reaction-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Ensure post containers allow overflow for reaction dropdowns */
.post, .post-card, .user-post {
    overflow: visible !important;
}

.post-content, .post-wrapper {
    overflow: visible !important;
}

/* Removed CSS-based hover to prevent white background appearing */

/* Dark mode support */
body.dark-mode .reaction-dropdown,
body.dark-mode .modal-reaction-dropdown {
    background: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .reaction-dropdown button:hover,
body.dark-mode .modal-reaction-dropdown button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile responsive styles for reaction dropdown */
@media (max-width: 768px) {
    .reaction-dropdown,
    .modal-reaction-dropdown {
        /* Very compact padding for mobile */
        padding: 4px 8px !important;
        /* Smaller minimum width */
        min-width: 220px !important;
        /* Minimal gap between emojis */
        gap: 1px;
        /* Align to left edge of reaction button */
        left: 0 !important;
        right: auto;
        transform: translateY(-10px) !important;
        /* Ensure dropdown doesn't exceed screen bounds */
        max-width: calc(100vw - 16px);
        /* Reduce margin for tighter mobile layout */
        margin-bottom: 3px;
        /* Override desktop font size restrictions */
        font-size: 0; /* Reset container font size */
    }
    
    .reaction-dropdown.show,
    .modal-reaction-dropdown.show {
        transform: translateY(0) !important;
    }
    
    .reaction-dropdown button,
    .modal-reaction-dropdown button {
        /* Compact buttons for mobile */
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
        /* No margins to save space */
        margin: 0 !important;
        padding: 0 !important;
        /* Ensure buttons stay in line */
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
    .reaction-dropdown,
    .modal-reaction-dropdown {
        /* Ultra compact for very small screens */
        padding: 3px 6px !important;
        min-width: 200px !important;
        gap: 0px; /* No gap to save maximum space */
        /* Ensure it fits within small screens */
        max-width: calc(100vw - 12px);
        margin-bottom: 2px;
        /* Keep left alignment with small offset for small screens */
        left: 15px !important;
        transform: translateY(-10px) !important;
    }
    
    .reaction-dropdown.show,
    .modal-reaction-dropdown.show {
        transform: translateY(0) !important;
    }
    
    .reaction-dropdown button,
    .modal-reaction-dropdown button {
        /* Very small buttons for tiny screens */
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }
}

/* Ultra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .reaction-dropdown,
    .modal-reaction-dropdown {
        /* Maximum compression for smallest screens */
        padding: 2px 4px !important;
        min-width: 180px !important;
        gap: 0px;
        max-width: calc(100vw - 8px);
        margin-bottom: 1px;
        /* Keep left alignment with small offset for ultra small screens */
        left: 10px !important;
        transform: translateY(-10px) !important;
    }
    
    .reaction-dropdown.show,
    .modal-reaction-dropdown.show {
        transform: translateY(0) !important;
    }
    
    .reaction-dropdown button,
    .modal-reaction-dropdown button {
        /* Tiny buttons for ultra small screens */
        width: 26px !important;
        height: 26px !important;
        font-size: 14px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .reaction-dropdown,
    .modal-reaction-dropdown {
        /* Position below button for landscape to avoid top cutoff */
        bottom: auto;
        top: 100%;
        margin-bottom: 0;
        margin-top: 3px; /* Reduced margin */
        /* Align with small offset for landscape */
        left: 15px !important;
        transform: translateY(10px) !important;
        /* Use even more compact sizing for landscape */
        padding: 3px 6px !important;
        min-width: 200px !important;
        gap: 0px;
        max-width: calc(100vw - 10px);
    }
    
    .reaction-dropdown.show,
    .modal-reaction-dropdown.show {
        transform: translateY(0) !important;
    }
    
    .reaction-dropdown button,
    .modal-reaction-dropdown button {
        /* Small buttons for landscape mobile */
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
    }
}

/* Post actions - make buttons occupy full line space on ALL screen sizes */
.post-actions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 8px 0 !important;
    gap: 0 !important;
}

.reaction-container {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important; /* Center the reaction content */
    align-items: center !important;
    position: relative !important;
}

.like-button {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important; /* Center the button content */
    align-items: center !important;
    text-align: center !important;
    padding: 12px 8px !important;
    min-height: 44px !important; /* Ensure good touch target */
}

.comment-toggle-button {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important; /* Center the button content */
    align-items: center !important;
    text-align: center !important;
    padding: 12px 8px !important;
    min-height: 44px !important; /* Ensure good touch target */
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .post-actions {
        padding: 10px 0 !important;
    }
    
    .like-button,
    .comment-toggle-button {
        padding: 10px 6px !important;
        min-height: 48px !important; /* Larger touch targets on mobile */
        font-size: 14px !important;
    }
    
    /* Keep dropdown left-aligned to avoid cutoff on mobile */
    .reaction-dropdown,
    .modal-reaction-dropdown {
        left: 20px !important; /* Small offset from left edge */
        transform: translateY(-10px) !important;
    }
    
    .reaction-dropdown.show,
    .modal-reaction-dropdown.show {
        transform: translateY(0) !important;
    }
}

/* Override full-width styling for comment section buttons */
.comments .comment-actions,
.comments-list .comment-actions,
.comment .comment-actions,
.comment-item .comment-actions {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    gap: normal !important;
}

.comments .like-button,
.comments-list .like-button,
.comment .like-button,
.comment-item .like-button {
    width: auto !important;
    display: inline-flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: left !important;
    padding: 4px 8px !important;
    min-height: auto !important;
    margin-right: 8px !important;
    flex: none !important;
}

.comments .reaction-container,
.comments-list .reaction-container,
.comment .reaction-container,
.comment-item .reaction-container {
    flex: none !important;
    display: inline-flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: relative !important;
    width: auto !important;
}

/* Comment reply buttons and other comment actions */
.comments .comment-reply-button,
.comments-list .comment-reply-button,
.comment .comment-reply-button,
.comment-item .comment-reply-button,
.comments .reply-button,
.comments-list .reply-button,
.comment .reply-button,
.comment-item .reply-button {
    width: auto !important;
    display: inline-flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: left !important;
    padding: 4px 8px !important;
    min-height: auto !important;
    margin-left: 8px !important;
    flex: none !important;
}

/* Enhanced comment section styles */
.comment-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-info {
    flex: 1;
}

.comment-name-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.comment-time, .reply-time {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.family-relation {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.comment-content {
    margin-bottom: 8px;
}

.read-more-btn, .read-less-btn {
    background: none;
    border: none;
    color: #1da1f2;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin-left: 4px;
    text-decoration: underline;
}

.read-more-btn:hover, .read-less-btn:hover {
    color: #0d8bd9;
}

.delete-comment-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.delete-comment-btn:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

.load-more-replies-btn {
    background: none;
    border: none;
    color: #1da1f2;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 0;
    margin: 8px 0;
    text-decoration: underline;
}

.load-more-replies-btn:hover {
    color: #0d8bd9;
}

.load-more-replies-btn:disabled {
    color: #999;
    cursor: not-allowed;
    text-decoration: none;
}

.reply-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.reply-info {
    flex: 1;
}

.reply-name-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.reply-profile-pic {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* Animation for comment deletion */
.comment[style*="transform"] {
    overflow: hidden;
}

/* Dark mode support for new elements */
body.dark-mode .comment-time,
body.dark-mode .reply-time {
    color: #aaa;
}

body.dark-mode .family-relation {
    color: #999;
}

body.dark-mode .read-more-btn,
body.dark-mode .read-less-btn,
body.dark-mode .load-more-replies-btn {
    color: #4da6d9;
}

body.dark-mode .read-more-btn:hover,
body.dark-mode .read-less-btn:hover,
body.dark-mode .load-more-replies-btn:hover {
    color: #6bb8e3;
}

body.dark-mode .delete-comment-btn:hover {
    background-color: rgba(231, 76, 60, 0.2);
}

