/* Base styles */
:root {
    --primary: var(--ds-link);
    --primary-dark: var(--ds-link);
    --accent: var(--ds-accent);
    --accent-light: var(--ds-accent-hover);
    --success: var(--ds-success);
    --warning: var(--ds-warning);
    --text: var(--ds-text);
    --text-light: var(--ds-text-muted);
    --bg: var(--ds-bg);
    --white: var(--ds-surface);
    --black: var(--ds-text);
    --dark: var(--ds-text);
    --gray: var(--ds-text);
    --light-gray: var(--ds-text-muted);
    --border: var(--ds-divider);
    --shadow: var(--ds-shadow-pop);
    --shadow-lg: var(--ds-shadow-pop);
    --radius: var(--ds-radius-control);
    --radius-lg: var(--ds-radius-card);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* Hero section for page title */
.hero {
    background: var(--ds-surface);
    color: var(--ds-text);
    padding: 32px 0;
    text-align: center;
    border-bottom: 1px solid var(--ds-divider);
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.hero-logo {
    height: 60px;
    width: auto;
    flex-shrink: 0;
}

.hero-text {
    text-align: left;
}

.hero h1 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.hero .subtitle {
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    color: var(--light-gray);
    opacity: 1;
}

/* Search */
.search-container {
    margin-bottom: 24px;
}

.search-input-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 48px 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: 2px solid var(--ds-focus);
    border-color: var(--ds-link);
    box-shadow: none;
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.search-stats {
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Table - Desktop */
.table-container {
    display: none;
    overflow-x: hidden;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--ds-divider);
}

.restrictions-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.restrictions-table th,
.restrictions-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.restrictions-table th {
    background: var(--ds-surface);
    color: var(--ds-text);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sticky table header clone (desktop only) */
.sticky-thead-clone {
    position: fixed;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    pointer-events: none;
    overflow: hidden;
}

.sticky-thead-clone.visible {
    display: block;
}

.sticky-thead-clone .restrictions-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.sticky-thead-clone th {
    background: var(--ds-surface);
    color: var(--ds-text);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.restrictions-table th:first-child {
    border-radius: var(--radius-lg) 0 0 0;
}

.restrictions-table th:last-child {
    border-radius: 0 var(--radius-lg) 0 0;
}

.restrictions-table tbody tr:hover {
    background-color: var(--ds-bg);
}

.restrictions-table tbody tr.no-data {
    color: var(--text-light);
    font-style: italic;
}

.restrictions-table tbody tr.no-data td {
    opacity: 0.7;
}

/* Document links */
.document-link {
    color: var(--ds-link);
    text-decoration: none;
}

.document-link:hover {
    text-decoration: underline;
    color: var(--ds-link);
}

.card-document a {
    color: var(--ds-link);
    text-decoration: none;
}

.card-document a:hover {
    text-decoration: underline;
    color: var(--ds-link);
}

/* Notes links */
.notes-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
}

.notes-link:hover {
    text-decoration: underline;
    color: var(--primary);
}

/* Expected dates */
.pending {
    color: var(--warning);
    font-style: italic;
}

.expected {
    color: var(--text-light);
    font-style: italic;
    display: block;
    white-space: nowrap;
}

.expected::before {
    content: "Ожидается";
    display: block;
}

.expected-dates {
    display: block;
}

/* Not published document */
.not-published {
    color: var(--text-light);
    font-style: italic;
}

/* Previous season summary */
.date-note {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 0.8125rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.prev-year-summary {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 0.8125rem;
    font-style: normal;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.prev-year-summary a {
    color: var(--ds-link);
    text-decoration: none;
}

.prev-year-summary a:hover {
    text-decoration: underline;
}

/* City sub-rows - indented style */
.restrictions-table tbody tr.city-row {
    background-color: var(--ds-bg);
}

.restrictions-table tbody tr.city-row td:first-child {
    padding-left: 36px;
}

.restrictions-table tbody tr.city-row .region-code {
    background: var(--ds-bg);
    font-size: 0.75rem;
    color: var(--ds-text);
}

.restrictions-table tbody tr.hidden {
    display: none;
}

/* Column widths */
.col-region { min-width: 0; white-space: normal; }
.col-dates { min-width: 0; overflow-wrap: anywhere; }
.col-restrictions { min-width: 0; }
.col-document { min-width: 0; max-width: 300px; overflow-wrap: anywhere; }
.col-subscribe {
    width: auto;
    min-width: 0;
    max-width: none;
    text-align: center;
    white-space: normal;
}

/* Region cell */
.region-code {
    display: inline-block;
    background: var(--ds-highlight);
    color: var(--ds-link);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.875rem;
    margin-right: 8px;
    flex-shrink: 0;
}

.region-name {
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
}

.col-region {
    white-space: normal;
    min-width: 0;
}

/* 769–1023 px: сжимаем колонки, чтобы таблица помещалась без боковой прокрутки */
@media (max-width: 1023px) {
    .col-region { min-width: 0; white-space: normal; }
    .col-dates { min-width: 0; }
    .col-document { min-width: 0; }
}

/* Map icon */
.map-icon-link {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    transition: transform 0.2s;
    vertical-align: middle;
}

.map-icon-link:hover {
    transform: scale(1.1);
}

.map-icon {
    width: 24px;
    height: 24px;
}

.map-icon path {
    fill: var(--ds-link);
}

.map-icon-link:hover .map-icon path {
    fill: var(--ds-link);
}

/* Subscription buttons */
.subscribe-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ds-link);
    border-radius: var(--ds-radius-control);
    background: var(--ds-accent);
    color: var(--ds-on-accent);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
    border-color: var(--ds-accent);
}

.subscribe-button:hover {
    border-color: var(--ds-accent-hover);
    background: var(--ds-accent-hover);
    color: var(--ds-on-accent);
    text-decoration: none;
}

.subscribe-button:focus-visible {
    outline: 2px solid var(--ds-focus);
    outline-offset: 2px;
}

.subscribe-button--hero {
    margin-top: 14px;
    padding: 10px 18px;
    font-size: 0.9375rem;
}

.subscribe-button--region {
    max-width: 100%;
    padding: 6px 8px;
    font-size: 0.75rem;
    white-space: normal;
}

/* Status indicators */
.status-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    vertical-align: middle;
}

.status-ok {
    color: var(--success);
}

.status-pending {
    color: var(--warning);
}

/* Document cell */
.document-text {
    font-size: 0.875rem;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cards - Mobile */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.region-card {
    background: var(--white);
    border-radius: var(--ds-radius-card);
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--ds-divider);
}

.region-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.region-card.no-data {
    border-left: 4px solid var(--warning);
}

/* Приглушаем содержимое, но не кнопку подписки: opacity родителя дочерний элемент не отменит */
.region-card.no-data .card-header,
.region-card.no-data .card-row,
.region-card.no-data .card-document,
.region-card.no-data .card-notes {
    opacity: 0.7;
}

.region-card.has-data {
    border-left: 4px solid var(--success);
}

.region-card.hidden {
    display: none;
}

/* City cards - indented style */
.region-card.city-card {
    margin-left: 10px;
    margin-right: 10px;
    background: var(--ds-bg);
    border-left-width: 3px;
}

.region-card.city-card .card-code {
    background: var(--ds-bg);
    font-size: 0.75rem;
    color: var(--ds-text);
}

.card-header {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-bottom: 12px;
}

.card-code {
    background: var(--ds-highlight);
    color: var(--ds-link);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.875rem;
    margin-right: 12px;
}

.card-region-name {
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-header .map-icon-link {
    margin-left: 0;
    margin-right: 8px;
}

.card-status {
    font-size: 1.25rem;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.card-row {
    display: flex;
    flex-wrap: wrap;
}

.card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
    width: 100%;
    margin-bottom: 2px;
}

.card-value {
    font-size: 0.9375rem;
    color: var(--text);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.card-value.pending {
    color: var(--warning);
    font-style: italic;
}

.card-document {
    font-size: 0.8125rem;
    color: var(--text-light);
    line-height: 1.4;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.card-document a {
    color: var(--primary);
    text-decoration: none;
}

.card-document a:hover {
    text-decoration: underline;
}

.card-notes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.card-notes .card-value {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    margin-top: 4px;
}

.card-notes a {
    color: var(--text-light);
    text-decoration: none;
}

.card-notes a:hover {
    text-decoration: underline;
    color: var(--primary);
}

/* Legal & Info sections */
.legal-section,
.info-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 32px;
    border: 1px solid var(--ds-divider);
}

.legal-section h2,
.info-section h2 {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.info-section h3 {
    font-size: 1rem;
    color: var(--dark);
    margin: 20px 0 8px;
}

.info-section h3:first-of-type {
    margin-top: 0;
}

.legal-section p,
.info-section p {
    margin-bottom: 12px;
    color: var(--text);
}

.info-section ul {
    margin: 8px 0 16px 24px;
}

.info-section li {
    margin-bottom: 4px;
}

@media (max-width: 640px) {


    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-text {
        text-align: center;
    }

    .ktg1-footer__bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* Desktop breakpoint */
@media (min-width: 769px) {
    .container {
        padding: 24px;
    }

    /* Sticky header */
    .ktg1-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .table-container {
        display: block;
        overflow-x: hidden;
        border: 1px solid var(--ds-divider);
    }

    .table-container {
        display: block;
        overflow-x: hidden;
        border: 1px solid var(--ds-divider);
    }

    .cards-container {
        display: none;
    }

    .search-container {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .search-input-wrapper {
        flex: 0 1 500px;
    }

    .search-stats {
        margin-top: 0;
        white-space: nowrap;
    }

    .legal-section,
    .info-section {
        padding: 32px;
    }

    .legal-section h2,
    .info-section h2 {
        font-size: 1.5rem;
    }

    .info-section h3 {
        font-size: 1.125rem;
    }
}

/* Large desktop */
@media (min-width: 1024px) {
    .restrictions-table th,
    .restrictions-table td {
        padding: 16px 20px;
    }
}

/* Accessibility - Visually hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Breadcrumb navigation */
.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--ds-link);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb li:last-child span {
    color: var(--text-light);
}

/* Mark/highlight styling */
mark {
    background: var(--ds-highlight);
    padding: 0 4px;
    border-radius: 2px;
    color: var(--ds-text);
}

/* Definition term styling */
dfn {
    font-style: normal;
    font-weight: 700;
}

/* Print styles */
@media print {
    .search-container,
    .legal-section,
    .info-section,
    .ktg1-footer {
        display: none;
    }

    .table-container {
        display: block !important;
        box-shadow: none;
        overflow-x: hidden;
        border: 1px solid var(--ds-divider);
    }

    .cards-container {
        display: none !important;
    }

    .restrictions-table th {
        background: var(--ds-surface);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color: var(--ds-text);
    }
}
