/* Файл: style.css (Версия 16.0 – Minimal Pro Teal, fonts +2px + layout fixes) */

/* --- Шрифты и переменные --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-body: #f4f5f7;
    --bg-sidebar: #111827;
    --bg-card: #ffffff;
    --bg-card-soft: #f9fafb;

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #f9fafb;

    --primary: #0d9488;
    /* teal */
    --primary-hover: #0f766e;
    --primary-soft: rgba(13, 148, 136, 0.12);
    --secondary: #2563eb;
    --danger: #dc2626;

    --border-color: #e5e7eb;
    --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 20px 50px rgba(15, 23, 42, 0.16);
    --radius: 12px;
}

/* --- База --- */
* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    display: flex;
    min-height: 100vh;
    font-size: 16px;
    /* было 14px */
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-body);
}

h2 {
    margin-top: 0;
    font-size: 22px;
    /* было 20px */
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
    border-bottom: none;
    padding-bottom: 0;
    letter-spacing: -0.03em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.18s ease;
}

/* --- График --- */
#chart-container {
    height: 360px;
    width: 100%;
    position: relative;
    margin-bottom: 22px;
    padding: 10px 10px 6px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
}

/* --- Сайдбар --- */
.sidebar {
    width: 250px;
    background: #111827;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    z-index: 100;
    box-shadow: 16px 0 40px rgba(15, 23, 42, 0.55);
}

.sidebar-header {
    padding: 22px 20px 18px;
    font-size: 20px;
    /* было 18px */
    font-weight: 600;
    letter-spacing: -0.04em;
    border-bottom: 1px solid #1f2937;
    color: #f9fafb;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-header span {
    font-size: 13px;
    /* было 11px */
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b7280;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 10px 8px;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    color: #9ca3af;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    /* было 13px */
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav-item a:hover {
    background: #1f2937;
    color: #e5e7eb;
    transform: translateX(3px);
}

.nav-item a.active {
    background: #0d9488;
    color: #ecfeff;
}

.nav-item svg {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    opacity: 0.9;
    flex-shrink: 0;
}

/* --- Футер сайдбара --- */
.sidebar-footer {
    padding: 14px 18px 20px;
    border-top: 1px solid #1f2937;
    font-size: 14px;
    color: #9ca3af;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    /* расстояние между ссылками */
}

.sidebar-footer a {
    font-size: 14px;
    color: #9ca3af;
}

.sidebar-footer a:hover {
    color: #e5e7eb;
    text-decoration: underline;
}

/* --- Основной контент --- */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 22px 26px 26px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
}

.content-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
    /* было 13px */
}

/* --- Табы --- */
.tabs {
    display: inline-flex;
    background: #ffffff;
    border-radius: 999px;
    padding: 3px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
    gap: 4px;
    flex-wrap: wrap;
}

.tab-link {
    padding: 7px 14px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    font-size: 15px;
    /* было 13px */
    color: #6b7280;
    border-radius: 999px;
    font-weight: 500;
    transition: all 0.16s ease;
}

.tab-link:hover {
    color: #111827;
    background: #f3f4f6;
}

.tab-link.active {
    background: #0d9488;
    color: #ecfeff;
}

/* --- Карточки --- */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 18px 18px 16px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.h-100 {
    height: 100%;
    margin-bottom: 0;
}

/* --- Grid Layouts --- */
.d-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 6px;
}

.info-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.info-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    flex-shrink: 0;
    background: #ecfeff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.info-card-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.info-card-header h3 {
    margin: 0;
    font-size: 16px;
    /* было 14px */
    font-weight: 600;
    color: #0f172a;
}

.details-text {
    font-size: 14px;
    /* было 12px */
    color: var(--text-muted);
    margin: 2px 0 0;
    line-height: 1.5;
}

.info-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Stat Row --- */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #e5e7eb;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span {
    color: var(--text-muted);
    font-size: 14px;
    /* было 12px */
}

.stat-row strong {
    color: #0f172a;
    font-size: 16px;
    /* было 14px */
    font-weight: 600;
}

/* --- Таблицы --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

th {
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 13px;
    /* было 11px */
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #f9fafb;
}

td {
    padding: 9px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-main);
    font-size: 15px;
    /* было 13px */
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f9fafb;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
}

th[data-sort]:hover {
    color: var(--primary);
}

th[data-sort]::after {
    content: ' ↕';
    opacity: 0.3;
    font-size: 11px;
    /* было 9px */
    margin-left: 4px;
}

th[data-sort].asc::after {
    content: ' ↑';
    opacity: 1;
    color: var(--primary);
}

th[data-sort].desc::after {
    content: ' ↓';
    opacity: 1;
    color: var(--primary);
}

/* --- Формы и кнопки --- */
input,
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    /* было 13px */
    background-color: #ffffff;
    color: var(--text-main);
    transition: border 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.6);
    background: #ffffff;
}

button,
.btn-save-bots,
.country-list-btn {
    padding: 9px 14px;
    border-radius: 999px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.16s ease;
    font-size: 15px;
    /* было 13px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Основная кнопка */
.btn-save-bots,
button[type="submit"],
button[type="button"] {
    background: var(--primary);
    color: #ecfeff;
    box-shadow: 0 10px 24px rgba(13, 148, 136, 0.35);
}

.btn-save-bots:hover,
button[type="submit"]:hover,
button[type="button"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-save-bots:disabled {
    opacity: 0.6;
    cursor: wait;
    box-shadow: none;
}

/* Secondary Button */
.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: none !important;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #fef2f2;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Вторичные */
.btn-copy,
.btn-edit-tag,
.pagination-controls button {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: var(--text-main);
    padding: 6px 11px;
    font-size: 14px;
    /* было 12px */
    border-radius: 999px;
}

.btn-copy:hover,
.btn-edit-tag:hover,
.pagination-controls button:hover {
    background: #f3f4f6;
}

.pagination-controls button.active {
    background: var(--primary);
    color: #ecfeff;
    border-color: transparent;
}

/* --- Login Page --- */
.login-page-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e5e7eb;
}

.login-form {
    background: #ffffff;
    padding: 36px 34px 32px;
    /* больше воздуха */
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 360px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

/* аккуратное выравнивание контента внутри login-form */
.login-form form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form h2 {
    text-align: center;
    border: none;
    color: #0f172a;
    margin-bottom: 10px;
    font-size: 22px;
}

.login-form p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 22px;
    font-size: 15px;
}

/* кнопка по центру формы, не прилипает к низу */
.login-form button[type="submit"],
.login-form .btn-save-bots {
    margin-top: 12px;
    align-self: center;
    min-width: 150px;
}

.error {
    color: #b91c1c;
    font-size: 14px;
    /* было 12px */
    margin-bottom: 12px;
    background: #fee2e2;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid #fecaca;
}

/* --- Views / анимация --- */
.content-view,
.admin-view {
    display: none;
    animation: fadeIn 0.22s ease;
}

.content-view.active,
.admin-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.controls-container label {
    font-weight: 500;
    font-size: 14px;
    /* было 12px */
    color: var(--text-muted);
}

.controls-container select {
    width: auto;
    padding: 6px 10px;
}

/* Code Area */
.code-container {
    position: relative;
    margin-top: 8px;
}

.code-container textarea {
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid #1f2937;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 14px;
    /* было 12px */
    min-height: 110px;
    border-radius: 10px;
}

.code-container .btn-copy {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Status Messages */
.status-message {
    padding: 9px 11px;
    border-radius: 999px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    /* было 12px */
}

.status-ok-msg {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-error-msg {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.close-btn {
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    /* было 16px */
    opacity: 0.7;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    background: #e5e7eb;
    border-radius: 999px;
    height: 7px;
    margin-top: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    transition: width 0.4s ease;
    background: linear-gradient(90deg, #0d9488, #2563eb);
}

/* Badges */
.status-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 13px;
    /* было 11px */
    font-weight: 600;
}

.status-badge.ok {
    background: #ecfdf3;
    color: #15803d;
}

.status-badge.error {
    background: #fef2f2;
    color: #b91c1c;
}

/* GeoIP Log */
.update-log-container {
    background: #0f172a;
    color: #e5e7eb;
    padding: 10px 11px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 13px;
    /* было 11px */
    max-height: 280px;
    overflow-y: auto;
    margin-top: 8px;
    border: 1px solid #1f2937;
}

/* Filters UI */
.filter-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.country-list-box {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    height: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.country-list-box h3 {
    margin: 0;
    padding: 9px 11px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    /* было 11px */
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.country-search {
    width: calc(100% - 20px) !important;
    margin: 9px 10px !important;
}

.country-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.country-list li {
    padding: 7px 10px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    /* было 12px */
}

.country-list li:hover {
    background: #f9fafb;
}

.country-list-btn {
    padding: 3px 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 17px;
    /* было 15px */
}

.country-list-btn:hover {
    background: #f3f4f6;
    color: var(--text-main);
}

.country-list-btn.btn-add {
    color: var(--primary);
}

.country-list-btn.btn-remove {
    color: var(--danger);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #ffffff;
    margin: 12% auto;
    padding: 20px 20px 18px;
    width: 90%;
    max-width: 420px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid #e5e7eb;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 20px;
    /* было 18px */
    color: var(--text-muted);
    cursor: pointer;
}

.modal-content input {
    margin-bottom: 14px;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(249, 250, 251, 0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loading-overlay p {
    margin-top: 10px;
    font-size: 15px;
    /* было 13px */
    color: var(--text-muted);
}

/* Адаптив */
@media (max-width: 960px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
        width: calc(100% - 220px);
        padding: 18px 18px 22px;
    }

    .d-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }
}