/* Oikosimo custom overrides */

/* overflow-x on body breaks position:fixed navbar on iOS Safari */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    max-width: 100%;
}

/* Shared fixed-header height (logo row + utility bar on mobile) */
:root {
    --oik-header-h: 76px;
    --oik-bottom-nav-h: 62px;
    --oik-gold: #c9a962;
    --oik-gold-dark: #a8893f;
    --oik-navy: #1a3a4a;
}

@media (max-width: 991px) {
    :root {
        --oik-header-h: 72px;
    }
}

/* --- Mobile homepage hero header bar --- */
.oik-mobile-hero-bar {
    position: relative;
    z-index: 5;
    padding: 10px 12px 6px;
    overflow: visible;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.oik-mobile-hero-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 52px;
    overflow: visible;
}

.oik-header-pill,
.oik-header-pill-spacer {
    flex: 0 0 auto;
    min-width: 72px;
}

.oik-header-pill {
    position: relative;
    overflow: visible;
}

.oik-header-pill .dropdown.open {
    z-index: 1045;
}

.oik-header-pill-spacer {
    visibility: hidden;
}

.oik-header-pill .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(26, 58, 74, 0.06);
    border: 1px solid rgba(26, 58, 74, 0.12);
    border-radius: 999px;
    color: var(--oik-navy) !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none !important;
    white-space: nowrap;
}

.oik-header-pill .dropdown-toggle .caret {
    margin-left: 2px;
    border-top-color: var(--oik-navy);
}

.oik-header-pill .dropdown-toggle .oik-flag-circle {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.oik-header-pill .dropdown-menu {
    min-width: 140px;
    border-radius: 12px;
    padding: 6px 0;
    margin-top: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 1045;
}

.oik-header-pill .dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--oik-navy);
}

.oik-header-pill .dropdown-menu a:hover,
.oik-header-pill .dropdown-menu a:focus {
    color: var(--oik-gold-dark);
    background: rgba(26, 58, 74, 0.04);
}

.oik-mobile-logo {
    flex: 1 1 auto;
    text-align: center;
    line-height: 1;
    min-width: 0;
}

.oik-mobile-logo img {
    display: inline-block;
    max-height: 52px;
    width: auto;
    max-width: min(180px, 46vw);
    height: auto;
    object-fit: contain;
}

.oik-flag-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.oik-header-pill .dropdown-menu .oik-flag-circle {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

@media (max-width: 991px) {
    header.oik-header-home #mainHeader {
        background: transparent !important;
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    header.oik-header-home #mainHeader > .container-fluid {
        display: none !important;
    }

    header.oik-header-home {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background: transparent;
    }

    body#page-1 {
        padding-top: 0 !important;
    }

    body#page-1 .oik-hero {
        padding-top: calc(var(--oik-header-h) + 12px) !important;
    }
}

/* --- Desktop header scroll: transparent + white nav at top, white bar + navy when scrolled --- */
@media (min-width: 992px) {
    header.navbar-fixed-top #mainHeader,
    header.navbar-fixed-top ul.navbar-nav > li.primary > a.firstLevel,
    header.navbar-fixed-top ul.navbar-nav > li.primary .dropdown > a,
    header.navbar-fixed-top ul.navbar-nav > li.primary .dropdown {
        transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    }

    /* Homepage hero: fully transparent header over hero */
    header.oik-header-home:not(.fixed) #mainHeader {
        background: transparent !important;
        box-shadow: none;
    }

    /* Scrolled: white navbar (replaces legacy blue .fixed background) */
    header.navbar-fixed-top.fixed #mainHeader {
        background: #fff !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }

    /* Scrolled: navy menu + utility links */
    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary > a.firstLevel,
    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary .dropdown > a,
    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary .dropdown {
        color: var(--oik-navy) !important;
    }

    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary > a.firstLevel.active,
    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary > a.firstLevel:hover,
    header.navbar-fixed-top.fixed ul.navbar-nav > li.primary > a.firstLevel:focus {
        color: var(--oik-gold-dark) !important;
        background: none;
    }

    header.navbar-fixed-top.fixed .caret {
        border-top-color: var(--oik-navy);
    }

    /* Homepage logo swap: light logo on hero, dark logo on white bar */
    header.oik-header-home:not(.fixed) .oik-logo-bar {
        display: none !important;
    }

    header.oik-header-home:not(.fixed) .oik-logo-hero {
        display: block !important;
    }

    header.oik-header-home.fixed .oik-logo-hero {
        display: none !important;
    }

    header.oik-header-home.fixed .oik-logo-bar {
        display: block !important;
    }
}

/* --- Fixed navbar: single row, logo left, menus right --- */
header.navbar-fixed-top {
    z-index: 1030;
}

header .navbar-brand {
    float: left !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    width: auto !important;
    height: auto !important;
    text-align: left !important;
    line-height: 1;
    clear: none !important;
}

/* logo.png is wide emblem+wordmark — cap rendered size */
header .navbar-brand img {
    display: block;
    max-height: 48px !important;
    max-width: 220px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

@media (max-width: 767px) {
    header:not(.oik-header-home) .navbar-brand img {
        max-height: 40px !important;
        max-width: 160px !important;
    }
}

@media (min-width: 992px) {
    body#page-1 #mainHeader > .container-fluid {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        min-height: var(--oik-header-h);
    }

    body#page-1 .navbar.navbar-default {
        order: 1;
        flex: 0 0 auto;
    }

    body#page-1 #mainMenu {
        order: 2;
        flex: 1 1 auto;
        float: none !important;
        margin-top: 0 !important;
        text-align: center;
    }

    body#page-1 #secondMenu {
        order: 3;
        flex: 0 0 auto;
        float: none !important;
        margin-top: 0 !important;
    }
}

@media (max-width: 991px) {
    body#page-1 #mainHeader {
        min-height: var(--oik-header-h);
    }

    body#page-1 #mainHeader > .container-fluid {
        position: relative;
        min-height: var(--oik-header-h);
        padding-top: 8px;
    }

    body#page-1 #secondMenu {
        position: absolute;
        top: 8px;
        right: 15px;
        z-index: 2;
        margin-top: 0 !important;
    }

    body#page-1 .navbar.navbar-default {
        position: relative;
        z-index: 1;
        margin-top: 0;
    }

    body#page-1 #mainMenu {
        top: var(--oik-header-h) !important;
    }
}

/* Homepage: full-bleed hero under transparent header; push content below navbar */
body#page-1 {
    padding-top: 0 !important;
    scroll-padding-top: var(--oik-header-h);
}

body#page-1 .oik-hero {
    margin-top: 0 !important;
    padding-top: calc(var(--oik-header-h) + 28px) !important;
    padding-bottom: 50px;
}

/* Search form — full width stacked on mobile (non-Oikosimo search pages) */
.booking-search:not(.oik-booking-search) .row {
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 767px) {
    .booking-search:not(.oik-booking-search) [class*="col-"] {
        width: 100%;
        float: none;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 8px !important;
    }

    .booking-search:not(.oik-booking-search) .form-group {
        margin-bottom: 8px !important;
    }

    .booking-search:not(.oik-booking-search) .input-group {
        width: 100%;
        display: table;
    }

    .booking-search:not(.oik-booking-search) .input-group-addon {
        min-width: 90px;
        white-space: nowrap;
        font-size: 12px;
    }

    .booking-search:not(.oik-booking-search) .form-control,
    .booking-search:not(.oik-booking-search) .btn {
        width: 100%;
        height: 48px;
    }

    .booking-search:not(.oik-booking-search) .btn-primary {
        margin-top: 4px;
        font-size: 14px;
        letter-spacing: 0;
    }

    .oik-search-box {
        overflow: visible;
    }

    #search-page .container {
        padding: 15px;
    }
}

/* Property type grid — responsive wrap, no horizontal scroll */
.oik-type-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 767px) {
    .oik-types .row.oik-type-grid {
        display: flex;
        flex-wrap: wrap;
        overflow-x: visible;
        overflow-y: visible;
        margin-left: -6px;
        margin-right: -6px;
        padding-bottom: 0;
    }

    .oik-types .oik-type-grid > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
        min-width: 0;
        float: none;
        padding-left: 6px;
        padding-right: 6px;
    }
}

/* Homepage search — override legacy theme rules from colors.css / main.css */
.oik-search-box .booking-search {
    padding: 0;
}

.oik-search-box .booking-search [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (min-width: 768px) {
    .oik-booking-search .oik-search-fields {
        display: flex !important;
    }

    .oik-booking-search .oik-search-field {
        width: auto !important;
        float: none !important;
        margin: 0 !important;
    }
}

/* Language switcher codes */
.lang-code {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Language switcher flags (Flagpedia w160 waving, displayed ~20px at 2x) */
.btn-nav .dropdown-toggle img,
.btn-nav .dropdown-menu img,
.dropup .dropdown-toggle img,
.dropup .dropdown-menu img,
.oik-header-pill .dropdown-toggle img,
.oik-header-pill .dropdown-menu img {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 0;
    object-fit: cover;
}

/* PWA install modal */
#oik-pwa-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10500;
    background: rgba(26, 58, 74, 0.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#oik-pwa-modal.oik-pwa-visible {
    display: flex;
}

.oik-pwa-card {
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    padding: 28px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.oik-pwa-card img {
    max-height: 56px;
    margin-bottom: 16px;
}

.oik-pwa-card h3 {
    color: #1a3a4a;
    font-size: 1.3em;
    margin-bottom: 10px;
    text-transform: none;
}

.oik-pwa-card p,
.oik-pwa-body {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 14px;
}

.oik-pwa-body.oik-pwa-manual-hint {
    text-align: left;
    background: #f4f7f9;
    border-radius: 8px;
    padding: 12px 14px;
}

.oik-pwa-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.oik-pwa-actions .btn {
    min-width: 120px;
}

/* About page */
.oik-about h4 {
    text-transform: none;
    font-weight: 700;
    margin-top: 12px;
}

.oik-about .lead {
    font-size: 1.35em;
    color: #1a3a4a;
}

/* --- Mobile: bottom nav only (hide hamburger & header utilities) --- */
@media (max-width: 991px) {
    .navbar-toggle {
        display: none !important;
    }

    #mainMenu {
        display: none !important;
    }

    #secondMenu {
        display: none !important;
    }

    body {
        padding-bottom: calc(var(--oik-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    body#page-1 {
        padding-bottom: calc(var(--oik-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    #toTop {
        bottom: calc(var(--oik-bottom-nav-h) + 12px);
    }

    #booking-cart {
        bottom: calc(var(--oik-bottom-nav-h) + 8px);
    }
}

/* Mobile bottom navigation (global — not only homepage) */
.oik-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: var(--oik-bottom-nav-h);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #e8eaed;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.oik-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #8a939b;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none !important;
    padding: 2px 4px;
    min-width: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
}

.oik-bottom-nav-item i {
    font-size: 18px;
    line-height: 1;
}

.oik-bottom-nav-item.active,
.oik-bottom-nav-item:hover,
.oik-bottom-nav-item:focus {
    color: var(--oik-gold-dark);
    outline: none;
}

/* More menu sheet */
.oik-more-sheet {
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
}

.oik-more-sheet.open {
    visibility: visible;
    pointer-events: auto;
}

.oik-more-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 58, 74, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.oik-more-sheet.open .oik-more-sheet-backdrop {
    opacity: 1;
}

.oik-more-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(70vh, 480px);
    overflow-y: auto;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 0 0 calc(var(--oik-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.25s ease;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.oik-more-sheet.open .oik-more-sheet-panel {
    transform: translateY(0);
}

.oik-more-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e8eaed;
}

.oik-more-sheet-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--oik-navy);
}

.oik-more-sheet-close {
    border: 0;
    background: transparent;
    color: #8a939b;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
}

.oik-more-sheet-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.oik-more-sheet-list li a,
.oik-more-sheet-list li button.oik-more-sheet-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    color: #1a3a4a;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.oik-more-sheet-list li a:hover,
.oik-more-sheet-list li a:focus,
.oik-more-sheet-list li button.oik-more-sheet-link:hover,
.oik-more-sheet-list li button.oik-more-sheet-link:focus {
    background: #f5f6f7;
    color: var(--oik-gold-dark);
}

.oik-more-sheet-list li a i,
.oik-more-sheet-list li button.oik-more-sheet-link i {
    width: 20px;
    text-align: center;
    color: var(--oik-gold-dark);
}

.oik-more-sheet-divider {
    height: 1px;
    background: #e8eaed;
    margin: 4px 20px;
}
