/* =====================================================================
   School Museum — main stylesheet
   Style: "Modern school" — light gray background, blue #1565c0,
          orange accent #ff6f00, Poppins font, rounded cards.
   ===================================================================== */

:root {
    --color-bg:        #f4f6fa;
    --color-surface:   #ffffff;
    --color-surface-2: #fafbfc;
    --color-border:    #e3e8ef;
    --color-text:      #1a2540;
    --color-muted:     #5a6478;
    --color-primary:   #1565c0;
    --color-primary-dark: #0d47a1;
    --color-primary-light: #e3f2fd;
    --color-accent:    #ff6f00;
    --color-accent-dark: #e65100;
    --color-success:   #2e7d32;
    --color-warning:   #ed6c02;
    --color-danger:    #c62828;
    --color-info:      #0288d1;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow:    0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --radius:    14px;
    --radius-sm: 8px;
    --radius-lg: 22px;
    --max-width: 1200px;
    --header-h:  92px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: 'Poppins', -apple-system, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }
img, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; color: var(--color-text); margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }

p { margin: 0 0 1em; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section-sm { padding: 24px 0; }
.text-center { text-align: center; }
.muted { color: var(--color-muted); }
.small { font-size: 0.875rem; }

/* ===== Header ====================================================== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .container {
    display: flex;
    align-items: center;
    height: var(--header-h);
    gap: 24px;
}
.brand {
    display: flex;
    align-items: stretch;
    gap: 12px;
    color: var(--color-text);
    text-decoration: none;
    flex: none;
}
.brand:hover { text-decoration: none; color: var(--color-text); }
.brand-logo {
    align-self: stretch;
    height: auto;
    width: auto;
    max-width: 64px;
    object-fit: contain;
    flex: none;
}
.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
}
.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.1;
}
.brand-school {
    font-size: 0.78rem;
    color: var(--color-primary);
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.2;
    margin-top: 1px;
}
.brand-sub {
    font-size: 0.68rem;
    color: var(--color-muted);
    font-weight: 400;
    margin-top: 1px;
    line-height: 1.25;
    max-width: 280px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Header actions now pushed to the right (main nav removed) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Hamburger menu button (replaces Вход button) */
.hamburger-menu {
    position: relative;
}
.hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.hamburger-btn:hover,
.hamburger-menu:hover .hamburger-btn,
.hamburger-menu:focus-within .hamburger-btn {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}
/* Invisible bridge for hover continuity (same as Экспозиции dropdown) */
.hamburger-menu::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px;
}
/* Hamburger dropdown — opens to the LEFT (right-aligned).
   Use .dropdown-menu.hamburger-dropdown (two classes) to override
   the base .dropdown-menu { left: 0 } with higher specificity.
   Also override overflow to visible — the Экспозиции submenu opens
   to the LEFT beyond this dropdown's bounds and must not be clipped. */
.dropdown-menu.hamburger-dropdown {
    right: 0;
    left: auto;
    min-width: 280px;
    overflow: visible;
    max-height: none;
}
.dropdown-menu.hamburger-dropdown::before {
    left: auto;
    right: 12px;
}
/* Hamburger auth link removed — navigation only */

/* Submenu inside the hamburger (Экспозиции → tree) */
.has-submenu {
    position: relative;
}
.has-submenu > a .caret-right {
    font-size: 0.75em;
    opacity: 0.6;
    margin-left: 4px;
    transition: transform .15s ease;
    display: inline-block;
}
.has-submenu:hover > a .caret-right,
.has-submenu:focus-within > a .caret-right {
    transform: rotate(90deg);
    opacity: 1;
}
/* Bridge for hover continuity between item and submenu */
.has-submenu::after {
    content: "";
    position: absolute;
    top: 0;
    right: 100%;
    width: 10px;
    height: 100%;
}
/* Submenu opens to the LEFT (hamburger is on the right side of the page) */
.has-submenu > .submenu {
    display: none;
    position: absolute;
    right: calc(100% + 8px);
    top: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 380px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 101;
    padding: 8px;
}
.has-submenu:hover > .submenu,
.has-submenu:focus-within > .submenu {
    display: block;
}

.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}
.main-nav a:hover { background: var(--color-primary-light); color: var(--color-primary-dark); text-decoration: none; }
.main-nav a.active { background: var(--color-primary); color: #fff; }

/* Nav dropdown (Экспозиции) */
.nav-dropdown {
    position: relative;
}
/* Invisible bridge filling the gap between button and menu,
   so moving the cursor from button to menu doesn't lose :hover */
.nav-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    /* transparent — no background, no border */
}
.nav-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.nav-dropdown > a .caret {
    font-size: 0.7em;
    opacity: 0.7;
    transition: transform .15s ease;
}
.nav-dropdown:hover > a .caret,
.nav-dropdown:focus-within > a .caret {
    transform: rotate(180deg);
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 380px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
    padding: 8px;
}
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    border-top: 1px solid var(--color-border);
    transform: rotate(45deg);
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    display: block;
}
.dropdown-tree {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative; /* above the ::before triangle */
}
.dropdown-tree ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    /* Children are indented via padding on <a>, not on <ul>,
       so the hover highlight spans full width */
}
.dropdown-tree li {
    margin: 0;
}
.dropdown-tree a {
    display: block;
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.92rem;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.dropdown-tree a:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    text-decoration: none;
}
/* Indent children by depth */
.dropdown-tree .depth-1 > a { padding-left: 28px; font-weight: 400; }
.dropdown-tree .depth-2 > a { padding-left: 42px; font-weight: 400; font-size: 0.88rem; }
.dropdown-tree .depth-3 > a { padding-left: 56px; font-weight: 400; font-size: 0.86rem; }
.dropdown-tree .depth-0 > a { font-weight: 600; }

/* Add a small left border to children for visual hierarchy */
.dropdown-tree ul li > a {
    border-left: 2px solid transparent;
}
.dropdown-tree ul li > a:hover {
    border-left-color: var(--color-primary);
}

/* .header-actions is now defined earlier in the file (margin-left: auto) */

.search-form { display: flex; align-items: center; }
.search-form input {
    border: 1px solid var(--color-border);
    background: var(--color-surface-2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    width: 200px;
    outline: none;
    transition: border-color .15s, width .15s;
}
.search-form input:focus { border-color: var(--color-primary); width: 240px; background: #fff; }

/* ===== Buttons ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--color-primary);
    color: #fff;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s;
    font-family: inherit;
    line-height: 1.2;
}
.btn:hover { background: var(--color-primary-dark); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-2); color: var(--color-text); }
.btn-accent { background: var(--color-accent); }
.btn-accent:hover { background: var(--color-accent-dark); color: #fff; }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #b71c1c; color: #fff; }
.btn-ghost { background: transparent; color: var(--color-text); border-color: transparent; }
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn-lg { padding: 12px 24px; font-size: 1.05rem; }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== Badges ====================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}
.badge-warning { background: #fff4e5; color: var(--color-accent-dark); }
.badge-success { background: #e8f5e9; color: var(--color-success); }
.badge-danger  { background: #fdecea; color: var(--color-danger); }
.badge-muted   { background: #f1f3f6; color: var(--color-muted); }
.badge-draft   { background: #fff4e5; color: var(--color-accent-dark); border: 1px dashed var(--color-accent); }
.badge-published { background: #e8f5e9; color: var(--color-success); }

/* Editing-in-progress indicator */
.editing-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    background: #fff4e5;
    color: var(--color-accent-dark);
    border: 1px solid #ffd591;
    font-size: 0.8rem;
    font-weight: 500;
}
.editing-badge::before {
    content: "";
    width: 8px; height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 111, 0, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 111, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 111, 0, 0); }
}

/* ===== Hero ======================================================== */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    padding: 72px 0 88px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,111,0,0.25), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.12), transparent 60%);
    pointer-events: none;
}
.hero .container { position: relative; }
.hero-school {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}
.hero-logo {
    width: 64px; height: 64px;
    object-fit: contain;
    flex: none;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 6px;
}
.hero-school-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.hero-school-city {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
}
.hero h1 { color: #fff; font-size: 2.6rem; margin-bottom: 12px; }
.hero p  { font-size: 1.15rem; opacity: 0.92; max-width: 640px; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero .btn-accent { box-shadow: 0 6px 18px rgba(255,111,0,0.4); }
.hero .btn-secondary { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.25); }
.hero .btn-secondary:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* ===== Cards (exhibits) =========================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
}
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    color: var(--color-text);
}
.card-thumb {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #e3e8ef, #f1f3f6);
    overflow: hidden;
    position: relative;
}
.card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .25s ease;
}
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb .media-type-icon {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    display: flex; align-items: center; gap: 4px;
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 1.05rem; font-weight: 600; line-height: 1.3; margin: 0; }
.card-summary { color: var(--color-muted); font-size: 0.88rem; line-height: 1.45; margin: 0;
                display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--color-muted); margin-top: auto; padding-top: 6px; }
.card-meta span { display: inline-flex; align-items: center; gap: 3px; }

/* ===== Exposition tree ============================================ */
.tree {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tree ul {
    list-style: none;
    padding-left: 28px;
    margin: 8px 0 0;
    border-left: 2px dashed var(--color-border);
}
.tree li { position: relative; padding: 8px 0; }
.tree .expo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: border-color .15s, transform .1s;
}
.tree .expo-row:hover { border-color: var(--color-primary); transform: translateX(2px); }
.tree .expo-icon {
    width: 36px; height: 36px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex: none;
    font-size: 1rem;
}
.tree .expo-meta { flex: 1; min-width: 0; }
.tree .expo-title { font-weight: 600; font-size: 1.02rem; margin: 0; }
.tree .expo-desc { font-size: 0.85rem; color: var(--color-muted); margin: 2px 0 0;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .expo-stats { display: flex; gap: 14px; font-size: 0.8rem; color: var(--color-muted); }

/* ===== Exhibit page =============================================== */
.breadcrumb {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 16px 0;
    font-size: 0.88rem;
    color: var(--color-muted);
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { color: var(--color-border); }

.exhibit-page { padding: 16px 0 48px; }
.exhibit-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 32px;
}
@media (max-width: 880px) {
    .exhibit-layout { grid-template-columns: 1fr; }
}
.exhibit-media {
    background: #1a1a1a;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 4 / 3;
}
.exhibit-media-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.exhibit-media img, .exhibit-media video {
    width: 100%; height: 100%; object-fit: contain;
    background: #0f0f0f;
}
.exhibit-info { padding-top: 4px; }
.exhibit-info h1 { margin-bottom: 8px; }
.exhibit-meta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.exhibit-meta-row .meta-item {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--color-surface);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    min-width: 110px;
}
.exhibit-meta-row .meta-label { font-size: 0.7rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.exhibit-meta-row .meta-value { font-weight: 600; font-size: 0.95rem; }

.exhibit-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; align-items: center; }
.like-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all .15s;
}
.like-btn:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }
.like-btn.liked { background: #fff4e5; border-color: var(--color-accent); color: var(--color-accent-dark); }
.like-btn .heart { font-size: 1.1rem; }
.views-counter { color: var(--color-muted); font-size: 0.88rem; display: inline-flex; gap: 4px; align-items: center; }

.exhibit-description { line-height: 1.7; font-size: 1.02rem; }

/* ===== Comments ==================================================== */
.comments { margin-top: 32px; }
.comment-list { display: flex; flex-direction: column; gap: 16px; margin: 20px 0; }
.comment {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.comment-author { font-weight: 600; font-size: 0.95rem; }
.comment-date { color: var(--color-muted); font-size: 0.8rem; margin-left: 8px; }
.comment-body { margin-top: 6px; line-height: 1.55; }

.comment-form {
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    margin-top: 16px;
}
.comment-form .form-row { margin-bottom: 12px; }
.comment-form textarea { width: 100%; min-height: 90px; resize: vertical; }

/* ===== Forms ====================================================== */
.form-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    max-width: 720px;
}
.form-row { margin-bottom: 18px; }
.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.92rem;
}
.form-row .hint { font-size: 0.8rem; color: var(--color-muted); margin-top: 4px; }
.form-row .error-text { color: var(--color-danger); font-size: 0.85rem; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"],
input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
textarea { min-height: 110px; resize: vertical; }
.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row-inline { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--color-primary);
}

.form-actions {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    margin-top: 24px;
}

/* ===== Tables ===================================================== */
.table-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
table.data th, table.data td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
table.data th {
    background: var(--color-surface-2);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--color-surface-2); }

/* ===== Dashboard layout =========================================== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - var(--header-h));
}
.sidebar {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 16px 12px;
}
.sidebar h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    margin: 18px 12px 8px;
}
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.92rem;
    margin-bottom: 2px;
}
.sidebar .nav-link:hover { background: var(--color-primary-light); color: var(--color-primary-dark); text-decoration: none; }
.sidebar .nav-link.active { background: var(--color-primary); color: #fff; }
.sidebar .nav-link .count {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
}
.sidebar .nav-link:not(.active) .count {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.dashboard-main { padding: 28px 32px 60px; min-width: 0; }
.dashboard-main h1 { font-size: 1.6rem; margin-bottom: 4px; }
.dashboard-main .page-subtitle { color: var(--color-muted); margin-bottom: 24px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    line-height: 1.1;
}
.stat-card .stat-sub { font-size: 0.78rem; color: var(--color-muted); margin-top: 4px; }

/* ===== Map ======================================================== */
.map-container {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 12px;
    box-shadow: var(--shadow);
}
.map-canvas {
    position: relative;
    background: linear-gradient(135deg, #fafbfc, #eef1f6);
    border-radius: var(--radius-sm);
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-image:
        linear-gradient(rgba(21,101,192,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(21,101,192,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}
.map-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    cursor: pointer;
    z-index: 2;
}
.map-pin .pin-icon {
    width: 32px; height: 32px;
    background: var(--color-accent);
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 12px rgba(255,111,0,0.4);
    transition: transform .15s;
}
.map-pin:hover .pin-icon { transform: rotate(-45deg) scale(1.15); }
.map-pin .pin-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--color-text);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.map-pin:hover .pin-label { opacity: 1; }

/* ===== Flash messages ============================================= */
.flash {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.92rem;
    border-left: 4px solid;
}
.flash-success { background: #e8f5e9; color: var(--color-success); border-color: var(--color-success); }
.flash-error   { background: #fdecea; color: var(--color-danger);  border-color: var(--color-danger); }
.flash-info    { background: #e3f2fd; color: var(--color-info);    border-color: var(--color-info); }
.flash-warning { background: #fff4e5; color: var(--color-accent-dark); border-color: var(--color-accent); }
.flash pre { white-space: pre-wrap; margin: 4px 0 0; font-family: 'Courier New', monospace; }

/* ===== Footer ===================================================== */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 32px 0;
    margin-top: 60px;
    color: var(--color-muted);
    font-size: 0.88rem;
}
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--color-muted); }
.site-footer a:hover { color: var(--color-primary); }

/* ===== Auth page ================================================== */
.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 36px;
    max-width: 420px;
    margin: 60px auto;
    border: 1px solid var(--color-border);
}
.auth-card h1 { font-size: 1.45rem; text-align: center; margin-bottom: 8px; }
.auth-card .auth-sub { text-align: center; color: var(--color-muted); margin-bottom: 24px; }

/* ===== Maintenance page =========================================== */
.maintenance-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: #fff;
    text-align: center;
    padding: 24px;
}
.maintenance-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 48px 56px;
    max-width: 540px;
    border: 1px solid rgba(255,255,255,0.15);
}
.maintenance-card h1 { color: #fff; font-size: 2rem; margin-bottom: 12px; }
.maintenance-card p  { color: rgba(255,255,255,0.85); margin-bottom: 6px; }
.maintenance-icon {
    width: 72px; height: 72px;
    background: rgba(255,111,0,0.25);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
}

/* ===== Pagination ================================================= */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 24px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.9rem;
}
.pagination a:hover { background: var(--color-primary-light); color: var(--color-primary-dark); text-decoration: none; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ===== Responsive header ========================================== */
@media (max-width: 880px) {
    .main-nav { display: none; }
    .search-form input { width: 140px; }
    .search-form input:focus { width: 180px; }
    .container { padding: 0 16px; }
    .hero { padding: 48px 0 64px; }
    .hero h1 { font-size: 2rem; }
    .dashboard-layout { grid-template-columns: 1fr; }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        display: flex;
        overflow-x: auto;
        padding: 8px;
    }
    .sidebar h3 { display: none; }
    .sidebar .nav-link { white-space: nowrap; }
    .dashboard-main { padding: 20px 16px 40px; }
    /* Hide tagline on mobile — header is too crowded */
    .header-tagline { display: none; }
}

/* Mobile nav toggle (simple version) */
.mobile-menu-btn { display: none; }
@media (max-width: 880px) {
    .mobile-menu-btn {
        display: inline-flex;
        background: transparent; border: 0;
        cursor: pointer; padding: 8px;
        color: var(--color-text);
    }
    .main-nav.open {
        display: flex;
        position: absolute;
        top: var(--header-h); left: 0; right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: 12px;
    }
}

/* ===== Utility classes =========================================== */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* «О проекте» button + modal */
.about-project-btn {
    white-space: nowrap;
}
.about-project-modal {
    border: none;
    border-radius: var(--radius);
    padding: 0;
    background: transparent;
    max-width: 560px;
    width: calc(100vw - 32px);
    color: var(--color-text);
}
.about-project-modal::backdrop {
    background: rgba(26, 37, 64, 0.45);
    backdrop-filter: blur(4px);
}
.about-project-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 32px 28px 28px;
    box-shadow: 0 20px 60px rgba(13, 71, 161, 0.18);
}
.about-project-content h2 {
    margin: 0 0 16px;
    color: var(--color-primary-dark);
    font-size: 1.4rem;
}
.about-project-content p {
    margin: 0 0 14px;
    line-height: 1.6;
    font-size: 0.95rem;
}
.about-project-content p strong {
    color: var(--color-primary-dark);
}
.about-project-note {
    margin-top: 20px !important;
    padding: 14px 16px;
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
    font-weight: 500;
    color: var(--color-primary-dark);
}
.about-project-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.about-project-close:hover {
    background: var(--color-surface-2);
    color: var(--color-danger);
}
@media (max-width: 640px) {
    .about-project-content { padding: 28px 18px 20px; }
}
