@import url('themes.css');

body {
    background-color: var(--primary-bg-color);
    color: var(--primary-text-color);
    font-family: Segoe UI, Arial, sans-serif;
    font-size: 16px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh
}

header, .navbar, #navbar-placeholder {
    width: 100vw;
    min-width: 100vw;
    left: 0;
    margin-left: calc(50% - 50vw);
    background: var(--header-bg-color);
    color: var(--header-text-color);
    text-align: center;
    font-family: inherit;
    padding: 0.5em 0 0.35em 0;
    font-size: 1.05em;
    z-index: 999;
    position: relative;
    top: 0
}

header h1 {
    margin: 0;
    font-size: 1.2em;
    letter-spacing: 0.04em
}

main nav, nav:not(header nav):not(#navbar-placeholder nav):not(.navbar nav) {
    opacity: 1 !important;
    visibility: visible !important
}

header nav, #navbar-placeholder nav, .navbar nav {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap
}

header nav a, #navbar-placeholder nav a, .navbar nav a {
    margin: 0 15px;
    text-decoration: none;
    color: var(--link-color);
    font-weight: bold;
    white-space: nowrap;
    transition: color 0.3s
}

.dropdown {
    position: relative
}

.dropdown > a {
    cursor: pointer;
    position: relative;
}

/* Subtle underline indicator on hover for dropdown triggers */
.dropdown > a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.dropdown:hover > a::after {
    opacity: 1;
    transform: scaleX(1);
}

.dropdown-content {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px) scale(0.98);
    min-width: 200px;
    background: rgba(20, 10, 10, 0.85);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    z-index: 1000;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s ease,
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none
}

.dropdown-content a {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    position: relative;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(2px);
}

.dropdown-content a:active {
    transform: translateX(2px) scale(0.98);
}

.dropdown:hover > .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto
}

.dropdown.active > .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto
}

/* ── Submenus ── */
.submenu {
    position: relative
}

.submenu-title {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer
}

.submenu-title::after {
    content: "\203A";
    font-size: 1.1em;
    opacity: 0.4;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.submenu:hover > .submenu-title::after {
    opacity: 0.8;
    transform: translateX(2px);
}

.submenu-title:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.submenu-content {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: -6px;
    left: calc(100% + 6px);
    min-width: 190px;
    background: rgba(20, 10, 10, 0.88);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    z-index: 1001;
    transform: translateX(-8px) scale(0.98);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s ease,
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none
}

.submenu-content a {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.submenu-content a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(2px);
}

.submenu:hover > .submenu-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    pointer-events: auto
}

.submenu.active > .submenu-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    pointer-events: auto
}

/* ── Light theme dropdown overrides ── */
[data-theme="light"] .dropdown-content {
    background: rgba(0, 60, 160, 0.88);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .submenu-content {
    background: rgba(0, 60, 160, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .submenu-content a:hover {
    background: rgba(255, 255, 255, 0.15);
}

footer, #footer-placeholder {
    width: 100vw;
    min-width: 100vw;
    left: 0;
    margin-left: calc(50% - 50vw);
    position: relative;
    background: var(--header-bg-color);
    color: var(--header-text-color);
    text-align: center;
    font-family: inherit;
    font-weight: bold;
    padding: 0.5em 0;
    font-size: 0.96em;
    margin-top: auto;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center
}

header a:hover, .navbar a:hover, #navbar-placeholder a:hover {
    color: var(--link-hover-color)
}

footer a, #footer-placeholder a {
    color: var(--link-color);
    text-decoration: none;
    margin: 0 0.5em
}

footer a:hover, #footer-placeholder a:hover {
    text-decoration: underline
}

.description {
    color: var(--primary-text-color);
    font-size: 1.2em;
    margin-bottom: 20px
}

.hidden {
    display: none !important
}

/* Mobile menu hamburger button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--header-text-color);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    header, .navbar, #navbar-placeholder, #navbar-placeholder header {
        height: auto;
        transition: padding-bottom 0.4s ease 0.05s
    }

    header:hover, .navbar:hover, #navbar-placeholder:hover {
        padding-bottom: calc(0.5em + 40px);
        transition: padding-bottom 0.4s ease 0s
    }

    header nav, #navbar-placeholder nav, .navbar nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        margin-top: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-20px);
        transition: opacity 0.5s ease 0s, transform 0.55s ease 0s, visibility 0s linear 0.6s
    }

    header:hover nav, .navbar:hover nav, #navbar-placeholder:hover nav {
        position: absolute;
        margin-top: 0;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        transition: transform 0.6s ease 0.1s, opacity 0.6s ease 0.15s, visibility 0s linear 0s
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 0.6em;
        left: 50%;
        transform: translateX(-50%);
    }

    header nav, #navbar-placeholder nav, .navbar nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--header-bg-color);
        flex-direction: column;
        align-items: flex-start;
        margin-top: 0;
        padding: 80px 0 20px;
        overflow-y: auto;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3)
    }

    header nav.mobile-menu-open, #navbar-placeholder nav.mobile-menu-open, .navbar nav.mobile-menu-open {
        left: 0
    }

    header nav a, #navbar-placeholder nav a, .navbar nav a {
        margin: 0;
        padding: 15px 20px;
        width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1)
    }

    header:not(.minimized), .navbar:not(.minimized), #navbar-placeholder:not(.minimized) {
        overflow: visible
    }

    header.minimized {
        max-height: 25px
    }

    .dropdown {
        width: 100%
    }

    .dropdown > a {
        padding: 15px 20px;
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1)
    }

    .dropdown > a::after {
        display: none;
    }

    .dropdown-content {
        position: static;
        background: rgba(255, 255, 255, 0.04);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        min-width: auto;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        transform: none;
        transition: opacity 0.3s ease, height 0.3s ease;
        margin: 0;
        padding: 0
    }

    .dropdown-content a {
        padding-left: 40px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05)
    }

    .dropdown-content a:hover {
        transform: none;
    }

    .dropdown.active > .dropdown-content {
        opacity: 1;
        visibility: visible;
        height: auto;
        transform: none
    }

    .dropdown:hover > .dropdown-content {
        opacity: 0;
        visibility: hidden;
        height: 0
    }

    .submenu {
        width: 100%
    }

    .submenu-title {
        padding-left: 40px;
        border-radius: 0;
    }

    .submenu-title::after {
        display: none;
    }

    .submenu-content {
        position: static;
        background: rgba(255, 255, 255, 0.04);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin: 0;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        transform: none;
        transition: opacity 0.3s ease, height 0.3s ease
    }

    .submenu-content a {
        padding-left: 60px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05)
    }

    .submenu.active > .submenu-content {
        opacity: 1;
        visibility: visible;
        height: auto;
        transform: none
    }

    .submenu:hover > .submenu-content {
        opacity: 0;
        visibility: hidden;
        height: 0
    }

    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease
    }

    .mobile-menu-overlay.active {
        display: block;
        opacity: 1
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.5em
    }

    nav a {
        font-size: 0.9em;
        margin: 5px 0
    }
}

#cookie-disclaimer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    background-color: var(--cookie-banner-bg-color) !important;
    color: var(--cookie-banner-text-color) !important;
    padding: 0 !important;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3) !important;
    z-index: 10000 !important;
    transition: transform 0.6s ease-in-out !important;
    backdrop-filter: blur(5px) !important;
    margin: 0 !important;
    transform: translateY(100%) !important
}

#cookie-disclaimer.show {
    transform: translateY(0) !important
}

.cookie-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%
}

#cookie-disclaimer p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    color: var(--cookie-banner-text-color);
    flex: 1;
    max-width: 800px
}

#cookie-accept-btn {
    background: var(--cookie-accept-bg);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    white-space: nowrap
}

#cookie-accept-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: var(--cookie-accept-hover-bg)
}

#cookie-accept-btn:active {
    transform: translateY(0)
}

@media (max-width: 900px) {
    .cookie-content {
        flex-wrap: wrap;
        padding: 20px 30px !important
    }

    #cookie-disclaimer p {
        flex: 1 1 100%;
        text-align: center;
        margin-bottom: 10px
    }

    #cookie-accept-btn {
        flex: 0 0 auto;
        margin: 0 auto
    }
}

@media (max-width: 600px) {
    .cookie-content {
        padding: 18px 20px !important
    }

    #cookie-disclaimer p {
        font-size: 13px
    }

    #cookie-accept-btn {
        width: 100%;
        max-width: 200px;
        padding: 14px 20px
    }
}

/* User session controls */
.header-controls {
    position: absolute;
    top: 0.6em;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}

.header-controls.left {
    left: 1.5rem;
}

.header-controls.right {
    right: 1.5rem;
}

#theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

#theme-toggle .theme-icon {
    font-size: 1.1rem;
    line-height: 1;
}

#theme-toggle .theme-label {
    display: inline;
}

/* ── Profile Avatar & Dropdown ── */
.profile-avatar-btn {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.profile-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-btn svg {
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.6);
}

.profile-avatar-btn:hover svg {
    fill: rgba(255, 255, 255, 0.85);
}

/* Notification badge on avatar */
.profile-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    background: #e53e3e;
    color: white;
    border-radius: 50px;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--header-bg-color);
    line-height: 1;
    box-sizing: border-box;
}

/* Profile dropdown */
.profile-dropdown-wrap {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--dropdown-bg-color);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.profile-dropdown-header {
    padding: 10px 16px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

.profile-dropdown-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--header-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--header-text-color);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.profile-dropdown-item:hover {
    background: var(--dropdown-hover-bg-color);
}

.profile-dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
    opacity: 0.7;
}

.profile-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* Notification items inside dropdown */
.profile-dropdown-notifications {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    padding-top: 4px;
}

.notification-item {
    padding: 8px 16px;
    font-size: 0.78rem;
    color: var(--header-text-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item p {
    margin: 0 0 4px;
    line-height: 1.4;
}

.notification-item button {
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: var(--header-text-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: background 0.2s ease;
}

.notification-item button:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Header hint */
#header-hint {
    position: fixed;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(139, 92, 246, 0.9));
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    z-index: 1000;
    opacity: 0;
    transition: opacity .5s ease-in-out;
    pointer-events: none;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
}

#header-hint.visible {
    pointer-events: auto;
    animation: slideDownBounce 1s ease-out, pulseGlow 1.5s ease-in-out 1s infinite, wiggle 3s ease-in-out 1s infinite;
}

#header-hint-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-weight: bold;
}

#header-hint-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

@keyframes slideDownBounce {
    0% { transform: translateX(-50%) translateY(-50px) scale(0.8); opacity: 0; }
    50% { transform: translateX(-50%) translateY(8px) scale(1.05); opacity: 1; }
    70% { transform: translateX(-50%) translateY(-4px) scale(0.98); }
    85% { transform: translateX(-50%) translateY(2px) scale(1.02); }
    100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 rgba(139, 92, 246, 0.6); }
    50% { box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6), 0 0 30px rgba(139, 92, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.6); }
}

@keyframes wiggle {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
    25% { transform: translateX(-50%) translateY(-3px) rotate(-1deg); }
    50% { transform: translateX(-50%) translateY(0) rotate(0deg); }
    75% { transform: translateX(-50%) translateY(-3px) rotate(1deg); }
}

@media (max-width: 768px) {
    #header-hint { display: none; }
    #theme-toggle .theme-label { display: none; }
    #theme-toggle { padding: 0.3rem 0.5rem; }
    .header-controls { gap: 0.3rem; }
    .header-controls.left { left: 0.5rem; }
    .header-controls.right { right: 0.5rem; }
    .profile-avatar-btn { width: 30px; height: 30px; }
    .profile-dropdown { right: -8px; min-width: 180px; }
}

footer p {
    margin: 0.5em 0;
}

footer a[title="In loving memory"] {
    color: inherit;
    text-decoration: none;
    margin-left: 8px;
}