/* ============================================================
   Admin Panel — Premium Dark Theme with Glassmorphism
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f23;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --accent: #FF6B6B;
    --accent-secondary: #FF8E53;
    --accent-glow: rgba(255, 107, 107, 0.15);
    --text: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: rgba(255, 107, 107, 0.3);
    --success: #00d26a;
    --success-bg: rgba(0, 210, 106, 0.1);
    --error: #ff4757;
    --error-bg: rgba(255, 71, 87, 0.1);
    --warning: #ffa502;
    --warning-bg: rgba(255, 165, 2, 0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Animated Background ===== */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(255, 107, 107, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 142, 83, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(120, 100, 255, 0.03) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, -1%) rotate(1deg); }
    50% { transform: translate(-1%, 2%) rotate(-1deg); }
    75% { transform: translate(1%, -2%) rotate(0.5deg); }
}

/* ===== Auth Pages ===== */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: fadeSlideUp 0.5s ease-out;
}

.logo { font-size: 3rem; margin-bottom: 0.5rem; }
h1 { font-size: 1.5rem; margin-bottom: 0.25rem; font-weight: 600; }
.subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ===== Form Fields ===== */
.field { margin-bottom: 1rem; text-align: left; }
.field label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.field label .icon { font-size: 0.9rem; }

.field input, .field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
    resize: vertical;
}

.field input:focus, .field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--input-focus);
    background: rgba(255, 255, 255, 0.06);
}

.field input::placeholder, .field textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.field textarea { min-height: 80px; }

.code-input {
    text-align: center;
    font-size: 2rem !important;
    letter-spacing: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.35);
}

.btn-primary:hover::before { left: 100%; }

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.25);
}

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

.btn-secondary {
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.btn-group { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.btn-group .btn-primary, .btn-group .btn-secondary { flex: 1; }

/* ===== Error/Auth ===== */
.error {
    background: var(--error-bg);
    color: var(--error);
    padding: 0.75rem;
    border-radius: var(--radius-xs);
    margin-top: 1rem;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 71, 87, 0.2);
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.hidden { display: none !important; }

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}
.back-link:hover { color: var(--accent); }

.qr-container {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.qr-image {
    border-radius: var(--radius-sm);
    max-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 15, 35, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-title {
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-title svg { filter: drop-shadow(0 2px 4px rgba(255, 107, 107, 0.3)); }

.nav-right { display: flex; align-items: center; gap: 1rem; }

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* ===== Dashboard Layout ===== */
.dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    position: relative;
    z-index: 1;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeSlideUp 0.5s ease-out;
}

.dashboard-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, var(--text), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Sections / Cards ===== */
.section {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeSlideUp 0.5s ease-out;
    animation-fill-mode: backwards;
}

.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.2s; }
.section:nth-child(3) { animation-delay: 0.3s; }

.section:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: var(--glass-hover);
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    cursor: pointer;
    user-select: none;
}

.section-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header .icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.icon-cookie { background: rgba(255, 165, 2, 0.12); }
.icon-key { background: rgba(100, 180, 255, 0.12); }
.icon-telegram { background: rgba(100, 200, 255, 0.12); }

.section-header .toggle-icon {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: var(--transition);
}

.section-header .toggle-icon.collapsed { transform: rotate(-90deg); }

.section-body {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.section-body.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ===== Status Bar ===== */
.status-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    position: relative;
}

.status-bar.valid { background: var(--success-bg); border-color: rgba(0, 210, 106, 0.2); }
.status-bar.valid .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 210, 106, 0.5);
}

.status-bar.invalid { background: var(--error-bg); border-color: rgba(255, 71, 87, 0.2); }
.status-bar.invalid .status-dot {
    background: var(--error);
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.5);
}

.status-bar.testing { background: var(--warning-bg); border-color: rgba(255, 165, 2, 0.2); }
.status-bar.testing .status-dot {
    background: var(--warning);
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 165, 2, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255, 165, 2, 0); }
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-left: auto;
    font-weight: 400;
    white-space: nowrap;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    max-width: 90vw;
}

.toast.success {
    background: rgba(0, 210, 106, 0.9);
    color: #000;
    border: 1px solid rgba(0, 210, 106, 0.5);
}

.toast.error {
    background: rgba(255, 71, 87, 0.9);
    color: white;
    border: 1px solid rgba(255, 71, 87, 0.5);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .navbar { padding: 0.6rem 1rem; }
    .nav-title { font-size: 0.95rem; }
    .nav-title svg { width: 22px; height: 22px; }
    
    .dashboard { padding: 1rem 0.75rem 2rem; }
    .dashboard-header h1 { font-size: 1.3rem; }
    
    .section { padding: 1.25rem 1rem; border-radius: 14px; }
    .section-header h2 { font-size: 0.95rem; }
    .section-header .icon-circle { width: 32px; height: 32px; font-size: 1rem; }
    
    .btn-group { flex-direction: column; }
    .btn-primary, .btn-secondary { font-size: 0.9rem; }
    
    .status-bar { flex-wrap: wrap; }
    .text-muted { 
        margin-left: 0;
        width: 100%;
        padding-top: 0.3rem;
        padding-left: 1.1rem;
    }
    
    .field input, .field textarea { font-size: 16px; /* Prevents iOS zoom */ }
    
    .card { padding: 1.75rem; }
}

@media (max-width: 380px) {
    .dashboard { padding: 0.75rem 0.5rem 2rem; }
    .section { padding: 1rem 0.8rem; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ===== Selection ===== */
::selection {
    background: rgba(255, 107, 107, 0.3);
    color: white;
}
