/* TC DROP SEARCH - Premium Dark Theme v2.0 */
/* Modern glassmorphism with Lime Accent #AFE507 */

:root {
    --primary: #AFE507;
    --primary-dark: #8FB806;
    --primary-light: #C9F53A;
    --primary-glow: rgba(175, 229, 7, 0.4);
    --primary-subtle: rgba(175, 229, 7, 0.08);

    --bg-dark: #0A0A0B;
    --bg-page: #0D0E10;
    --bg-card: rgba(18, 19, 22, 0.85);
    --bg-card-solid: #121316;
    --bg-card-hover: rgba(26, 27, 32, 0.95);
    --bg-input: #161719;
    --bg-modal: rgba(16, 17, 20, 0.98);
    --bg-glass: rgba(20, 21, 25, 0.75);

    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --text-dark: #374151;

    --border: rgba(55, 65, 81, 0.5);
    --border-light: rgba(75, 85, 99, 0.4);
    --border-focus: rgba(175, 229, 7, 0.5);

    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3B82F6;
    --info-bg: rgba(59, 130, 246, 0.12);

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(175, 229, 7, 0.15);

    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 400ms ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-input);
}

html {
    scroll-behavior: smooth;
    scrollbar-color: var(--primary) var(--bg-input);
}

/* Салатовые скроллбары по всему сайту (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}
*::-webkit-scrollbar-thumb:active {
    background: var(--primary-dark);
}
*::-webkit-scrollbar-corner {
    background: var(--bg-input);
}

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text-primary);
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 32 32'%3E%3Cpath fill='%230E0F12' stroke='%23AFE507' stroke-width='1.2' stroke-linejoin='round' d='M 0,0 L 0,26 L 10,26 L 10,16 L 26,30 L 30,28 L 16,14 L 26,14 L 26,0 Z'/%3E%3C/svg%3E") 0 0, auto;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============ LAYOUT ============ */

.app {
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(175, 229, 7, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(59, 130, 246, 0.02) 0%, transparent 50%),
        var(--bg-page);
}

/* ============ SIDEBAR ============ */

.sidebar {
    width: 280px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, var(--primary-glow), transparent, var(--primary-glow));
    opacity: 0.3;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(175, 229, 7, 0.3);
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #FFFFFF;
}

.logo-text span {
    color: var(--primary);
}

/* Navigation */
.nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-subtle);
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.nav-icon {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #000;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* User info in sidebar */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #000;
    font-size: 14px;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ MAIN CONTENT ============ */

.main {
    flex: 1;
    margin-left: 280px;
    padding: 32px 40px;
    min-height: 100vh;
}

/* ============ HEADER ============ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 20px;
}

.header-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #9CA3AF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============ PAGES ============ */

.page {
    display: none;
    animation: fadeIn var(--transition) ease;
}

.page.active {
    display: block;
}

/* Страница «Домены»: карточка и область таблицы занимают высоту, скролл только внутри таблицы */
#page-domains.page.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px);
}
#page-domains .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#page-domains .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#page-domains .domains-table-scroll {
    flex: 1;
    min-height: 320px;
}

/* Пагинация доменов — компактный вид */
#pagination {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
#pagination .btn {
    min-width: 36px;
}
#pagination .pagination-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 14px;
    user-select: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ STATS GRID ============ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-icon.primary {
    background: var(--primary-subtle);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -1px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* ============ CARDS ============ */

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* Тулбар: поиск + кнопка «Закрепить». Липкий при закреплении. */
.domains-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 4px;
    position: sticky;
    top: 0;
    z-index: 12;
    background: var(--bg-card);
    box-shadow: 0 2px 0 var(--border);
}
.domains-table-scroll.domains-pin-off .domains-toolbar {
    position: relative;
    top: auto;
    box-shadow: none;
}

.domains-search-bar {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.domains-search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}
.domains-search-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.domains-search-bar:focus-within .domains-search-label {
    color: var(--primary);
}
.domains-search-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 12px 0 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}
.domains-search-input::placeholder {
    color: var(--text-muted);
}
.domains-search-input:focus {
    outline: none;
}
.domains-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 6px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.domains-search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.btn-domains-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}
.btn-domains-pin:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
}
.btn-domains-pin.active {
    color: var(--primary);
}
.btn-domains-pin i {
    font-size: 14px;
}

.filter-favorite-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    user-select: none;
}
.filter-favorite-label:hover,
.filter-favorite-label input:checked + i {
    color: var(--primary);
}
.filter-favorite-label input { margin: 0; }

.header-fav i { font-size: 22px; }

.fav-on { color: var(--primary) !important; }
.fav-off { color: var(--text-muted); }

.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.bulk-actions-bar #bulk-count { font-weight: 700; color: var(--primary); }

/* Пресеты — выпадающий список */
.presets-dropdown-wrap { position: relative; }
.presets-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 280px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 100;
    padding: 12px;
}
.presets-create-title { font-weight: 600; margin-bottom: 10px; font-size: 13px; }
.presets-create-name { width: 100%; padding: 8px 10px; margin-bottom: 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); font-size: 14px; }
.presets-create-label { display: block; font-size: 11px; color: var(--text-muted); margin: 10px 0 6px; text-transform: uppercase; }
.presets-create-select { width: 100%; margin-bottom: 6px; font-size: 13px; }
.presets-create-input { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); flex: 1; min-width: 0; }
.presets-create-row-2 { display: flex; gap: 8px; margin-bottom: 8px; }
.presets-create-row-2 input { width: 50%; }
.presets-create-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; cursor: pointer; }
.presets-create-columns { max-height: 140px; overflow-y: auto; margin-bottom: 10px; padding: 6px 0; }
.presets-create-columns label { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.presets-create-btn { width: 100%; margin-top: 4px; }
.presets-choose-label { font-size: 11px; color: var(--text-muted); margin: 6px 0 4px; text-transform: uppercase; }
.presets-list { max-height: 200px; overflow-y: auto; }
.presets-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.presets-item:hover { background: var(--bg-card-hover); }
.presets-item-actions { display: flex; align-items: center; gap: 4px; }
.presets-item .presets-item-edit,
.presets-item .presets-item-delete {
    padding: 2px 6px;
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}
.presets-item .presets-item-edit:hover { color: var(--primary); background: rgba(0,255,170,0.1); }
.presets-item .presets-item-delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.presets-divider { height: 1px; background: var(--border); margin: 8px 0; }
.btn-presets-save {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}
.btn-presets-save:hover { background: var(--bg-card-hover); }

/* ============ TABLES ============ */

/* Один контейнер прокрутки — иначе overflow на .table-container ломает sticky заголовка */
.domains-table-scroll {
    overflow: auto;
    max-height: calc(100vh - 260px);
    margin: 0 -4px 0;
    padding: 0 4px;
}

.table-container {
    overflow-x: auto;
    margin: -4px;
    padding: 4px;
}

.domains-table-scroll .table-container {
    overflow-x: visible;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    padding: 14px 16px;
    text-align: left;
    vertical-align: middle;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
}

.table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

/* Липкий заголовок таблицы (при закреплении — прилипает под тулбаром) */
.table-sticky-head thead {
    position: relative;
}
.table-sticky-head thead th {
    position: sticky;
    top: 64px;
    z-index: 10;
    background: var(--bg-input) !important;
    box-shadow: 0 2px 0 var(--border);
}
.domains-table-scroll.domains-pin-off .table-sticky-head thead th {
    position: relative;
    top: auto;
}

/* Сортировка по клику на заголовок */
#domains-table thead th[data-col]:not([data-col="check"]):not([data-col="actions"]) {
    cursor: pointer;
    user-select: none;
}
#domains-table thead th .sort-indicator {
    margin-left: 4px;
    color: var(--accent, #7cff7c);
    font-size: 0.9em;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    transition: background var(--transition-fast);
    vertical-align: middle;
}

/* Меньше отступ между чекбоксом и доменом */
.table td.col-check,
.table th.col-check {
    padding-left: 12px;
    padding-right: 6px;
}
.table td.col-domain,
.table th.col-domain {
    padding-left: 6px;
}

/* Колонка «Действия» — заголовок и кнопки в одну колонку, выравнивание по правому краю */
#domains-table th.col-actions,
#domains-table td.col-actions {
    width: 1%;
    min-width: 120px;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
    padding-right: 12px;
}
#domains-table td.col-actions {
    padding-left: 8px;
}
#domains-table td.col-actions .btn-icon {
    vertical-align: middle;
    margin-left: 2px;
}
#domains-table td.col-actions .btn-icon:first-child {
    margin-left: 0;
}

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

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

.domain-cell {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.domain-cell:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* ============ BADGES ============ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-casino {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-adult {
    background: rgba(236, 72, 153, 0.12);
    color: #EC4899;
}

.badge-pharma {
    background: rgba(168, 85, 247, 0.12);
    color: #A855F7;
}

.badge-crypto {
    background: rgba(251, 191, 36, 0.12);
    color: #FBBF24;
}

.badge-clean {
    background: var(--success-bg);
    color: var(--success);
}

.badge-unknown {
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-muted);
}

/* ============ BUTTONS ============ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #000;
    box-shadow: 0 4px 16px rgba(175, 229, 7, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(175, 229, 7, 0.35);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--primary);
}

/* ============ FORMS ============ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

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

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ============ MODALS ============ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlide var(--transition) ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============ TOAST ============ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: toastSlide var(--transition) ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--info);
}

/* ============ SPINNER ============ */

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* ============ PROGRESS ============ */

.progress {
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-full);
    transition: width var(--transition);
}

/* ============ UTILITIES ============ */

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 12px;
}

.gap-3 {
    gap: 16px;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 12px;
}

.mt-3 {
    margin-top: 16px;
}

.mb-3 {
    margin-bottom: 16px;
}

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

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

/* ============ LOGIN PAGE ============ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(175, 229, 7, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
        var(--bg-dark);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
    box-shadow: 0 8px 32px rgba(175, 229, 7, 0.3);
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-input {
    padding: 16px 18px;
    font-size: 15px;
}

.login-form .btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    margin-top: 8px;
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
}

.login-error.show {
    display: block;
}

/* ============ ADMIN PANEL ============ */

.admin-section {
    padding: 20px 0;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-role.role-badge {
    margin-top: 4px;
}

.users-table .role-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-badge.role-admin {
    background: linear-gradient(135deg, #AFE507 0%, #8FB806 100%);
    color: #0A0A0B;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(175, 229, 7, 0.4);
}

.role-badge.role-user {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #FFFFFF;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.role-badge.role-viewer {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
    color: #FFFFFF;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

.status-active {
    color: var(--success);
}

.status-inactive {
    color: var(--danger);
}

.user-online-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}
.user-online-indicator i {
    font-size: 8px;
}
.user-online-indicator.online {
    color: var(--success);
}
.user-online-indicator.offline {
    color: var(--danger);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 24px;
    }
}

@media (max-width: 640px) {
    .header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }
}

/* ============ LOGOUT BUTTON ============ */

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition-duration: .3s;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.199);
    background-color: rgb(239, 68, 68);
    margin: 10px 12px;
}

.logout-btn .sign {
    width: 100%;
    transition-duration: .3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn .sign svg {
    width: 17px;
    height: 17px;
}

.logout-btn .sign svg path {
    fill: white;
}

.logout-btn .text {
    position: absolute;
    right: 0%;
    width: 0%;
    opacity: 0;
    color: white;
    font-size: 14px;
    font-weight: 600;
    transition-duration: .3s;
    white-space: nowrap;
}

.logout-btn:hover {
    width: 130px;
    border-radius: 40px;
    transition-duration: .3s;
}

.logout-btn:hover .sign {
    width: 30%;
    transition-duration: .3s;
    padding-left: 12px;
}

.logout-btn:hover .text {
    opacity: 1;
    width: 70%;
    transition-duration: .3s;
    padding-right: 15px;
}

.logout-btn:active {
    transform: translate(2px, 2px);
}

/* Ahrefs API Status Badge */
.api-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: help;
    transition: all var(--transition);
}

.api-status-badge:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.api-status-badge.ok {
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.api-status-badge.warning {
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

.api-status-badge.error {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* ============ NEON CHECKBOX ============ */
.neon-checkbox {
  --primary: #00ffaa;
  --primary-dark: #00cc88;
  --primary-light: #88ffdd;
  --size: 16px;
  position: relative;
  width: var(--size);
  height: var(--size);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-block;
  flex-shrink: 0;
}

.neon-checkbox input {
  display: none;
}

.neon-checkbox__frame {
  position: relative;
  width: 100%;
  height: 100%;
}

.neon-checkbox__box {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  border: 2px solid var(--primary-dark);
  transition: all 0.4s ease;
}

.neon-checkbox__check-container {
  position: absolute;
  inset: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.neon-checkbox__check {
  width: 80%;
  height: 80%;
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transform-origin: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.neon-checkbox__glow {
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  background: var(--primary);
  opacity: 0;
  filter: blur(8px);
  transform: scale(1.2);
  transition: all 0.4s ease;
}

.neon-checkbox__borders {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
}

.neon-checkbox__borders span {
  position: absolute;
  width: 40px;
  height: 1px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.neon-checkbox__borders span:nth-child(1) {
  top: 0;
  left: -100%;
  animation: borderFlow1 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(2) {
  top: -100%;
  right: 0;
  width: 1px;
  height: 40px;
  animation: borderFlow2 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(3) {
  bottom: 0;
  right: -100%;
  animation: borderFlow3 2s linear infinite;
}

.neon-checkbox__borders span:nth-child(4) {
  bottom: -100%;
  left: 0;
  width: 1px;
  height: 40px;
  animation: borderFlow4 2s linear infinite;
}

.neon-checkbox__effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.neon-checkbox__particles span {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  top: 50%;
  left: 50%;
  box-shadow: 0 0 6px var(--primary);
}

.neon-checkbox__rings {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.neon-checkbox__rings .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0;
  transform: scale(0);
}

.neon-checkbox__sparks span {
  position: absolute;
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0;
}

/* Hover Effects */
.neon-checkbox:hover .neon-checkbox__box {
  border-color: var(--primary);
  transform: scale(1.05);
}

/* Checked State */
.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__box {
  border-color: var(--primary);
  background: rgba(0, 255, 170, 0.1);
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__check {
  stroke-dashoffset: 0;
  transform: scale(1.1);
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__glow {
  opacity: 0.2;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__borders span {
  opacity: 1;
}

/* Particle Animations */
.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__particles span {
  animation: particleExplosion 0.6s ease-out forwards;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__rings .ring {
  animation: ringPulse 0.6s ease-out forwards;
}

.neon-checkbox input:checked ~ .neon-checkbox__frame .neon-checkbox__sparks span {
  animation: sparkFlash 0.6s ease-out forwards;
}

/* Animations */
@keyframes borderFlow1 {
  0% { transform: translateX(0); }
  100% { transform: translateX(200%); }
}

@keyframes borderFlow2 {
  0% { transform: translateY(0); }
  100% { transform: translateY(200%); }
}

@keyframes borderFlow3 {
  0% { transform: translateX(0); }
  100% { transform: translateX(-200%); }
}

@keyframes borderFlow4 {
  0% { transform: translateY(0); }
  100% { transform: translateY(-200%); }
}

@keyframes particleExplosion {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
  20% { opacity: 1; }
  100% {
    transform: translate(
        calc(-50% + var(--x, 20px)),
        calc(-50% + var(--y, 20px))
      )
      scale(0);
    opacity: 0;
  }
}

@keyframes ringPulse {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

@keyframes sparkFlash {
  0% { transform: rotate(var(--r, 0deg)) translateX(0) scale(1); opacity: 1; }
  100% { transform: rotate(var(--r, 0deg)) translateX(30px) scale(0); opacity: 0; }
}

/* Particle Positions */
.neon-checkbox__particles span:nth-child(1) { --x: 25px; --y: -25px; }
.neon-checkbox__particles span:nth-child(2) { --x: -25px; --y: -25px; }
.neon-checkbox__particles span:nth-child(3) { --x: 25px; --y: 25px; }
.neon-checkbox__particles span:nth-child(4) { --x: -25px; --y: 25px; }
.neon-checkbox__particles span:nth-child(5) { --x: 35px; --y: 0px; }
.neon-checkbox__particles span:nth-child(6) { --x: -35px; --y: 0px; }
.neon-checkbox__particles span:nth-child(7) { --x: 0px; --y: 35px; }
.neon-checkbox__particles span:nth-child(8) { --x: 0px; --y: -35px; }
.neon-checkbox__particles span:nth-child(9) { --x: 20px; --y: -30px; }
.neon-checkbox__particles span:nth-child(10) { --x: -20px; --y: 30px; }
.neon-checkbox__particles span:nth-child(11) { --x: 30px; --y: 20px; }
.neon-checkbox__particles span:nth-child(12) { --x: -30px; --y: -20px; }

/* Spark Rotations */
.neon-checkbox__sparks span:nth-child(1) { --r: 0deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(2) { --r: 90deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(3) { --r: 180deg; top: 50%; left: 50%; }
.neon-checkbox__sparks span:nth-child(4) { --r: 270deg; top: 50%; left: 50%; }

/* Ring Delays */
.neon-checkbox__rings .ring:nth-child(1) { animation-delay: 0s; }
.neon-checkbox__rings .ring:nth-child(2) { animation-delay: 0.1s; }
.neon-checkbox__rings .ring:nth-child(3) { animation-delay: 0.2s; }