/*
 * Chrome (header + footer) styles for Django-rendered pages.
 *
 * Mirrors the scoped styles previously in:
 *   - frontend/src/views/BaseLayout.vue
 *   - frontend/src/components/Nav.vue
 *   - frontend/src/components/LogoMenu.vue
 *   - frontend/src/components/LanguageSwitcher.vue
 *
 * Class names match those used in _chrome_header.dtl / _chrome_footer.dtl.
 * If you change either, keep both in sync.
 */

/* ===== Layout ===== */
.site-header {
    display: flex;
    padding: 0 10px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgb(107, 107, 107);
    background-color: var(--grey-1);
    height: var(--header-height);
}

.site-header nav {
    padding-right: 20px;
    height: 100%;
    display: flex;
    align-items: center;
}

.site-footer {
    margin: 60px 0 15px 0;
    text-align: center;
    font-size: 0.9em;
    color: var(--muted-text);
}

.site-footer .bottom-links {
    margin: 20px;
}

.site-footer .bottom-links a {
    margin: 0 5px;
}

/* ===== LogoMenu (logo + mobile drawer trigger) ===== */
.logo-menu {
    height: 100%;
    white-space: nowrap;
    position: relative;
}

.logo-menu .logo-btn {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    height: 100%;
    padding: 0 25px;
}

.logo-menu .logo-btn img {
    display: block;
}

.logo-menu .dd-opener {
    display: none; /* shown on mobile via media query */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 25px;
    height: 100%;
    align-items: center;
    vertical-align: middle;
}

.logo-menu .dd-opener i {
    padding-left: 10px;
    padding-top: 3px;
}

.logo-menu .menu-wrapper {
    position: relative;
}

.logo-menu .menu {
    overflow: hidden;
    background-color: var(--grey-2);
    border: 1px solid var(--grey-3);
    border-top: none;
    position: absolute;
    display: none; /* toggled open by JS */
    flex-direction: column;
    align-items: flex-start;
    top: 1px;
    left: 0;
    width: 300px;
    z-index: var(--nav-dd-z);
    max-height: 0;
    transition: max-height 0.21s;
}

.logo-menu .menu.open {
    display: flex;
    max-height: 400px;
}

.mobile-lang-switcher {
    display: none; /* shown on mobile */
    align-items: center;
    vertical-align: middle;
    margin-left: 15px;
    height: 100%;
}

/* ===== Nav (links) ===== */
.site-nav {
    height: 100%;
    display: flex;
    align-items: center;
}

.site-nav .nav-cont {
    display: inline-flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
}

.site-nav .nav-cont:last-child {
    margin-right: 1em;
}

.site-nav .nav-button {
    color: #bbb;
    text-decoration: none;
    font-size: var(--nav-font-size);
    padding: 0 20px;
    display: flex;
    align-items: center;
    vertical-align: middle;
    height: 100%;
    line-height: 1;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.site-nav .nav-button:hover,
.site-nav .nav-button.active {
    -webkit-appearance: none;
    border-radius: 1px;
    box-shadow: inset 0px -3px 0px var(--primary-green);
}

/* Vertical mode (inside mobile drawer) */
.site-nav.vertical {
    padding: 0;
    width: 100%;
    flex-direction: column;
}

.site-nav.vertical .nav-cont {
    height: 100px;
    display: flex;
    align-items: center;
    width: 100%;
}

.site-nav.vertical .nav-button {
    box-shadow: none;
    width: 100%;
    justify-content: flex-start;
}

.site-nav.vertical .nav-button.active,
.site-nav.vertical .nav-button:hover {
    box-shadow: inset 5px 0px 0px var(--primary-green);
}

.site-nav.vertical .desktop-only {
    display: none !important;
}

/* ===== Responsive: <992px treats as mobile ===== */
@media (max-width: 992px) {
    .site-header .hor-nav {
        display: none !important;
    }
    .logo-menu .logo-btn:not(.dd-opener) {
        display: none !important;
    }
    .logo-menu .dd-opener {
        display: inline-flex !important;
    }
    .mobile-lang-switcher {
        display: inline-flex !important;
    }
}

@media (min-width: 992px) {
    .logo-menu .menu-wrapper,
    .logo-menu .dd-opener,
    .mobile-lang-switcher {
        display: none !important;
    }
}

/* ===== Language switcher (flag button + modal) ===== */
.language-switcher {
    display: inline-flex;
    align-items: center;
}
.flag-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #555;
    background: #222;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}
.flag-btn:hover {
    border-color: #fff;
    transform: scale(1.05);
}
.flag-btn .flag {
    height: 100%;
    aspect-ratio: 3 / 2;
    width: auto;
}

/* Modal */
.lang-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--modal-z);
    align-items: center;
    justify-content: center;
}
.lang-modal-backdrop.open {
    display: flex;
}
.lang-modal {
    background: var(--grey-1);
    border: 1px solid var(--grey-3);
    border-radius: 6px;
    padding: 24px;
    min-width: 260px;
    max-width: 90vw;
    color: #ddd;
    position: relative;
}
.lang-modal .close-x {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--primary-green);
    cursor: pointer;
    font-size: 1.4em;
    line-height: 1;
}
.lang-title {
    margin: 0 0 0.75em;
    font-size: 1.25em;
}
.lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 220px;
}
.lang-list li + li {
    margin-top: 4px;
}
.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    color: inherit;
    font-size: 1em;
    text-align: left;
    cursor: pointer;
    border: none;
    border-radius: 4px;
}
.lang-option:hover {
    background: var(--grey-2);
}
.lang-option.active {
    background: var(--grey-2);
    font-weight: 600;
}
.flag-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #555;
    background: #222;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.flag-circle .flag {
    height: 100%;
    aspect-ratio: 3 / 2;
    width: auto;
}
.flag {
    position: relative;
    display: block;
    flex-shrink: 0;
}

/* Flag designs (kept identical to LanguageSwitcher.vue) */
.flag-en {
    background: repeating-linear-gradient(to bottom, #b22234 0 7.69%, #fff 7.69% 15.38%);
}
.flag-en::before {
    content: ""; position: absolute; top: 0; left: 0;
    width: 48%; height: 54%; background: #3c3b6e;
}
.flag-es {
    background: linear-gradient(to bottom, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75% 100%);
}
.flag-de {
    background: linear-gradient(to bottom, #000 0 33.33%, #dd0000 33.33% 66.66%, #ffce00 66.66% 100%);
}
.flag-fr {
    background: linear-gradient(to right, #0055a4 0 33.33%, #fff 33.33% 66.66%, #ef4135 66.66% 100%);
}
.flag-it {
    background: linear-gradient(to right, #009246 0 33.33%, #fff 33.33% 66.66%, #ce2b37 66.66% 100%);
}
.flag-pt {
    background: #009c3b; position: relative; overflow: hidden;
}
.flag-pt::before {
    content: ""; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 60%; height: 60%; background: #ffdf00;
}
.flag-pt::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40%; height: 40%; background: #002776; border-radius: 50%;
}
.flag-hi {
    background: linear-gradient(to bottom, #ff9933 0 33.33%, #fff 33.33% 66.66%, #138808 66.66% 100%);
}
.flag-hi::before {
    content: ""; position: absolute; top: 41%; left: 41%;
    width: 18%; height: 18%; border-radius: 50%;
    border: 1.5px solid #000080; box-sizing: border-box;
}
.flag-id {
    background: linear-gradient(to bottom, #ff0000 0 50%, #fff 50% 100%);
}
.flag-ja {
    background: #fff;
}
.flag-ja::before {
    content: ""; position: absolute; top: 30%; left: 35%;
    width: 30%; height: 40%; border-radius: 50%; background: #bc002d;
}
.flag-zh {
    background: #de2910;
}
.flag-zh::before {
    content: "★"; position: absolute; top: 10%; left: 10%;
    color: #ffde00; font-size: 0.8em; line-height: 1;
}
