@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    min-height: 100vh;
    color: #e2e8f0;
}

.page { min-height: 100vh; }

/* ===== LOGIN ===== */

#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px;
    padding: 60px 50px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 120px rgba(99, 102, 241, 0.15);
}

.logo { font-size: 4em; margin-bottom: 20px; }

h1 {
    font-size: 2.5em;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.subtitle { color: #94a3b8; font-size: 1.1em; margin-bottom: 40px; }

.auth-buttons { display: flex; flex-direction: column; gap: 16px; }

.auth-btn {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 18px 32px; border-radius: 14px; font-size: 1.1em; font-weight: 600;
    text-decoration: none; transition: all 0.3s ease; border: 2px solid transparent;
}

.auth-btn svg { width: 24px; height: 24px; }

.youtube-btn { background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%); color: white; }
.youtube-btn:hover { background: linear-gradient(135deg, #ff3333 0%, #ff0000 100%); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(255, 0, 0, 0.3); }

.divider { display: flex; align-items: center; margin: 30px 0; color: #64748b; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(100, 116, 139, 0.5), transparent); }
.divider span { padding: 0 15px; font-size: 0.9em; }

.info-text { color: #64748b; font-size: 0.9em; line-height: 1.6; }
.info-text a { color: #6366f1; text-decoration: none; }
.info-text a:hover { text-decoration: underline; }

/* ===== DASHBOARD ===== */

#dashboard-page { padding: 20px; position: relative; overflow-x: hidden; }

#dashboard-page::before {
    content: '';
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(99, 102, 241, 0.03) 30%, rgba(99, 102, 241, 0.03) 70%, transparent 70%);
    background-size: 100px 100px;
    animation: drift 20s linear infinite;
    pointer-events: none; z-index: 0;
}

@keyframes drift { 0% { transform: translate(0, 0); } 100% { transform: translate(50px, 50px); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }

.container { max-width: 1400px; margin: 0 auto; position: relative; z-index: 1; animation: fadeInUp 0.6s ease-out; }

.header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px; padding: 40px; margin-bottom: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05) inset, 0 0 100px rgba(99, 102, 241, 0.1);
    position: relative; overflow: hidden;
}

.header::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 200%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    animation: shimmer 3s infinite;
}

.header h1 {
    font-size: 3em; font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 12px; letter-spacing: -0.02em; position: relative;
}

.header p { color: #94a3b8; font-size: 1.1em; font-weight: 500; position: relative; }

.channel-avatar {
    width: 100px; height: 100px; border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.5);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    object-fit: cover; margin-right: 20px;
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 24px; }

.stat-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px; padding: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
}

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    opacity: 0; transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.3) inset;
    border-color: rgba(99, 102, 241, 0.4);
}

.stat-card:hover::before { opacity: 1; }
.stat-card h3 { color: #94a3b8; font-size: 0.85em; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; font-weight: 600; }
.stat-card .value { font-size: 2.8em; font-weight: 800; background: linear-gradient(135deg, #f1f5f9, #cbd5e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; letter-spacing: -0.02em; }
.stat-card .label { color: #64748b; font-size: 0.9em; margin-top: 8px; font-weight: 500; }

.section {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px; padding: 36px; margin-bottom: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.section h2 {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 24px; font-size: 2em; font-weight: 800; letter-spacing: -0.02em;
}

table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }

th {
    background: rgba(99, 102, 241, 0.1); padding: 16px; text-align: left; font-weight: 600;
    color: #a5b4fc; border: none; font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px;
}
th:first-child { border-radius: 12px 0 0 12px; }
th:last-child { border-radius: 0 12px 12px 0; }

td {
    padding: 18px 16px;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    background: rgba(30, 41, 59, 0.4); color: #cbd5e1; font-weight: 500;
}
td:first-child { border-left: 1px solid rgba(99, 102, 241, 0.1); border-radius: 12px 0 0 12px; }
td:last-child { border-right: 1px solid rgba(99, 102, 241, 0.1); border-radius: 0 12px 12px 0; }
tr:hover td { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.2); }

.badge {
    display: inline-block; padding: 6px 14px; border-radius: 12px;
    font-size: 0.85em; font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.badge-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }
.badge-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }
.badge-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: white; }

.loader { text-align: center; padding: 60px; }
.loader:after {
    content: "⏳ Загрузка данных...";
    font-size: 1.3em;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    font-weight: 600;
}

.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.15) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5; padding: 24px; border-radius: 16px; margin: 24px 0; font-weight: 500;
}

.info-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white; border: none; padding: 12px 24px; border-radius: 12px;
    font-size: 0.95em; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.info-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6); }

/* Modal */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); animation: fadeIn 0.3s ease;
}
.modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    margin: 10% auto; padding: 0;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px; width: 90%; max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 24px 30px; border-bottom: 2px solid rgba(59, 130, 246, 0.2); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.5em; background: linear-gradient(135deg, #3b82f6, #2563eb); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.close { color: #94a3b8; font-size: 32px; font-weight: bold; cursor: pointer; transition: all 0.3s ease; line-height: 1; }
.close:hover { color: #f87171; transform: rotate(90deg); }
.modal-body { padding: 30px; }
.info-row { display: flex; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid rgba(59, 130, 246, 0.1); }
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: #94a3b8; }
.info-value { color: #e2e8f0; font-weight: 500; }
.modal-footer { padding: 20px 30px; border-top: 2px solid rgba(59, 130, 246, 0.2); display: flex; justify-content: center; }
.btn-close {
    padding: 10px 32px; border: none; border-radius: 10px; font-size: 1em; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-close:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6); }

/* ===== ERROR PAGE ===== */

#error-page {
    display: flex; align-items: center; justify-content: center;
    background-image: radial-gradient(at 50% 50%, rgba(239, 68, 68, 0.15) 0px, transparent 50%);
}

.error-container {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 24px; padding: 60px 50px; max-width: 500px; width: 90%; text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4), 0 0 120px rgba(239, 68, 68, 0.1);
}

.error-icon { font-size: 4em; margin-bottom: 20px; }
.error-container h1 { font-size: 2em; color: #ef4444; margin-bottom: 20px; -webkit-text-fill-color: #ef4444; }
.error-message {
    color: #94a3b8; font-size: 1.1em; line-height: 1.6; margin-bottom: 30px; padding: 20px;
    background: rgba(239, 68, 68, 0.1); border-radius: 12px; border: 1px solid rgba(239, 68, 68, 0.2);
}
.back-btn {
    display: inline-block; padding: 14px 32px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white; text-decoration: none; border-radius: 12px; font-weight: 600;
    transition: all 0.3s ease;
}
.back-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3); }

button { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
button:hover { box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4) !important; }
button:active { transform: translateY(-2px) scale(0.98) !important; }
