/* === Siam Theatre World — Модерация === */

:root {
    --primary: #6c3483;
    --primary-light: #8e44ad;
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f39c12;
    --info: #2980b9;
    --muted: #95a5a6;
    --bg: #f5f6fa;
    --card-bg: #fff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dcdde1;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* === Навигация === */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.nav-brand { font-size: 1.2rem; font-weight: 700; }

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-links a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: background .2s;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,.15);
    color: white;
}

.nav-logout { opacity: .7; }

/* === Контейнер === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

h1 { margin-bottom: 1.5rem; color: var(--primary); }
h2 { margin-bottom: 1rem; color: var(--text); font-size: 1.2rem; }

/* === Статистика === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-top: 3px solid var(--muted);
}

.stat-pending { border-top-color: var(--warning); }
.stat-new { border-top-color: #bdc3c7; }
.stat-approved { border-top-color: var(--info); }
.stat-scheduled { border-top-color: var(--primary-light); }
.stat-published { border-top-color: var(--success); }
.stat-rejected { border-top-color: var(--danger); }

.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label { color: var(--text-light); font-size: 0.85rem; }
.stat-link { display: inline-block; margin-top: .5rem; color: var(--primary); text-decoration: none; font-size: .85rem; }

/* === Кнопки === */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .2s, transform .1s;
    color: white;
    font-weight: 500;
}

.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--primary); }
.btn-secondary { background: var(--info); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-block { width: 100%; }

/* === Формы === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .3rem; font-weight: 500; font-size: .9rem; }

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}

.form-select { max-width: 150px; }
textarea.form-control { resize: vertical; font-family: inherit; }

.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}

.inline-form .form-control { width: auto; min-width: 200px; }

/* === Таблицы === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.data-table th {
    background: var(--bg);
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: .85rem;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.data-table tr:last-child td { border-bottom: none; }

.row-disabled { opacity: .5; }
.actions-cell { white-space: nowrap; }

/* === Бейджи === */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.badge-success { background: var(--success); }
.badge-error { background: var(--danger); }
.badge-muted { background: var(--muted); }
.badge-pending { background: var(--warning); }
.badge-new { background: #bdc3c7; }
.badge-approved { background: var(--info); }
.badge-scheduled { background: var(--primary-light); }
.badge-published { background: var(--success); }
.badge-rejected { background: var(--danger); }
.badge-failed { background: #e74c3c; }
.badge-lg { padding: .3rem .8rem; font-size: .85rem; }

/* === Карточки статей === */
.articles-list { display: flex; flex-direction: column; gap: 1rem; }

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: .5rem;
}

.article-header h3 { font-size: 1rem; }
.article-header h3 a { color: var(--text); text-decoration: none; }
.article-header h3 a:hover { color: var(--primary); }

.article-meta {
    display: flex;
    gap: 1.2rem;
    color: var(--text-light);
    font-size: .8rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}

.article-summary {
    color: var(--text);
    font-size: .9rem;
    margin-bottom: .75rem;
}

.article-actions { display: flex; gap: .5rem; }

/* === Детали статьи === */
.breadcrumb { margin-bottom: 1rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }

.article-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.article-meta-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.article-meta-detail div { margin-bottom: .3rem; }
.article-meta-detail a { color: var(--primary); }

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.text-block {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
    font-size: .85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.moderation-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.published-info {
    background: #eafaf1;
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 1rem;
}

/* === Ключевые слова === */
.keywords-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.keyword-card {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 0.5rem 0.3rem 1rem;
}

.keyword-disabled { opacity: .4; }
.keyword-word { font-size: .9rem; }
.keyword-actions { display: flex; gap: .2rem; }

/* === Утилиты === */
.section { margin-bottom: 2rem; }

.filter-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.result-count {
    color: var(--text-light);
    font-size: .85rem;
    margin-bottom: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem 1rem;
}

.ai-info {
    color: var(--text-light);
    font-size: .85rem;
    margin-bottom: .75rem;
}
.ai-info code {
    background: var(--bg);
    padding: .1rem .4rem;
    border-radius: 4px;
    font-size: .8rem;
}

.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid var(--danger); }

/* === Вход === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    text-align: center;
}

.login-card h1 { margin-bottom: .5rem; font-size: 1.5rem; }
.login-subtitle { color: var(--text-light); margin-bottom: 1.5rem; }

/* === Панель задач === */
.task-panel {
    margin-bottom: 2rem;
}

.task-card-active {
    background: var(--card-bg);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}

.task-name { font-weight: 600; font-size: 1.05rem; }

.task-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.task-progress-text {
    font-weight: 500;
    color: var(--primary);
}

.task-duration {
    color: var(--text-light);
    font-size: .85rem;
}

.task-log {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--radius);
    padding: .75rem 1rem;
    max-height: 250px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: .8rem;
    line-height: 1.6;
}

.task-log .log-line {
    white-space: pre-wrap;
    word-break: break-word;
}

/* === Кнопки disabled === */
.btn:disabled, .btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Адаптивность === */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; flex-wrap: wrap; height: auto; padding: .5rem 1rem; }
    .nav-links { gap: .25rem; flex-wrap: wrap; }
    .container { padding: 1rem; }
    .two-columns { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .inline-form { flex-direction: column; }
    .inline-form .form-control { width: 100%; min-width: auto; }
}
