/* ============================================================
 * Modern header overrides for orthomap.ru (2026-05-05)
 * Loads after legacy style.css. Touches ONLY the header chrome,
 * leaves map, infobox, search-results, etc. unchanged.
 * ============================================================ */

/* System font stack for header only */
.header,
.header * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif !important;
}

/* Header bar */
.header {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 10px 20px;
    height: auto;
    min-height: 60px;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}
/* Logo */
.header .logo img {
    height: 32px;
    width: auto;
    display: block;
    margin-right: 16px;
}

/* Top menu */



/* Menu links — clean text buttons */



/* "Добавить объект" — primary CTA */



/* Login button (anonymous state) */




/* Logged-in user block */
.header .user-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #1f2937;
    transition: background-color 0.15s ease;
}

/* Search box — pill-shaped */
.header .search {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px 6px 4px 16px;
    margin-left: auto;
    transition: background-color 0.15s ease;
}

/* Map sizing — old YMaps 1.1 self-sized, v2.1 expects an explicitly sized container.
   Header ~60px (see .header min-height above). */
.map-wrapper {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}
#YMapsID, #googlemap {
    width: 100%;
    height: 100%;
}

/* ============================================================
 * Marker info modal — modern card-style overlay
 * ============================================================ */

/* Backdrop */
.opacity {
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(4px);
}

/* Modal container */
.infobox {
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 0 !important;
    overflow: hidden;
    max-width: 920px !important;
    width: 92vw !important;
    height: auto !important;
    max-height: 88vh !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1f2937;
}
.infobox .content {
    padding: 36px 44px 32px;
    max-height: 88vh;
    overflow-y: auto;
}
.infobox .close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2.2' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='18' y1='6' x2='6' y2='18'/></svg>")
        center / 16px no-repeat;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.15s ease;
}
.infobox .close:hover {
    background-color: #e5e7eb;
}

/* Title */
.infobox h1 {
    font-size: 28px;
    line-height: 1.25;
    font-weight: 600;
    color: #0f172a;
    margin: 0 60px 8px 0;
}
.infobox h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin: 24px 0 12px;
}

/* Coordinates / address subtitle */
.infobox .coord {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
}
.infobox .coord br + * { margin-top: 4px; }

/* Hide dead Yandex Share */
.infobox .yashare { display: none !important; }

/* Tabs — modern underline-active style */
.infobox .tab {
    list-style: none;
    margin: 0 0 0 0;
    padding: 0;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
}
.infobox .tab li {
    padding: 0;
    margin: 0;
}
.infobox .tab li a {
    display: inline-block;
    padding: 12px 16px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transform: translateY(1px);
    transition: color 0.15s ease, border-color 0.15s ease;
}
.infobox .tab li a:hover {
    color: #1f2937;
}
.infobox .tab li.active a {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Tab content */
.infobox .tabcontent {
    padding: 24px 0 0;
    font-size: 15px;
    line-height: 1.65;
    color: #374151;
}
.infobox .tabcontent p {
    margin: 0 0 14px;
}
.infobox .descr {
    max-width: 720px;
}

/* редактировать link — make subtle */
.infobox .edit {
    text-align: right;
    margin-bottom: 12px;
}
.infobox .edit a {
    color: #6b7280;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px dashed #d1d5db;
}
.infobox .edit a:hover {
    color: #1f2937;
    border-bottom-color: #6b7280;
}

/* Photo thumbnail in description */
.infobox .info_img {
    float: right;
    margin: 0 0 16px 24px;
    max-width: 320px;
}
.infobox .info_img img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Photo gallery grid */
.infobox .images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.infobox .images .img img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* Holy items */
.infobox .holy {
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.infobox .holy a {
    color: #2563eb;
    text-decoration: none;
}
.infobox .holy_descr {
    margin-top: 8px;
    color: #6b7280;
    font-size: 13px;
}

/* ============================================================
 * Global typography — Inter from Google Fonts (cyrillic subset)
 * Override legacy Arian AMU / Tahoma everywhere.
 * ============================================================ */
html, body, body *, .infobox, .infobox * {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif !important;
}
body {
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.infobox h1, .infobox h2, .infobox h3 {
    letter-spacing: -0.01em;
}

/* ============================================================
 * Logo and header sizing
 * ============================================================ */
.header { min-height: 64px; }
.map-wrapper { top: 64px !important; }
.right-block { top: 64px !important; height: calc(100% - 64px) !important; }

/* Right-block (search results) — modernize */
.right-block {
    background: #ffffff !important;
    box-shadow: -8px 0 24px -8px rgba(0,0,0,0.12);
}
.right-block .content {
    padding: 20px 24px !important;
}
.right-block .content .search-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    align-items: flex-start;
}
.right-block .content .search-item:last-child { border-bottom: 0; }
.right-block .content .search-item .icon {
    flex-shrink: 0;
    width: 28px;
    height: 32px;
}
.right-block .content .search-item .icon img {
    width: 100%;
    height: auto;
}
.right-block .content .search-item .title a {
    color: #2563eb;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.4;
}
.right-block .content .search-item .title a:hover { text-decoration: underline; }
.right-block .content .search-item .text {
    color: #6b7280;
    font-size: 13px;
    margin-top: 2px;
}
.right-block .content .more {
    text-align: center;
    margin-top: 16px;
}
.right-block .content .more input {
    background: #f3f4f6;
    border: 0;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    color: #1f2937;
}

/* ============================================================
 * Hamburger menu (mobile)
 * ============================================================ */
.header-burger {
    display: none;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}


/* Hide legacy red X close icon — modal close uses the new round SVG button (.infobox .close). */
.infobox .close img { display: none !important; }
.infobox .close { z-index: 20; }

/* Mobile: search goes into the burger dropdown alongside the menu items. */


/* ============================================================
 * Mobile (≤768px): logo + burger only; everything else collapses
 * into the burger dropdown.
 * ============================================================ */

/* Make the inner <a> fill .close so clicks register on the whole button. */
.infobox .close { cursor: pointer; }
.infobox .close a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: transparent;
}


/* ============================================================
 * Fixes 2026-05-06: logo text, mobile menu, dark mode
 * ============================================================ */

/* Force light scheme — keeps header white even when OS is dark. */

/* Logo text replaces the bitmap image. */
.header .logo-text {
    font-family: 'Old Standard TT', 'Times New Roman', serif !important;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.3px;
    line-height: 1;
    white-space: nowrap;
    display: inline-block;
}

/* Always-white header so the dark-mode burger stays visible. */

/* === Mobile improvements === */


/* ============================================================
 * Mobile (≤768px) — clean rewrite without display:contents
 * Uses real flex layout on table elements to avoid Safari quirks.
 * ============================================================ */


/* ============================================================
 * Theme-aware header + fish logo mark (mask-based, single SVG).
 * ============================================================ */

.header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f172a; /* fish + text inherit from here */
}

/* Light theme (default) */
.header { background: #ffffff; }

/* Dark theme — header dark, fish + text + burger become light */
@media (prefers-color-scheme: dark) {
    .header { background: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
    .header .logo { color: #ffffff; }
    .header .logo-text::after { color: #94a3b8; }
    .header-burger span { background: #ffffff; }
    .header-burger:hover { background: rgba(255,255,255,0.1); }
    
    
    .header .search { background: rgba(255,255,255,0.08); }
    .header .search input.input { color: #f3f4f6; }
    .header .search input.input::placeholder { color: #94a3b8; }
    .header .user-info { background: rgba(255,255,255,0.08); color: #e5e7eb; }
    .header .user-info:hover { background: rgba(255,255,255,0.14); }
    .header .user-info .logout-link { color: #94a3b8; }
}


/* ============================================================
 * Header — flex/block layout (replaces legacy <table> markup).
 * ============================================================ */
.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-height: 60px;
    box-sizing: border-box;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
}

/* Theme-aware colours (inherits from .logo theme rules above). */
.header { background: #ffffff; }

/* Mobile: collapse header-nav into the burger dropdown */

/* Force vertical stack inside burger dropdown — wins over any legacy rule. */


/* ============================================================
 * Mobile (≤768px) — clean rules for the new flex/block header.
 * ============================================================ */
@media (max-width: 768px) {
    .header { padding: 10px 14px; gap: 10px; }
    .header-burger { display: flex; margin-left: auto; }

    /* Hide nav until burger toggles */
    .header-nav { display: none; flex: 0 0 100%; }
    body.menu-open .header-nav {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    /* Menu list — vertical stack, full width */
    .header-nav ul.menu {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .header-nav ul.menu li {
        width: 100%;
        margin: 0;
        padding: 0;
        display: block;
    }
    .header-nav ul.menu li > a,
    .header-nav ul.menu li > .user-info {
        display: flex;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 12px 16px;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    /* Search — full-width pill in dropdown */
    .header-nav .search {
        display: flex;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        box-sizing: border-box;
        height: 44px;
    }
    .header-nav .search .wrapper {
        flex: 1;
        display: flex;
        align-items: center;
    }
    .header-nav .search input.input {
        width: 100%;
        text-align: center;
        line-height: 1;
    }

    /* Burger animation */
    body.menu-open .header-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.menu-open .header-burger span:nth-child(2) { opacity: 0; }
    body.menu-open .header-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ============================================================
 * Restore primary button styling for menu items
 * (clean-up earlier removed these along with legacy table rules).
 * ============================================================ */
.header-nav ul.menu a {
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    padding: 9px 14px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-weight: 400;
    background: none;
}

/* Dark theme — adjust hover backgrounds */
@media (prefers-color-scheme: dark) {
    .header-nav ul.menu a { color: #e5e7eb; }
    .header-nav ul.menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
}

/* ============================================================
 * FINAL mobile override — must come last so it wins.
 * ============================================================ */
@media (max-width: 768px) {
    .header-nav ul.menu {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 6px !important;
    }
    .header-nav ul.menu li {
        width: 100% !important;
        display: block !important;
    }
    .header-nav ul.menu li > a {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px 16px !important;
        text-align: center !important;
        justify-content: center !important;
    }
    .header-nav ul.menu li > .user-info {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        justify-content: center !important;
    }
    .header-nav .search {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
    }
}


/* ============================================================
 * Header — clean rewrite 2026-05-06.
 * The new HTML uses .header > .header-logo + .header-burger + .header-nav.
 * Legacy rules in style.css have been removed (no conflicts).
 * ============================================================ */

html { color-scheme: light dark; }

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    min-height: 60px;
    box-sizing: border-box;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
    color: #1f2937;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Logo (link wrapping the SVG fish + text) */
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #0f172a;
    flex-shrink: 0;
}
.header-logo .logo-icon {
    display: inline-block;
    width: 36px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url('/img/fish.svg') no-repeat center / contain;
            mask: url('/img/fish.svg') no-repeat center / contain;
    flex-shrink: 0;
}
.header-logo .logo-text {
    font-family: 'Old Standard TT', serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: inherit;
    white-space: nowrap;
}
.header-logo .logo-text::after {
    content: 'beta';
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    color: #9ca3af;
    margin-left: 4px;
    vertical-align: super;
    letter-spacing: 0.5px;
}

/* Hamburger — hidden on desktop, shown on mobile */
.header-burger {
    display: none;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}
.header-burger:hover { background: rgba(0, 0, 0, 0.05); }
.header-burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Navigation block (menu list + search box) */
.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    justify-content: space-between;
}
.header-nav ul.menu {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.header-nav ul.menu li {
    margin: 0;
    padding: 0;
}
.header-nav ul.menu a {
    display: inline-flex;
    align-items: center;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 9px 14px;
    border-radius: 8px;
    background: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.header-nav ul.menu a:hover {
    background: #f3f4f6;
    color: #1f2937;
}
.header-nav ul.menu a.add_marker {
    background: #2563eb;
    color: #ffffff;
    font-weight: 500;
    padding: 9px 16px;
}
.header-nav ul.menu a.add_marker:hover { background: #1d4ed8; }
.header-nav ul.menu a#login.login {
    background: #4a76a8;
    color: #ffffff;
    font-weight: 500;
}
.header-nav ul.menu a#login.login:hover { background: #3d6593; }
.header-nav ul.menu a#login.login span { color: inherit; }

/* Logged-in user pill */
.header-nav ul.menu .user-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #1f2937;
    transition: background-color 0.15s ease;
}
.header-nav ul.menu .user-info:hover { background: #e5e7eb; }
.header-nav ul.menu .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 0;
}
.header-nav ul.menu .user-info .name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-nav ul.menu .user-info .logout-link {
    color: #6b7280;
    font-size: 13px;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
}
.header-nav ul.menu .user-info .logout-link:hover {
    background: #d1d5db;
    color: #1f2937;
}

/* Search */
.header-nav .search {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px 6px 4px 16px;
    margin-left: auto;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}
.header-nav .search:focus-within { background: #e5e7eb; }
.header-nav .search .wrapper { flex: 1; }
.header-nav .search input.input {
    border: 0;
    background: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    line-height: 1.4;
    padding: 7px 0;
    color: #1f2937;
    min-width: 200px;
}
.header-nav .search input.input::placeholder { color: #9ca3af; }
.header-nav .search input#search_button {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1f2937
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>")
        center / 16px no-repeat;
    color: transparent;
    text-indent: -9999px;
    font-size: 0;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}
.header-nav .search input#search_button:hover { background-color: #000; }

/* ===== Dark theme ===== */
@media (prefers-color-scheme: dark) {
    .header { background: #0f172a; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); color: #e5e7eb; }
    .header-logo { color: #ffffff; }
    .header-logo .logo-text::after { color: #94a3b8; }
    .header-burger:hover { background: rgba(255, 255, 255, 0.1); }
    .header-nav ul.menu a { color: #e5e7eb; }
    .header-nav ul.menu a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
    .header-nav ul.menu .user-info { background: rgba(255, 255, 255, 0.08); color: #e5e7eb; }
    .header-nav ul.menu .user-info:hover { background: rgba(255, 255, 255, 0.14); }
    .header-nav ul.menu .user-info .logout-link { color: #94a3b8; }
    .header-nav ul.menu .user-info .logout-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
    .header-nav .search { background: rgba(255, 255, 255, 0.08); }
    .header-nav .search:focus-within { background: rgba(255, 255, 255, 0.14); }
    .header-nav .search input.input { color: #f3f4f6; }
    .header-nav .search input.input::placeholder { color: #94a3b8; }
}

/* ===== Mobile (≤768px) ===== */
@media (max-width: 768px) {
    .header { padding: 10px 14px; gap: 10px; }
    .header-burger { display: flex; }

    /* Hide nav by default, expand on burger toggle. */
    .header-nav {
        display: none;
        flex: 0 0 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    body.menu-open .header-nav { display: flex; }

    .header-nav ul.menu {
        flex-direction: column;
        width: 100%;
        gap: 6px;
        align-items: stretch;
    }
    .header-nav ul.menu li { width: 100%; }
    .header-nav ul.menu a {
        display: flex;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 16px;
        justify-content: center;
        text-align: center;
    }
    .header-nav ul.menu .user-info {
        width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }

    .header-nav .search {
        width: 100%;
        margin-left: 0;
        box-sizing: border-box;
    }
    .header-nav .search input.input {
        text-align: center;
        min-width: 0;
    }

    body.menu-open .header-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.menu-open .header-burger span:nth-child(2) { opacity: 0; }
    body.menu-open .header-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
