/* ═══════════════════════════════════════════════
   NOVIKOV SEO AGENTS — Стили
   Цвета школы: #E2554B (красный), #F5A623 (оранжевый),
                #27282D (тёмный), #F8F6F4 (тёплый белый)
   Шрифты: Playfair Display (заголовки), Inter (текст)
   ═══════════════════════════════════════════════ */

:root {
    --red:        #E2554B;
    --red-dark:   #C14039;
    --red-light:  #FAE9E8;
    --orange:     #F5A623;
    --orange-light: #FEF6E7;
    --dark:       #27282D;
    --dark-60:    rgba(39,40,45,0.6);
    --dark-10:    rgba(39,40,45,0.08);
    --white:      #FFFFFF;
    --bg:         #F8F6F4;
    --bg-card:    #FFFFFF;
    --border:     #E8E4E0;
    --text:       #27282D;
    --text-muted: #8C8883;
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-pill: 26px;
    --shadow-sm:  0 1px 4px rgba(39,40,45,0.08);
    --shadow-md:  0 4px 16px rgba(39,40,45,0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
}

/* ── Навигация ── */
.navbar {
    background: var(--dark);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 12px rgba(39,40,45,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: var(--white);
    text-decoration: none;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.nav-brand a span {
    color: var(--orange);
}

.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-links a {
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.18s;
    letter-spacing: 0.1px;
}
.nav-links a:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-links a.active {
    color: var(--white);
    font-weight: 600;
    background: rgba(226,85,75,0.28);
    border-bottom: 2px solid var(--red);
}
.nav-logout {
    color: rgba(255,255,255,0.45) !important;
    margin-left: 8px;
    border: 1px solid rgba(255,255,255,0.15);
}
.nav-logout:hover {
    background: rgba(255,255,255,0.08) !important;
    color: rgba(255,255,255,0.7) !important;
}

/* ── Контейнер ── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ── Заголовки страниц ── */
.page-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 22px;
    letter-spacing: -0.3px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Кнопки ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
}
.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(226,85,75,0.35); }
.btn-primary:disabled { background: #C4BCBA; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-outline { background: white; color: var(--dark); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-link { background: none; color: var(--red); padding: 8px 4px; border-radius: 0; }
.btn-link:hover { text-decoration: underline; color: var(--red-dark); }

.btn-sm { padding: 5px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-google { background: #4285F4; color: white; }
.btn-google:hover { background: #3367d6; }

/* ── Карточки агентов ── */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.agent-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}
.agent-card:hover { box-shadow: var(--shadow-md); }

.agent-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg) 0%, var(--white) 100%);
}

.agent-num {
    width: 38px;
    height: 38px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(226,85,75,0.4);
}

.agent-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    letter-spacing: -0.1px;
}
.agent-header p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.agent-body { padding: 16px 20px; min-height: 60px; }
.agent-info { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--bg); }
.agent-info:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }

.agent-actions {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg);
}

/* ── Статус ── */
.status-badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.status-idle { background: var(--dark-10); color: var(--text-muted); }
.status-running { background: var(--orange-light); color: #8A5A00; animation: pulse 1.5s infinite; }
.status-done { background: #E6F4EA; color: #1D6B35; }
.status-error { background: var(--red-light); color: #8B1C17; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* ── Таблицы ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.data-table thead th {
    background: var(--dark);
    color: rgba(255,255,255,0.9);
    padding: 11px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.data-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

.col-check { width: 40px; text-align: center; }
.url-cell { color: var(--red); font-family: monospace; font-size: 12px; }
.meta-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-id { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.files-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.issues-cell { color: var(--red-dark); font-size: 12px; }

/* ── Бейджи ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    background: var(--dark-10);
    letter-spacing: 0.2px;
}
.badge-high { background: var(--red-light); color: #8B1C17; }
.badge-medium { background: var(--orange-light); color: #8A5A00; }
.badge-low { background: #E6F4EA; color: #1D6B35; }
.badge-ready { background: #E6F4EA; color: #1D6B35; }
.badge-needs_review { background: var(--orange-light); color: #8A5A00; }

/* ── SEO Score ── */
.seo-score {
    display: inline-block;
    width: 42px;
    text-align: center;
    padding: 4px 0;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
}
.score-green { background: #E6F4EA; color: #1D6B35; }
.score-yellow { background: var(--orange-light); color: #8A5A00; }
.score-red { background: var(--red-light); color: #8B1C17; }

/* ── Вкладки ── */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab {
    padding: 10px 22px;
    border: none;
    background: none;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    transition: all 0.18s;
    font-weight: 400;
}
.tab.active {
    color: var(--red);
    border-bottom-color: var(--red);
    font-weight: 600;
}
.tab:hover { color: var(--dark); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Панель одобрения ── */
.approval-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: sticky;
    top: 68px;
    z-index: 10;
}
.approval-info { display: flex; align-items: center; gap: 12px; }

/* ── Детали ТЗ ── */
.details-row td { background: var(--bg); }
.brief-details { padding: 14px 0; }
.detail-section { margin-bottom: 16px; }
.detail-section h4 {
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.h2-item { padding: 2px 0 2px 16px; font-weight: 600; font-size: 13px; }
.h3-item { padding: 2px 0 2px 32px; font-size: 12px; color: var(--text-muted); }
.faq-item { padding: 2px 0 2px 16px; font-size: 13px; }
.copywriter-notes { font-style: italic; color: var(--text-muted); font-size: 13px; }

/* ── Теги ключей ── */
.keyword-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.keyword-tag {
    background: var(--red-light);
    color: var(--red-dark);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
}

/* ── Тренды ── */
.trends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.trend-card {
    background: white;
    padding: 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}
.trend-card:hover { box-shadow: var(--shadow-md); }
.trend-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.trend-keywords { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.trend-action {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--red-light);
    border-left: 3px solid var(--red);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    color: var(--red-dark);
}

.serp-keyword { margin: 16px 0 8px; color: var(--red); font-weight: 600; }
.serp-table { margin-bottom: 20px; }
.competitor-row { background: var(--orange-light) !important; }

/* ── Пустое состояние ── */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}
.empty-state h2 { margin-bottom: 10px; color: var(--dark); font-family: 'Playfair Display', Georgia, serif; }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* ── Справка ── */
.help-section {
    background: white;
    padding: 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.help-section h3 {
    color: var(--dark);
    margin-bottom: 12px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
}
.help-section ol { padding-left: 20px; }
.help-section li { margin-bottom: 8px; font-size: 14px; }

/* ── Алерты ── */
.alert {
    padding: 13px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}
.alert-error { background: var(--red-light); color: #8B1C17; border-color: var(--red); }
.alert-success { background: #E6F4EA; color: #1D6B35; border-color: #34A853; }
.alert-info { background: var(--orange-light); color: #8A5A00; border-color: var(--orange); }

.muted { color: var(--text-muted); font-style: italic; }

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    background-image: radial-gradient(circle at 25% 40%, rgba(226,85,75,0.15) 0%, transparent 50%),
                      radial-gradient(circle at 75% 70%, rgba(245,166,35,0.1) 0%, transparent 50%);
}
.login-card {
    background: white;
    padding: 48px 40px;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 380px;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 4px;
}
.login-logo p { font-size: 13px; color: var(--text-muted); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--dark); margin-bottom: 6px; }
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.18s;
    outline: none;
}
.form-group input:focus { border-color: var(--red); }

/* ── DataTables override ── */
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: border-color 0.18s;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--red); }
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-family: 'Inter', sans-serif;
}
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after { opacity: 0.7; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: white !important;
    border-radius: var(--radius-pill) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--dark) !important;
}
.dataTables_wrapper .dataTables_info { font-size: 13px; color: var(--text-muted); }

/* ── Секции аналитики ── */
.analytics-section {
    background: white;
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.analytics-section h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

/* ── Статистика — metric карточки ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.metric-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    text-align: center;
}
.metric-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}
.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.metric-card.accent .metric-value { color: var(--red); }
.metric-card.accent-orange .metric-value { color: var(--orange); }

/* ── Action plan ── */
.action-list { list-style: none; counter-reset: action-counter; }
.action-list li {
    counter-increment: action-counter;
    display: flex;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.5;
    align-items: flex-start;
}
.action-list li:last-child { border-bottom: none; }
.action-list li::before {
    content: counter(action-counter);
    min-width: 26px;
    height: 26px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Section headings ── */
.section-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    color: var(--dark);
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.section-heading.red { border-color: var(--red); color: var(--red-dark); }
.section-heading.green { border-color: #34A853; color: #1D6B35; }
.section-heading.orange { border-color: var(--orange); color: #8A5A00; }

/* ── Реклама — кампании ── */
.campaign-state-active { color: #1D6B35; font-weight: 600; }
.campaign-state-suspended { color: var(--text-muted); }
.campaign-state-archived { color: var(--text-muted); font-style: italic; }

/* ── Респонсив ── */
@media (max-width: 900px) {
    .agents-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .navbar { padding: 0 16px; }
    .container { padding: 16px; }
    .metrics-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab { white-space: nowrap; }
    .nav-brand a { font-size: 15px; }
    .nav-links { gap: 0; }
    .nav-links a { padding: 7px 10px; font-size: 13px; }
}
