/* ═══════════════════════════════════════════════
   СЕОНАНИСТ — Design System
   Premium dark theme with accent colors
   ═══════════════════════════════════════════════ */

:root {
    /* Palette */
    --bg-primary:   #0a0e17;
    --bg-secondary: #111827;
    --bg-card:      #1a2236;
    --bg-card-hover:#1f2b42;
    --bg-input:     #0f1623;

    --text-primary:   #e8ecf4;
    --text-secondary: #8b95a8;
    --text-muted:     #5a6477;

    --accent:       #6366f1;
    --accent-glow:  rgba(99, 102, 241, 0.25);
    --accent-light: #818cf8;

    --green:   #22c55e;
    --green-bg:rgba(34,197,94,0.12);
    --yellow:  #eab308;
    --yellow-bg:rgba(234,179,8,0.12);
    --red:     #ef4444;
    --red-bg:  rgba(239,68,68,0.12);

    --border:  #1e293b;
    --border-glow: rgba(99,102,241,0.3);

    --radius:  12px;
    --radius-sm:8px;
    --radius-xs:6px;

    --shadow: 0 4px 24px rgba(0,0,0,0.35);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ──── LIMITS BAR (Always visible top) ──── */
.limits-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #0f1629 0%, #151d33 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.limits-bar__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.limits-bar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.limits-bar__logo {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.limits-bar__title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, var(--accent-light), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.limits-bar__cards {
    display: flex;
    gap: 12px;
    flex: 1;
    overflow-x: auto;
}

.limit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: var(--transition);
}

.limit-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.limit-card--accent {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99,102,241,0.08) 100%);
    min-width: 180px;
}

.limit-card__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.limit-card__value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.limit-card__bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.limit-card__bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--green);
    transition: width 0.6s ease, background 0.4s ease;
    width: 0%;
}

.limit-card__bar-fill.warn {
    background: var(--yellow);
}

.limit-card__bar-fill.danger {
    background: var(--red);
}

.limits-bar__refresh {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.limits-bar__refresh:hover {
    color: var(--accent-light);
    border-color: var(--accent);
    transform: rotate(90deg);
}

/* ──── CONTAINER ──── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ──── SECTION ──── */
.section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.section__header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border);
}

.section__title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    flex-shrink: 0;
}

.section__desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 6px;
}

.section__body {
    padding: 24px 28px;
}

/* ──── INPUT ──── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    line-height: 1.7;
    resize: vertical;
    transition: var(--transition);
}

.input-textarea::placeholder {
    color: var(--text-muted);
}

.input-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ──── BUTTONS ──── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99,102,241,0.45);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn--accent {
    background: var(--accent);
    color: white;
}

.btn--accent:hover {
    background: var(--accent-light);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.btn--sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.btn__icon {
    font-size: 1.1em;
}

/* ──── RESULTS PANEL ──── */
.results-panel {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.results-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.results-panel__title {
    font-size: 0.95rem;
    font-weight: 600;
}

.results-panel__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ──── TABLE ──── */
.table-wrap {
    max-height: 500px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(30,41,59,0.5);
    transition: var(--transition);
}

.data-table tbody tr:hover td {
    background: var(--bg-card-hover);
}

.col-check { width: 40px; text-align: center; }
.col-num   { width: 50px; color: var(--text-muted); }
.col-freq  { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.col-phrase { min-width: 200px; }

.col-freq { font-weight: 600; }

.freq-zero { color: var(--text-muted); }
.freq-low  { color: var(--yellow); }
.freq-mid  { color: var(--text-primary); }
.freq-high { color: var(--green); }

/* ──── JOB STATUS ──── */
.job-status {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin-bottom: 16px;
}

.job-status__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.job-status__name {
    font-weight: 600;
    font-size: 0.95rem;
}

.job-status__badge {
    padding: 4px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge--pending  { background: var(--yellow-bg); color: var(--yellow); }
.badge--running  { background: rgba(99,102,241,0.15); color: var(--accent-light); }
.badge--done     { background: var(--green-bg); color: var(--green); }
.badge--error    { background: var(--red-bg); color: var(--red); }

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-bar__text {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.job-status__stats {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.job-status__stats b {
    color: var(--text-primary);
}

/* ──── LOG PANEL ──── */
.log-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    max-height: 160px;
    overflow-y: auto;
    margin-bottom: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.8;
}

.log-panel__content {
    padding: 10px 14px;
    color: var(--text-muted);
}

.log-panel__content .log-info  { color: var(--text-secondary); }
.log-panel__content .log-ok    { color: var(--green); }
.log-panel__content .log-warn  { color: var(--yellow); }
.log-panel__content .log-error { color: var(--red); }

/* ──── FOOTER ──── */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ──── SCROLLBAR ──── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ──── SPINNER ──── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ──── RESPONSIVE ──── */
@media (max-width: 768px) {
    .limits-bar__inner {
        flex-wrap: wrap;
        padding: 10px 16px;
    }
    .limits-bar__cards {
        gap: 8px;
    }
    .limit-card {
        min-width: 100px;
        padding: 6px 10px;
    }
    .limit-card__value {
        font-size: 1rem;
    }
    .container {
        padding: 16px;
    }
    .section__body {
        padding: 16px;
    }
    .results-panel__header {
        flex-direction: column;
        align-items: flex-start;
    }
}
