/* ==================== SCIODEV STYLES ==================== */

:root {
    --transition: 0.2s ease;
}

/* Темная тема */
.theme-dark {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #15151f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --border-color: #2a2a3a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --premium-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Светлая тема */
.theme-light {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e4e6eb;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;
    --border-color: #d0d0e0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --premium-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

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

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

/* Быстрая загрузка - скрыть контент пока не готов */
body.loading { opacity: 0; }
body { opacity: 1; transition: opacity 0.2s; }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ==================== HEADER ==================== */
.header {
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.theme-light .header { background: rgba(255,255,255,0.95); }

.header-content { display: flex; align-items: center; justify-content: space-between; gap: 30px; }

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.logo span {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav */
.nav { display: flex; align-items: center; gap: 5px; }

.nav-link {
    padding: 10px 18px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.premium {
    background: var(--premium-gradient);
    color: white !important;
}

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle, .lang-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.theme-toggle:hover, .lang-toggle:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

/* User Menu */
.user-menu { position: relative; }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover { transform: scale(1.05); }

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    min-width: 220px;
    box-shadow: var(--card-shadow);
    display: none;
    z-index: 1000;
}

.user-dropdown.active { display: block; animation: fadeIn 0.2s; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-primary);
    transition: var(--transition);
    cursor: pointer;
}

.dropdown-item:hover { background: var(--bg-tertiary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 8px 0; }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary:hover { background: var(--border-color); }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-premium { background: var(--premium-gradient); color: white; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; }

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-3px);
}

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

.card-title { font-size: 1.25rem; font-weight: 700; }

/* ==================== PRODUCTS ==================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
    border-color: var(--accent);
}

.product-card.premium {
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                var(--premium-gradient) border-box;
}

.product-image {
    width: 100%;
    height: 180px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-content { padding: 20px; }

.product-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.badge-free {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-premium {
    background: var(--premium-gradient);
    color: white;
}

.product-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }

.product-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==================== SKELETON LOADING ==================== */
.skeleton { pointer-events: none; }

.skeleton-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content { padding: 20px; }

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

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

/* ==================== ALERTS ==================== */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Toast Alert */
.alert-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.alert-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.alert-toast.alert-success { border-color: var(--success); }
.alert-toast.alert-error { border-color: var(--danger); }

/* ==================== TABLES ==================== */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

.table th, .table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th { background: var(--bg-tertiary); font-weight: 600; }
.table tr:hover { background: var(--bg-tertiary); }
.table tr:last-child td { border-bottom: none; }

/* ==================== HERO ==================== */
.hero {
    padding: 100px 0;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: relative;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent), #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-buttons { display: flex; justify-content: center; gap: 20px; }

/* ==================== STATS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label { color: var(--text-secondary); margin-top: 5px; }

/* ==================== SECTION ==================== */
.section { padding: 60px 0; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.section-title { font-size: 1.75rem; font-weight: 700; }

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 5px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.tab {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    font-family: inherit;
}

.tab:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tab.active { background: linear-gradient(135deg, var(--accent), #a855f7); color: white; }

/* ==================== ADMIN ==================== */
.admin-layout { display: flex; min-height: calc(100vh - 73px); }

.admin-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 30px 15px;
}

.admin-menu { list-style: none; }
.admin-menu-item { margin-bottom: 5px; }

.admin-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.admin-menu-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.admin-menu-link.active { background: linear-gradient(135deg, var(--accent), #a855f7); color: white; }

.admin-content { flex: 1; padding: 30px; overflow-y: auto; }

/* ==================== PROFILE ==================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}

.profile-info h2 { font-size: 1.75rem; margin-bottom: 5px; }
.profile-info p { color: var(--text-secondary); }

/* ==================== AUTH ==================== */
.auth-container {
    min-height: calc(100vh - 73px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-footer { text-align: center; margin-top: 25px; color: var(--text-secondary); }

/* ==================== ROLE BADGE ==================== */
.role-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text { color: var(--text-secondary); }

/* ==================== UTILITIES ==================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state-icon { font-size: 4rem; margin-bottom: 15px; opacity: 0.5; }

.copy-btn {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover, .copy-btn.copied { background: var(--success); color: white; }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header-content { flex-wrap: wrap; }
    .nav { order: 3; width: 100%; margin-top: 15px; overflow-x: auto; }
    .hero-title { font-size: 2.5rem; }
    .hero-buttons { flex-direction: column; align-items: center; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); }
    .products-grid { grid-template-columns: 1fr; }
    .profile-header { flex-direction: column; text-align: center; }
}