/*
Theme Name: MacroRussia MVP
Author: AI Assistant
Description: Макроэкономические показатели России (MVP)
Version: 2.5 (Table Layout Fix + Bento/Gutenberg Preserved)
*/

:root {
  --primary: #0B74D1;
  --primary-soft: #E5F1FF;
  --text-dark: #1F2933;
  --text-muted: #6B7280;
  --border: #E0E4EA;
  --bg: #F3F5F8;
  --card-bg: #FFFFFF;
}

* { box-sizing:border-box; }

body { 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; 
  margin:0; padding:0; 
  background:var(--bg); 
  color:var(--text-dark);
  font-size: 14px; 
  display: flex; flex-direction: column; min-height: 100vh;
}

h1 { font-size: 26px; font-weight: 700; margin: 0 0 12px 0; color: var(--text-dark); }
h2 { font-size: 20px; font-weight: 600; margin: 24px 0 16px 0; color: var(--text-dark); }
h3 { font-size: 16px; font-weight: 600; margin: 0; color: var(--text-dark); }

a { text-decoration: none; color: inherit; transition: 0.2s; }

/* HEADER */
header {
  background:var(--card-bg); height: 60px; padding: 0 40px;
  display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--border); position:sticky; top:0; z-index:10;
}
.container-header {
    width: 92%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { font-size:20px; font-weight:700; color:var(--text-dark); letter-spacing:0.4px; }
nav a { margin-left:24px; color:var(--text-muted); font-size:14px; font-weight: 500; }
nav a:hover { color:var(--primary); }

.container { width:92%; max-width:1280px; margin:28px auto 60px auto; flex: 1; }

.top-row { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:28px; }
.top-text p { margin:0; color:var(--text-muted); font-size:14px; }

/* BUTTONS */
.categories { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:24px; }
.cat-btn, .range-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: #ffffff; color: var(--text-dark); font-size: 12px; cursor: pointer; transition: all 0.2s ease; user-select: none;
}
.cat-btn:hover, .range-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.cat-btn.cat-active, .range-btn.active { background: var(--primary); border-color: var(--primary); color: #ffffff; box-shadow: 0 2px 4px rgba(11, 116, 209, 0.2); }
.range-switch { display: flex; gap: 6px; }

/* TILES */
.two-col { display:grid; grid-template-columns:2fr 1.3fr; gap:22px; align-items:flex-start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.top-metrics { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:18px; margin-bottom:40px; }
.top-card {
  background:var(--card-bg); padding: 18px 20px; border-radius:14px; border:1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03); display: block; transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.top-card:hover { transform:translateY(-2px); border-color: #c5d4f0; box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
.top-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.top-card h3 { margin:0; font-size:16px; font-weight:600; color: var(--text-dark); }
.tag { font-size:11px; padding:2px 8px; border-radius:999px; background:var(--primary-soft); color:var(--primary); font-weight: 500; }
.value { font-size:26px; font-weight:700; margin:4px 0 4px 0; letter-spacing: -0.5px; color: var(--text-dark); }
.value-trend { font-size:12px; font-weight: 500; color:#059669; }
.value-trend.down { color:#b91c1c; }
.date { font-size:12px; color:var(--text-muted); margin-top:12px; }

.updates-list { background:var(--card-bg); padding:18px; border-radius:14px; border:1px solid var(--border); }
.update-item { display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid #f2f4f7; font-size:14px; }
.update-item:last-child { border-bottom:none; }
.update-item:hover .update-title { color: var(--primary); }
.update-title { font-weight:500; color: var(--text-dark); }
.update-date { color:var(--text-muted); font-size:13px; }

/* --- ARCHIVE LIST (5 COLUMNS UPDATE) --- */
.indicator-list-container {
  display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.list-row {
  display: grid; 
  /* ИЗМЕНЕНО: 5 колонок для выноса единиц измерения */
  grid-template-columns: 2fr 1.2fr 0.8fr 0.5fr 1fr; 
  align-items: center; padding: 14px 20px;
  border-bottom: 1px solid #f2f4f7; transition: background 0.1s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f9fafb; }
.list-row-header { background: #f9fafb; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.list-title { font-weight: 600; font-size: 14px; color: var(--primary); }
.list-cat { font-size: 12px; color: var(--text-muted); }
.list-val { font-weight: 500; font-size: 14px; text-align: right; color: var(--text-dark); }
/* НОВОЕ: Колонка единиц */
.list-unit { font-size: 12px; color: var(--text-muted); padding-left: 8px; }
.list-date { font-size: 12px; color: var(--text-muted); text-align: right; }

@media(max-width: 600px) {
    .list-row { 
        /* Мобильная сетка: Title | Value | Unit */
        grid-template-columns: 1fr auto auto; 
        gap: 10px; 
    }
    .list-row-header { display: none; }
    .list-cat { display: none; }
    .list-date { display: none; } /* Скрываем дату на очень узких экранах для чистоты */
    .list-val { text-align: right; }
    .list-unit { padding-left: 4px; }
}

/* INDICATOR PAGE */
.indicator-hero { margin-bottom: 24px; }
.indicator-hero h1 { font-size: 26px; margin: 0 0 10px 0; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.meta-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.meta-badge strong { color: var(--text-dark); font-weight: 600; }
.main-stat-row { display: flex; align-items: baseline; gap: 12px; }
.main-val { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1; color: var(--text-dark); }
.trend-pill { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.trend-pill.up { background: #d1fae5; color: #065f46; }
.trend-pill.down { background: #fee2e2; color: #991b1b; }
.trend-pill.neutral { background: #f3f4f6; color: #374151; }

.chart-block { background:var(--card-bg); border-radius:16px; border:1px solid var(--border); padding: 20px; margin-bottom:24px; min-height: 380px; }
.chart-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }

/* TABLES */
.bottom-grid { display:grid; grid-template-columns:2fr 1.2fr; gap:22px; align-items:flex-start; }
@media(max-width: 768px) { .bottom-grid { grid-template-columns: 1fr; } }
.data-card, .info-card { background:var(--card-bg); border-radius:14px; border:1px solid var(--border); padding:18px 20px; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { padding:8px 6px; text-align:left; border-bottom: 1px solid #f2f4f7; }
thead tr { border-bottom: 1px solid var(--border); }
th { font-weight:500; color:var(--text-muted); font-size:12px; text-transform: uppercase; padding-top: 0; padding-bottom: 12px; }
td { color: var(--text-dark); }
tr:last-child td { border-bottom: none; }
td strong { font-weight: 500; }

/* FOOTER */
footer { background: #111827; color: #d1d5db; padding: 18px 40px; margin-top:auto; border-top: 1px solid #1f2937; }
.footer-inner { width:92%; max-width:1280px; margin:0 auto; display:flex; flex-wrap:wrap; gap:24px; justify-content:space-between; }
.footer-title { font-weight:600; margin-bottom:8px; color:#fff; font-size:12px; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-links a { display:block; color:#9ca3af; text-decoration:none; margin-bottom:4px; font-size:12px; }
.footer-links a:hover { color:#fff; }

/* WP CONTENT (About page) */
.page-content { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 30px; margin-bottom: 40px; }
.page-content h1 { margin-top: 0; }
.page-content ul { padding-left: 20px; }
.page-content li { margin-bottom: 6px; }

/* --- GUTENBERG FIXES --- */
.page-content ul, 
.page-content ol { 
    padding-left: 20px; 
    margin-bottom: 16px; 
}
.page-content li {
    margin-bottom: 6px;
}
.wp-block-columns {
    display: flex;
    gap: 2em;
    margin-bottom: 1.5em;
}
.wp-block-columns .wp-block-column {
    flex-grow: 1;
}
@media (max-width: 781px) {
    .wp-block-columns { flex-direction: column; }
    .wp-block-columns .wp-block-column { flex-basis: 100% !important; }
}
.wp-block-button__link {
    text-decoration: none;
}
.is-style-outline .wp-block-button__link {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
}
.is-style-outline .wp-block-button__link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* --- BENTO GRID STYLES --- */
.page-content:has(.bento-grid-wrapper) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.bento-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.bento-card > *:last-child {
    margin-bottom: 0;
}
.bento-card h1, 
.bento-card h2 {
    margin-top: 0;
    margin-bottom: 16px;
}
.bento-card ul {
    padding-left: 20px;
    margin-bottom: 16px;
}
.bento-card li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.disclaimer-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}