/* ═══════════════════════════════════════════════
   ДАШБОРД ГРОМАДИ — СТИЛІ
   ═══════════════════════════════════════════════ */

:root {
    --gd-primary: #1A3A5C;
    --gd-primary-light: #2B8AC4;
    --gd-accent: #f39c12;
    --gd-bg: #F0F4F8;
    --gd-card: #FFFFFF;
    --gd-text: #2C3E50;
    --gd-muted: #6B7C8D;
    --gd-line: #DEE2E6;
    --gd-radius: 14px;
    --gd-shadow: 0 4px 24px rgba(26,58,92,0.08);
    --gd-shadow-hover: 0 8px 32px rgba(26,58,92,0.14);
    --gd-gap: 20px;
}

[data-theme="dark"] {
    --gd-primary: #5ba3d9;
    --gd-primary-light: #7bbcee;
    --gd-bg: #0f172a;
    --gd-card: #1e293b;
    --gd-text: #e2e8f0;
    --gd-muted: #94a3b8;
    --gd-line: #334155;
    --gd-shadow: 0 4px 24px rgba(0,0,0,0.3);
    --gd-shadow-hover: 0 8px 32px rgba(0,0,0,0.4);
}

.page-content:has(.gr-dashboard) {
    max-width: 100% !important;
    padding: 0 !important;
}

.gr-dashboard {
    background: var(--gd-bg);
    padding: 24px;
    font-family: 'Montserrat', sans-serif;
}

/* ═══ CARDS BASE ═══ */

.gr-card {
    background: var(--gd-card);
    border-radius: var(--gd-radius);
    box-shadow: var(--gd-shadow);
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

.gr-card:hover {
    box-shadow: var(--gd-shadow-hover);
}

.gr-card__header {
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid var(--gd-line);
}

.gr-card__title {
    font-family: 'e-Ukraine', 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--gd-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gr-card__title span {
    color: var(--gd-primary-light);
}

.gr-card__title i {
    font-size: 18px;
    color: var(--gd-primary-light);
}

/* ═══ TOP LAYOUT ═══ */

.gr-top {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--gd-gap);
    margin-bottom: var(--gd-gap);
}

.gr-top__left {
    display: flex;
    flex-direction: column;
    gap: var(--gd-gap);
}

.gr-top__right {
    min-height: 0;
}

.gr-card--timeline {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ═══ MAP ═══ */

.gr-map {
    height: 380px;
    background: #e8f0f8;
}

.gr-map__legend {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    font-size: 12px;
    color: var(--gd-muted);
    border-top: 1px solid var(--gd-line);
}

.gr-map__legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gr-map__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gr-map__dot--center {
    background: #f39c12;
    box-shadow: 0 0 0 3px rgba(243,156,18,0.25);
}

.gr-map__dot--village {
    background: var(--gd-primary-light);
}

.gr-map__dot--event {
    background: #27ae60;
}

/* ═══ CHART ═══ */

.gr-chart-tabs {
    display: flex;
    gap: 6px;
}

.gr-chart-tab {
    padding: 5px 16px;
    border-radius: 20px;
    border: 1px solid var(--gd-line);
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--gd-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.gr-chart-tab--active,
.gr-chart-tab:hover {
    background: var(--gd-primary);
    color: #fff;
    border-color: var(--gd-primary);
}

.gr-chart-wrap {
    padding: 16px 20px 20px;
    height: 260px;
    position: relative;
}

.gr-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ═══ TIMELINE ═══ */

.gr-tl-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--gd-line);
}

.gr-tl-filter {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--gd-line);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--gd-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.gr-tl-filter--active,
.gr-tl-filter:hover {
    background: var(--gd-primary);
    color: #fff;
    border-color: var(--gd-primary);
}

.gr-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 16px 32px;
    position: relative;
    max-height: 560px;
}

.gr-timeline::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gd-line);
}

.gr-tl-item {
    position: relative;
    padding-left: 24px;
    padding-bottom: 20px;
    transition: opacity 0.3s;
}

.gr-tl-item:last-child {
    padding-bottom: 0;
}

.gr-tl-item[data-hidden="true"] {
    display: none;
}

.gr-tl-dot {
    position: absolute;
    left: -12px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px currentColor;
    z-index: 1;
}

.gr-tl-content {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 16px;
    border-left: 3px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.gr-tl-item:hover .gr-tl-content {
    background: #eef4fb;
}

.gr-tl-year {
    font-size: 22px;
    font-weight: 700;
    color: var(--gd-primary);
    line-height: 1.1;
}

.gr-tl-title {
    font-size: 14px;
    color: var(--gd-text);
    margin-top: 4px;
    line-height: 1.4;
}

.gr-tl-desc {
    font-size: 12px;
    color: var(--gd-muted);
    margin-top: 4px;
}

.gr-tl-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    padding: 2px 10px;
    border-radius: 4px;
    margin-top: 8px;
    text-transform: capitalize;
}

/* ═══ STATS ═══ */

.gr-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--gd-gap);
    margin-bottom: var(--gd-gap);
}

.gr-stat {
    background: var(--gd-card);
    border-radius: var(--gd-radius);
    box-shadow: var(--gd-shadow);
    padding: 24px 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.gr-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gd-primary-light), var(--gd-accent));
}

.gr-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--gd-shadow-hover);
}

.gr-stat__icon {
    width: 48px;
    height: 48px;
    background: rgba(43,138,196,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 22px;
    color: var(--gd-primary-light);
}

.gr-stat__number {
    font-size: 32px;
    font-weight: 700;
    color: var(--gd-primary);
    line-height: 1.1;
}

.gr-stat__suffix {
    font-size: 14px;
    font-weight: 600;
    color: var(--gd-primary-light);
    margin-top: 2px;
}

.gr-stat__label {
    font-size: 13px;
    color: var(--gd-muted);
    margin-top: 4px;
}

/* ═══ BOTTOM LAYOUT ═══ */

.gr-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gd-gap);
}

/* ═══ MAYOR ═══ */

.gr-mayor {
    padding: 20px;
    text-align: center;
}

.gr-mayor__photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 12px;
    border: 3px solid var(--gd-line);
}

.gr-mayor__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gr-mayor__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--gd-primary);
    line-height: 1.3;
}

.gr-mayor__pos {
    font-size: 12px;
    color: var(--gd-muted);
    margin-top: 2px;
}

.gr-mayor__contacts {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.gr-mayor__contacts a,
.gr-mayor__contacts span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--gd-text);
    text-decoration: none;
}

.gr-mayor__contacts a:hover {
    color: var(--gd-primary-light);
}

.gr-mayor__contacts i {
    color: var(--gd-primary-light);
    font-size: 14px;
}

.gr-mayor__quote {
    margin: 16px 0 0;
    padding: 12px 16px;
    background: #f8fafc;
    border-left: 3px solid var(--gd-accent);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    font-style: italic;
    color: var(--gd-muted);
    line-height: 1.5;
}

/* ═══ HISTORY ═══ */

.gr-history {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gr-history__item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.gr-history__year {
    flex-shrink: 0;
    background: var(--gd-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    min-width: 55px;
    text-align: center;
    line-height: 1.5;
}

.gr-history__text {
    font-size: 13px;
    color: var(--gd-text);
    line-height: 1.5;
}

/* ═══ LINKS ═══ */

.gr-links {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.gr-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid var(--gd-line);
    transition: all 0.2s;
}

.gr-link:hover {
    border-color: var(--gd-primary-light);
    background: #f0f7ff;
    transform: translateY(-1px);
}

.gr-link__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.gr-link__text {
    font-size: 12px;
    font-weight: 600;
    color: var(--gd-text);
    line-height: 1.3;
}

.gr-link:hover .gr-link__text {
    color: var(--gd-primary);
}

/* ═══ SCROLLBAR ═══ */

.gr-timeline::-webkit-scrollbar {
    width: 5px;
}

.gr-timeline::-webkit-scrollbar-track {
    background: transparent;
}

.gr-timeline::-webkit-scrollbar-thumb {
    background: var(--gd-line);
    border-radius: 3px;
}

.gr-timeline::-webkit-scrollbar-thumb:hover {
    background: var(--gd-muted);
}

/* ═══ LEAFLET OVERRIDES ═══ */

.gr-map .leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.gr-map .leaflet-popup-content {
    margin: 10px 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
}

/* ═══ ANIMATIONS ═══ */

@keyframes grFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gr-stat {
    animation: grFadeUp 0.5s ease both;
}

.gr-stats .gr-stat:nth-child(1) { animation-delay: 0.1s; }
.gr-stats .gr-stat:nth-child(2) { animation-delay: 0.2s; }
.gr-stats .gr-stat:nth-child(3) { animation-delay: 0.3s; }
.gr-stats .gr-stat:nth-child(4) { animation-delay: 0.4s; }

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1100px) {
    .gr-top {
        grid-template-columns: 1fr;
    }
    .gr-card--timeline {
        height: auto;
    }
    .gr-timeline {
        max-height: 400px;
    }
}

@media (max-width: 900px) {
    .gr-bottom {
        grid-template-columns: 1fr;
    }
    .gr-links {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .gr-dashboard {
        padding: 12px;
    }
    .gr-map {
        height: 260px;
    }
    .gr-chart-wrap {
        height: 200px;
    }
    .gr-stat__number {
        font-size: 26px;
    }
    .gr-links {
        grid-template-columns: 1fr;
    }
    .gr-card__title {
        font-size: 13px;
    }
}
