/* ── Indexation Checker — Dark Theme Design System ──────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ──────────────────────────────────────── */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-card-hover: #252839;
    --bg-input: #141622;
    --bg-input-focus: #1a1d2d;

    --border-color: #2a2d3e;
    --border-focus: #5b6eae;

    --text-primary: #e8eaf0;
    --text-secondary: #9ea3b5;
    --text-muted: #6b7089;

    --accent-blue: #5b8def;
    --accent-blue-hover: #7ba5ff;
    --accent-green: #34d399;
    --accent-green-dim: rgba(52, 211, 153, 0.15);
    --accent-red: #f87171;
    --accent-red-dim: rgba(248, 113, 113, 0.15);
    --accent-yellow: #fbbf24;
    --accent-yellow-dim: rgba(251, 191, 36, 0.15);
    --accent-purple: #a78bfa;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition: all 0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-blue-hover);
}

/* ── Layout ─────────────────────────────────────────────── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 450;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(91, 141, 239, 0.12);
    color: var(--accent-blue);
    font-weight: 500;
}

.nav-link .icon {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
    opacity: 0.8;
}

.nav-link.active .icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ── Main Content ───────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 2.5rem;
    max-width: 1400px;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: #3a3d50;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Stat Cards (Dashboard) ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: #3a3d50;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-value.green {
    color: var(--accent-green);
}

.stat-value.red {
    color: var(--accent-red);
}

.stat-value.blue {
    color: var(--accent-blue);
}

/* ── Tables ─────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ── Badges / Status indicators ─────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-indexed {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.badge-not-indexed {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.badge-unknown {
    background: rgba(107, 112, 137, 0.2);
    color: var(--text-muted);
}

.badge-success {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    font-weight: 600;
}

.badge-danger {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    font-weight: 600;
}

.badge-warning {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
    font-weight: 600;
}

.badge-gained {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.badge-lost {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.badge-new {
    background: rgba(91, 141, 239, 0.15);
    color: var(--accent-blue);
}

.badge-unchanged {
    background: rgba(107, 112, 137, 0.15);
    color: var(--text-muted);
}

.badge-running {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
}

.badge-completed {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.badge-failed {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 0 20px rgba(91, 141, 239, 0.3);
    color: white;
}

.btn-success {
    background: var(--accent-green);
    color: #0f1117;
}

.btn-success:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.btn-danger {
    background: transparent;
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: var(--accent-red);
    color: white;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.8rem;
    font-size: 1rem;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(91, 110, 174, 0.15);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.form-inline .form-input {
    flex: 1;
}

/* ── Flash messages ─────────────────────────────────────── */
.flash-messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.flash-msg {
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 450;
    box-shadow: var(--shadow-lg);
    animation: flashIn 0.3s ease-out;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flash-msg.success {
    background: #143a2c;
    border: 1px solid #1a5e3f;
    color: var(--accent-green);
}

.flash-msg.error {
    background: #3a1414;
    border: 1px solid #5e1a1a;
    color: var(--accent-red);
}

.flash-msg.warning {
    background: #3a2e14;
    border: 1px solid #5e4b1a;
    color: var(--accent-yellow);
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Progress Bar ───────────────────────────────────────── */
.progress-container {
    margin: 1rem 0;
}

.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
}

/* ── Login Page ─────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 auto 1rem;
}

.login-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem;
}

/* ── Check Actions ──────────────────────────────────────── */
.check-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.check-panel .check-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 1rem;
    height: 1rem;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.88rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .mobile-menu-btn {
        display: block !important;
    }
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
}

/* ── Utility ────────────────────────────────────────────── */
.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

/* ── Check Session Custom Classes ──────────────────────── */
.session-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.session-progress-title {
    margin: 0;
    flex-grow: 1;
}

.session-progress-counter {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-right: 15px;
}

.session-progress-track {
    background: var(--bg-tertiary, #252839);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
}

.session-progress-bar {
    background: var(--primary, var(--accent-blue));
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.session-actions-footer {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.session-cancel-bottom {
    margin-left: auto;
}

.engine-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.engine-google {
    color: var(--accent-blue);
}

.engine-yandex {
    color: var(--accent-red);
}

.table-status-col {
    text-align: center;
    min-width: 100px;
}

.table-url-link {
    color: var(--text-primary);
    word-break: break-all;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.82rem;
    text-decoration: none;
}

.table-url-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.table-row-waiting {
    text-align: center;
    opacity: 0.4;
    padding: 1.5rem !important;
}

/* Base table animation */
.table tbody tr {
    animation: fadeInRow 0.3s ease forwards;
}

@keyframes fadeInRow {
    0% {
        opacity: 0;
        transform: translateY(4px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.text-green {
    color: var(--accent-green) !important;
}

.text-red {
    color: var(--accent-red) !important;
}

.text-blue {
    color: var(--accent-blue) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 350px;
}

.url-text {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.82rem;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}