/* === AI-Критик Admin Panel — Premium Design === */

:root {
    --bg-deep: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-sidebar: #13132b;
    --bg-input: #16213e;
    --accent: #4361ee;
    --accent2: #7209b7;
    --gold: #f7b731;
    --gold-light: #fed330;
    --text: #e8e8f0;
    --text-muted: #8892b0;
    --border: #2a2a4a;
    --success: #2ec4b6;
    --danger: #e71d36;
    --warning: #ff9f1c;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
    background: var(--bg-deep);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a3e 50%, #0f0f1a 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header i { font-size: 48px; color: var(--accent); }
.login-header h1 { font-size: 24px; margin: 8px 0 4px; }
.login-header p { color: var(--text-muted); font-size: 14px; }
.login-form .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
}
.login-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}
.login-form .input-group-text {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.login-form .btn-primary {
    background: var(--accent);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.login-form .btn-primary:hover { background: #3651d4; transform: translateY(-1px); }

/* === Admin Layout === */
.admin-layout { display: flex; min-height: 100vh; }

/* === Sidebar === */
.admin-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand i { color: var(--accent); font-size: 28px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    font-size: 15px;
}
.sidebar-nav .nav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.sidebar-nav .nav-item.active {
    color: var(--text);
    background: rgba(67,97,238,0.1);
    border-left-color: var(--accent);
}
.sidebar-nav .nav-item i { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 12px 0; border-top: 1px solid var(--border); }

/* === Main === */
.admin-main {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* === Page Header === */
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 26px; font-weight: 700; margin: 0; }
.page-header p { margin: 4px 0 0; }

/* === KPI Cards === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.kpi-users .kpi-icon { background: rgba(67,97,238,0.15); color: var(--accent); }
.kpi-requests .kpi-icon { background: rgba(114,9,183,0.15); color: var(--accent2); }
.kpi-revenue .kpi-icon { background: rgba(46,196,182,0.15); color: var(--success); }
.kpi-subs .kpi-icon { background: rgba(247,183,49,0.15); color: var(--gold); }
.kpi-bot .kpi-icon { background: rgba(0,136,204,0.15); color: #0088cc; }
.kpi-app .kpi-icon { background: rgba(114,9,183,0.15); color: var(--accent2); }
.kpi-subtrack .kpi-icon { background: rgba(46,196,182,0.15); color: var(--success); }
.kpi-push .kpi-icon { background: rgba(255,159,28,0.15); color: var(--warning); }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1.1; }
.kpi-label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.kpi-sub { font-size: 11px; color: var(--text-muted); }

/* === Stats Row === */
.stats-row { display: flex; gap: 12px; margin-bottom: 28px; }
.stats-row .badge { font-size: 13px; padding: 6px 14px; }

/* === Charts Grid === */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chart-card-header h5 { margin: 0; font-size: 15px; }
.chart-card-header .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
}
.chart-card canvas { max-height: 280px; }

/* === Section Card === */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.section-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.section-card-header h5 { margin: 0; font-size: 16px; }

/* === Toolbar === */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.search-box { max-width: 320px; }
.search-box .form-control, .search-box .input-group-text {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}
.toolbar-info { color: var(--text-muted); font-size: 14px; }

/* === Tables === */
.table { color: var(--text); margin: 0; }
.table-light { --bs-table-bg: rgba(255,255,255,0.03); --bs-table-color: var(--text-muted); }
.table-hover tbody tr:hover { background: rgba(255,255,255,0.03); }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.badge { font-weight: 500; }
.bg-gold { background: var(--gold); color: #000; }

/* === Detail Grid === */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* === Modal === */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.modal .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-close { filter: invert(1); }

/* === Client Layout === */
.client-page {
    background: var(--bg-deep);
    min-height: 100vh;
}
.client-layout {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.client-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.client-brand i { color: var(--accent); }
.client-main { flex: 1; padding-bottom: 70px; }

/* Client profile */
.client-profile { text-align: center; padding: 28px 20px 16px; }
.profile-avatar { font-size: 64px; color: var(--accent); margin-bottom: 8px; }

/* Client cards */
.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin: 8px 14px;
    box-shadow: var(--shadow);
}
.credit-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-color: rgba(247,183,49,0.3);
}
.credit-balance {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.credit-balance i { color: var(--gold); font-size: 20px; }
.credit-value { font-size: 40px; font-weight: 800; color: var(--gold); }
.credit-label { color: var(--text-muted); font-size: 16px; }
.btn-gold {
    background: var(--gold);
    color: #000;
    border: none;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-gold:hover { background: var(--gold-light); color: #000; }

/* Critique items */
.critique-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.critique-item:last-child { border-bottom: none; }

.critique-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 8px;
}
.critique-preview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.critique-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}
.critique-status.status-succeeded, .critique-status.status-done { background: rgba(46,196,182,0.15); color: var(--success); }
.critique-status.status-failed, .critique-status.status-error { background: rgba(231,29,54,0.15); color: var(--danger); }
.critique-status.status-pending { background: rgba(255,159,28,0.15); color: var(--warning); }

/* Critique mode selector */
.mode-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.mode-trigger:active { border-color: var(--accent); }
.mode-trigger .bi-chevron-down { color: var(--text-muted); }

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.mode-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12px;
}
.mode-chip:hover { border-color: var(--gold); color: var(--text); }
.mode-chip.active {
    background: rgba(201,162,57,0.15);
    border-color: var(--gold);
    color: var(--gold);
}
.mode-chip .mode-emoji { font-size: 22px; }
.mode-chip .mode-label { font-weight: 500; }

/* Critique textarea */
.critique-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.critique-textarea:focus { outline: none; border-color: var(--accent); }
.critique-textarea::placeholder { color: var(--text-muted); }

/* Clickable critique items */
.critique-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.critique-item-link:hover { opacity: 0.8; }

/* Client bottom nav */
.client-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}
.client-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    padding: 6px 20px;
    transition: color 0.15s;
}
.client-nav .nav-item.active, .client-nav .nav-item:hover { color: var(--accent); }
.client-nav .nav-item i { font-size: 20px; }

/* === Buttons === */
.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-muted);
}
.btn-outline-secondary:hover { background: var(--bg-input); color: var(--text); border-color: var(--text-muted); }
.btn-outline-secondary.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* === Progress === */
.progress { background: var(--bg-input); border-radius: 10px; }
.progress-bar { border-radius: 10px; }
.progress-bar.bg-gold { background: var(--gold); }

/* === Pagination === */
#paginationBar, #txPagination { border-top: 1px solid var(--border); }

/* === Responsive === */
@media (max-width: 1200px) { .charts-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 992px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    /* Collapse sidebar to icon-only */
    .admin-sidebar { width: 60px; }
    .admin-sidebar .sidebar-brand span,
    .admin-sidebar .nav-item span,
    .admin-sidebar .sidebar-footer .nav-item { display: none; }
    .admin-sidebar .nav-item { justify-content: center; padding: 14px; }
    .admin-sidebar .nav-item i { margin: 0; }
    .admin-main { margin-left: 60px; padding: 20px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile sidebar overlay ──────────────────────────────────── */

.sidebar-overlay {
    display: none;
}
@media (max-width: 576px) {
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 115;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }
    .sidebar-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }
    /* Slide sidebar in from left on overlay tap */
    .admin-sidebar {
        z-index: 120;
    }
}
@media (max-width: 576px) {
    /* Full mobile: top hamburger bar + bottom sidebar */
    .admin-layout { flex-direction: column; }
    /* Top mobile header bar */
    .admin-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: var(--bg-sidebar);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 110;
    }
    .admin-mobile-header .mobile-brand {
        font-size: 18px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .admin-mobile-header .mobile-brand i { color: var(--accent); }
    .hamburger-btn {
        background: none;
        border: none;
        color: var(--text);
        font-size: 24px;
        padding: 4px 8px;
        cursor: pointer;
    }
    /* Sidebar becomes bottom sheet overlay */
    .admin-sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 120;
    }
    .sidebar-brand { display: none; }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        padding: 0;
        flex: 1;
        justify-content: space-around;
    }
    .sidebar-nav .nav-item {
        flex-direction: column;
        gap: 2px;
        padding: 8px 12px;
        font-size: 10px;
        border-left: none;
        border-top: 2px solid transparent;
        text-align: center;
        align-items: center;
    }
    .sidebar-nav .nav-item.active { border-left-color: transparent; border-top-color: var(--accent); background: none; }
    .sidebar-nav .nav-item i { font-size: 20px; width: auto; }
    .sidebar-nav .nav-item span { display: block !important; }
    .sidebar-footer { display: none; }
    /* Main content */
    .admin-main {
        margin-left: 0;
        margin-bottom: 60px;
        padding: 16px 12px;
    }
    /* KPI: 2 columns */
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { padding: 14px; gap: 10px; }
    .kpi-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
    .kpi-value { font-size: 22px; }
    .kpi-label { font-size: 11px; }
    /* Charts: stack vertically */
    .charts-grid { grid-template-columns: 1fr; gap: 12px; }
    .chart-card { padding: 12px; }
    .chart-card canvas { max-height: 200px; }
    /* Tables: horizontal scroll */
    .section-card { overflow-x: auto; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 6px; white-space: nowrap; }
    /* Toolbar: stack */
    .toolbar { flex-wrap: wrap; gap: 8px; }
    .search-box { max-width: 100%; flex: 1; }
    .toolbar-info { font-size: 12px; }
    /* Page header */
    .page-header { margin-bottom: 16px; }
    .page-header h2 { font-size: 20px; }
    /* Detail grid */
    .detail-grid { grid-template-columns: 1fr; gap: 12px; }
    /* Stats row */
    .stats-row { flex-wrap: wrap; gap: 6px; }
    .stats-row .badge { font-size: 11px; padding: 4px 10px; }
    /* Pagination */
    .pagination { font-size: 12px; }
    #paginationBar button, #txPagination button { padding: 4px 10px; font-size: 12px; }
    /* Modals */
    .modal-dialog { margin: 8px; }
    .modal-content { border-radius: 16px; }
    /* Login */
    .login-container { padding: 12px; }
    .login-card { padding: 24px 20px; }
    .login-header i { font-size: 36px; }
    .login-header h1 { font-size: 20px; }
}

/* === Skeleton loaders === */
@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text:last-child { width: 50%; }
.skeleton-avatar { width: 64px; height: 64px; border-radius: 50%; }
.skeleton-badge { width: 60px; height: 24px; display: inline-block; }
.skeleton-card { height: 80px; margin-bottom: 10px; }

/* === Score sparkline (dashboard) === */
.score-sparkline { width: 100%; height: 48px; }
.score-sparkline svg { width: 100%; height: 100%; }
.score-sparkline path { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.score-sparkline dot { fill: var(--gold); }

/* === Confetti canvas === */
.confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* === Telegram light theme overrides === */
[data-telegram-theme="light"] {
    --bg-deep: #f5f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #f0f0f5;
    --bg-input: #e8e8ef;
    --text: #1a1a2e;
    --text-muted: #667085;
    --border: #dddde8;
}

/* === iOS-style Toast notifications === */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}
.toast-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: toastIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    pointer-events: auto;
    backdrop-filter: blur(20px);
}
.toast-item.toast-out { animation: toastOut 0.25s ease-in forwards; }
.toast-item.toast-error { border-left: 3px solid var(--danger); }
.toast-item.toast-success { border-left: 3px solid var(--success); }
.toast-item.toast-info { border-left: 3px solid var(--accent); }
.toast-item i { font-size: 20px; }
.toast-item .toast-msg { flex: 1; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

/* === iOS Bottom Sheet === */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.sheet-overlay.active { opacity: 1; pointer-events: auto; }
.sheet-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    padding: 12px 0 34px;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 70vh;
    overflow-y: auto;
}
.sheet-panel.active { transform: translateX(-50%) translateY(0); }
.sheet-handle {
    width: 36px; height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin: 0 auto 16px;
}
.sheet-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 24px;
    font-size: 16px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sheet-option:active { background: var(--bg-input); }
.sheet-option .sheet-emoji { font-size: 24px; }
.sheet-option .sheet-check { margin-left: auto; color: var(--accent); opacity: 0; }
.sheet-option.selected .sheet-check { opacity: 1; }
.sheet-cancel {
    display: block;
    width: calc(100% - 32px);
    margin: 8px 16px 0;
    padding: 14px;
    background: var(--bg-input);
    border: none;
    border-radius: 14px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* === Filter chips (history) === */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
    flex-shrink: 0;
    padding: 7px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* === Pull-to-refresh === */
.pull-indicator {
    text-align: center;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s, padding 0.2s;
    color: var(--text-muted);
    font-size: 13px;
}
.pull-indicator.refreshing {
    max-height: 40px;
    padding: 8px 0;
}

/* === Page transitions === */
/* WARNING: .page-enter with opacity:0 causes white screen if JS fails.
   Instead, use visibility + transform for safer fade-in. */
.client-main { }
.client-main.page-enter { opacity: 1; }
.client-main.page-enter-active { opacity: 1; }

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}
.empty-state .empty-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-state .empty-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.empty-state .empty-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* === Improved textarea === */
.critique-textarea {
    transition: border-color 0.15s, box-shadow 0.15s;
}
.critique-textarea:focus {
    box-shadow: 0 0 0 3px rgba(67,97,238,0.2);
}
.char-bar {
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    margin-top: 6px;
    overflow: hidden;
}
.char-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.15s, background 0.15s;
    background: var(--accent);
}
.char-bar-fill.warning { background: var(--warning); }
.char-bar-fill.danger { background: var(--danger); }

/* === Tap highlight override (iOS feel) === */
.tap-active { transition: opacity 0.05s; }
.tap-active:active { opacity: 0.6; }

/* ══════════════════════════════════════════════════════════════
   === PREMIUM DESIGN SYSTEM ===
   ══════════════════════════════════════════════════════════════ */

/* ── Keyframes ────────────────────────────────────────────────── */

@keyframes shimmer {
    0% { background-position: -300px 0; }
    100% { background-position: calc(300px + 100%) 0; }
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(15px, -20px) scale(1.05); }
    50% { transform: translate(-10px, -35px) scale(0.95); }
    75% { transform: translate(-20px, -10px) scale(1.03); }
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(247,183,49,0.15), 0 0 20px rgba(67,97,238,0.05); }
    50% { box-shadow: 0 0 16px rgba(247,183,49,0.3), 0 0 40px rgba(67,97,238,0.12); }
}

@keyframes score-pop {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.15); }
    80% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slide-up-fade {
    0% { transform: translateY(24px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(67,97,238,0.4); }
    70% { box-shadow: 0 0 0 12px rgba(67,97,238,0); }
    100% { box-shadow: 0 0 0 0 rgba(67,97,238,0); }
}

@keyframes ripple-effect {
    0% { transform: scale(0); opacity: 0.35; }
    100% { transform: scale(4); opacity: 0; }
}

@keyframes breathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes aurora-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes count-up {
    0% { opacity: 0; filter: blur(4px); }
    100% { opacity: 1; filter: blur(0); }
}

/* ── Floating background orbs ─────────────────────────────────── */

.bg-orbs {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.08;
    animation: float-orb 20s ease-in-out infinite;
}
.bg-orb:nth-child(1) {
    width: 300px; height: 300px;
    background: var(--accent);
    top: -80px; left: -60px;
    animation-delay: 0s;
}
.bg-orb:nth-child(2) {
    width: 200px; height: 200px;
    background: var(--accent2);
    bottom: 20%; right: -40px;
    animation-delay: -7s;
    animation-duration: 23s;
}
.bg-orb:nth-child(3) {
    width: 180px; height: 180px;
    background: var(--gold);
    top: 50%; left: 30%;
    animation-delay: -14s;
    animation-duration: 26s;
}

/* ── Aurora hero gradient ─────────────────────────────────────── */

.aurora-hero {
    background: linear-gradient(
        135deg,
        rgba(67,97,238,0.12) 0%,
        rgba(114,9,183,0.08) 25%,
        rgba(247,183,49,0.06) 50%,
        rgba(46,196,182,0.08) 75%,
        rgba(67,97,238,0.12) 100%
    );
    background-size: 400% 400%;
    animation: aurora-flow 15s ease infinite;
    border-radius: 20px;
    padding: 24px 18px;
    position: relative;
    overflow: hidden;
}
.aurora-hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(247,183,49,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Glass cards ──────────────────────────────────────────────── */

.glass-card {
    background: rgba(26,26,46,0.6) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
[data-telegram-theme="light"] .glass-card {
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

/* ── Premium card with glow ───────────────────────────────────── */

.card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin: 8px 0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    animation: slide-up-fade 0.5s ease backwards;
}
.card-premium:hover {
    transform: translateY(-2px);
    border-color: rgba(247,183,49,0.25);
    box-shadow: 0 8px 32px rgba(247,183,49,0.08);
}

/* ── Score ring ───────────────────────────────────────────────── */

.score-ring-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 0;
}
.score-ring {
    position: relative;
    width: 90px; height: 90px;
}
.score-ring svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.score-ring .track {
    fill: none;
    stroke: var(--border);
    stroke-width: 6;
}
.score-ring .fill {
    fill: none;
    stroke: var(--gold);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.34,1.56,0.64,1);
}
.score-ring .glow {
    fill: none;
    stroke: var(--gold);
    stroke-width: 12;
    stroke-linecap: round;
    opacity: 0.2;
    filter: blur(4px);
    transition: stroke-dashoffset 1.5s cubic-bezier(0.34,1.56,0.64,1);
}
.score-ring-value {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 800;
    color: var(--gold);
    animation: score-pop 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.score-ring-label {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
}

/* ── Gold button shimmer ──────────────────────────────────────── */

.btn-shimmer {
    position: relative;
    overflow: hidden;
}
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.15),
        transparent
    );
    animation: shimmer 2.5s ease-in-out infinite;
}

/* ── Staggered list entrance ──────────────────────────────────── */

.stagger-item {
    animation: slide-up-fade 0.5s ease backwards;
}
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

/* ── Pulse dot (live indicator) ───────────────────────────────── */

.pulse-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-ring 2s ease-out infinite;
    margin-right: 6px;
    vertical-align: middle;
}
.pulse-dot.warning { background: var(--warning); }
.pulse-dot.danger { background: var(--danger); }

/* ── Processing skeleton upgrade ──────────────────────────────── */

.skeleton-premium {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.03) 75%
    );
    background-size: 200px 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 10px;
}
.skeleton-premium.skel-card { height: 80px; margin-bottom: 10px; }
.skeleton-premium.skel-title { height: 20px; width: 60%; margin-bottom: 10px; }
.skeleton-premium.skel-text { height: 14px; width: 90%; margin-bottom: 8px; }
.skeleton-premium.skel-text:last-child { width: 40%; }

/* ── Result section entrance ──────────────────────────────────── */

.result-section {
    animation: slide-up-fade 0.5s ease backwards;
}
.result-section:nth-child(1) { animation-delay: 0s; }
.result-section:nth-child(2) { animation-delay: 0.08s; }
.result-section:nth-child(3) { animation-delay: 0.16s; }
.result-section:nth-child(4) { animation-delay: 0.24s; }

/* ── Ripple on tap ────────────────────────────────────────────── */

.ripple {
    position: relative;
    overflow: hidden;
}
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transform: scale(0);
    animation: ripple-effect 0.6s ease-out;
    pointer-events: none;
}
[data-telegram-theme="light"] .ripple-effect {
    background: rgba(0,0,0,0.1);
}

/* ── Stat card mini ───────────────────────────────────────────── */

.stat-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-muted);
    animation: slide-up-fade 0.4s ease backwards;
    animation: count-up 0.4s ease backwards;
}
.stat-chip i { font-size: 16px; }
.stat-chip .stat-value { color: var(--text); font-weight: 600; }

/* ── Page transition wrapper ──────────────────────────────────── */

/* SAFE: no animation — slide-up-fade starts at opacity:0, causing white screen
   in Telegram WebView if the animation fails to fire. */
.page-transition {
    /* animation: slide-up-fade 0.3s ease; */
}

/* ── Credit badge premium ─────────────────────────────────────── */

.credit-badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(247,183,49,0.15), rgba(254,211,48,0.08));
    border: 1px solid rgba(247,183,49,0.3);
    border-radius: 20px;
    padding: 6px 14px;
    font-weight: 700;
    color: var(--gold);
    font-size: 14px;
    animation: glow-pulse 3s ease-in-out infinite;
}
.credit-badge-premium i { font-size: 16px; }

/* ── Filter chips premium ─────────────────────────────────────── */

.filter-chip-premium {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.filter-chip-premium.active {
    background: rgba(67,97,238,0.15);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 16px rgba(67,97,238,0.2);
}
[data-telegram-theme="light"] .filter-chip-premium {
    background: rgba(0,0,0,0.03);
}
[data-telegram-theme="light"] .filter-chip-premium.active {
    color: var(--accent);
}

/* ── Toast upgrade ────────────────────────────────────────────── */

.toast-item {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* ── Nav item premium ─────────────────────────────────────────── */

.client-nav .nav-item {
    transition: color 0.2s, transform 0.2s;
}
.client-nav .nav-item:active {
    transform: scale(0.92);
}

/* ── Mode chips premium ───────────────────────────────────────── */

.mode-chip-premium {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}
.mode-chip-premium:hover {
    border-color: rgba(247,183,49,0.3);
    background: rgba(247,183,49,0.05);
}
.mode-chip-premium.selected {
    background: rgba(247,183,49,0.12);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 20px rgba(247,183,49,0.1);
}
.mode-chip-premium .mode-emoji { font-size: 24px; }
.mode-chip-premium .mode-label { font-weight: 600; font-size: 11px; }

/* ── Input focus glow ─────────────────────────────────────────── */

.input-glow:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15), 0 0 20px rgba(67,97,238,0.08) !important;
    outline: none;
}

/* ── Empty state animated ─────────────────────────────────────── */

.empty-state-premium .empty-icon {
    display: inline-block;
    animation: float-orb 6s ease-in-out infinite;
    font-size: 64px;
}
