/* ================= GLOBAL & VARIABLES ================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Основные цвета */
    --bg-deep: #050505;       /* Глубокий черный */
    --bg-glass: rgba(18, 18, 18, 0.6); /* Полупрозрачный фон панелей */
    --bg-card: #111111;       /* Фон карточек */
    
    /* Рамки как в админке - строгие */
    --border-color: #2a2a2a;
    --border-hover: #444444;
    
    /* Акцент (наш красный) */
    --accent: #ff4a4a;
    --accent-hover: #e63a3a;
    --accent-glow: rgba(255, 74, 74, 0.25);
    
    /* Текст */
    --text-main: #ffffff;
    --text-muted: #888888;
    
    /* Дополнительно */
    --gold: #ffd700;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    
    /* ТОТ САМЫЙ ФОН СО СТРАНИЦЫ ВХОДА */
    background-image: 
        radial-gradient(circle at 85% 10%, rgba(255, 74, 74, 0.12), transparent 40%),
        radial-gradient(circle at 15% 90%, rgba(60, 60, 60, 0.2), transparent 40%);
    background-attachment: fixed; /* Фон зафиксирован */
}

/* Скроллбар */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ================= SIDEBAR (ADMIN STYLE + GLASS) ================= */

.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--bg-glass); /* Прозрачность */
    backdrop-filter: blur(12px); /* Размытие фона под меню */
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    z-index: 50;
}

/* LOGO */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    text-decoration: none;
    cursor: pointer;
    padding-left: 8px;
}

.logo img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 74, 74, 0.2);
}

.logo span {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

/* CATEGORY BUTTONS (ADMIN STYLE) */
.category-btn {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600; /* Жирнее, как в админке */
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: 0.15s ease;
}

.category-btn:hover {
    color: #fff;
    background: #1a1a1a;
    border-color: #333;
}

.category-btn.active {
    background: rgba(255, 74, 74, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* FAVORITE BUTTON */
.favorite-btn {
    margin-bottom: 30px;
    color: #e0e0e0;
    border: 1px solid var(--border-color);
}

.favorite-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(255, 215, 0, 0.05);
}

/* ================= MAIN CONTENT ================= */

.main {
    flex: 1;
    padding: 40px 60px;
    /* Фон прозрачный, чтобы видеть градиент body */
    background: transparent;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.topbar h2 {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

/* TOP RIGHT PANEL */
.top-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Элементы верхней панели (Admin Style) */
.balance-box, .username, .cart, .lang-toggle {
    background: var(--bg-card); /* Плотный темный фон */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: 0.15s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Баланс */
.balance-box {
    padding: 10px 16px;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
}
.balance-box:hover {
    border-color: #555;
    background: #1f1f1f;
}

/* Языки */
.lang-toggle {
    display: flex;
    padding: 4px;
}
.lang-toggle button {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.4;
    transition: 0.15s;
}
.lang-toggle button.active { opacity: 1; background: #2a2a2a; }
.lang-toggle img { width: 20px; border-radius: 2px; display: block; }

/* Корзина */
.cart {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    position: relative; cursor: pointer;
}
.cart svg { width: 20px; color: #ccc; transition: 0.1s; }
.cart:hover { border-color: var(--accent); }
.cart:hover svg { color: var(--accent); }

.cart-count {
    position: absolute; top: -5px; right: -5px;
    background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 800;
    padding: 2px 6px; border-radius: 10px;
}

/* Юзер */
.username {
    padding: 10px 16px;
    color: #e0e0e0; font-size: 14px; font-weight: 600; cursor: pointer;
}
.username:hover {
    border-color: #555;
    background: #1f1f1f;
}

/* Dropdown */
.user-wrapper { position: relative; }
.user-menu {
    position: absolute; top: 120%; right: 0; width: 180px;
    background: #141414; border: 1px solid var(--border-color);
    border-radius: 12px; padding: 6px;
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.user-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu-item {
    padding: 12px 14px; font-size: 14px; color: #ccc; border-radius: 8px;
    cursor: pointer; text-decoration: none; display: block; transition: 0.1s;
}
.user-menu-item:hover { background: #222; color: #fff; }
.user-menu-item.logout { border-top: 1px solid #2a2a2a; margin-top: 4px; color: #ff5555; }
.user-menu-item.logout:hover { background: rgba(255, 85, 85, 0.1); }

/* ================= PRODUCTS (ADMIN STYLE CARDS) ================= */

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Убираем плавный переход позиции */
    transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

/* Эффект наведения: Красная рамка */
.product-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 30px var(--accent-glow);
    z-index: 2;
}

.product-image {
    height: 170px;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid var(--border-color);
    position: relative; overflow: hidden;
}

/* Картинка ВСЕГДА яркая */
.product-image img {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 1; 
}

.product-body {
    padding: 20px;
    flex: 1; display: flex; flex-direction: column;
}

.product-body h3 {
    font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px;
}

.product-body p {
    font-size: 13px; color: var(--text-muted); margin-bottom: 20px; font-weight: 500;
}

.product-footer {
    margin-top: auto; display: flex; justify-content: flex-end;
}

/* Цена в стиле кнопки */
.price-range {
    font-size: 14px; font-weight: 700; color: #fff;
    background: #1f1f1f;
    padding: 8px 14px; border-radius: 8px;
    border: 1px solid #333;
}

.product-card:hover .price-range {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ================= MODALS (ADMIN STYLE) ================= */

.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    opacity: 0; visibility: hidden; transition: 0.2s ease; z-index: 999;
}

/* Общий стиль модалок */
.modal, .form-modal, .note-modal, .delete-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
    background: #141414;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.8);
    opacity: 0; visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.overlay.active, .modal.active { opacity: 1; visibility: visible; }
.modal.active { transform: translate(-50%, -50%) scale(1); }

/* Headers */
.modal-header, .form-header, .note-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}
.modal-header h3, .form-header h3, .note-header h3 {
    font-size: 20px; font-weight: 700; color: #fff;
}

/* Close Btn */
.close-btn, .btn-close-x {
    width: 32px; height: 32px; background: transparent; border: 1px solid #333;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #888; transition: 0.2s;
}
.close-btn:hover, .btn-close-x:hover { border-color: #fff; color: #fff; background: #222; }

/* Balance Modal */
#balanceModal { width: 450px; }

.payment-methods {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}

.pay-option {
    background: #0a0a0a; border: 1px solid #2a2a2a; border-radius: 8px;
    padding: 14px; text-align: center; font-weight: 600; font-size: 14px;
    color: #ccc; cursor: pointer; transition: 0.1s;
}
.pay-option:hover { border-color: #666; color: #fff; }
.pay-option.active {
    border-color: var(--accent); color: var(--accent);
    background: rgba(255, 74, 74, 0.1);
}

.amount-section input {
    width: 100%; padding: 14px; background: #080808; border: 1px solid #2a2a2a;
    border-radius: 8px; color: #fff; font-size: 16px; outline: none; transition: 0.1s;
    margin-bottom: 16px;
}
.amount-section input:focus { border-color: var(--accent); }

/* КНОПКА ПОДТВЕРДИТЬ (ADMIN STYLE) */
.confirm-btn {
    width: 100%; padding: 14px; background: #27ae60; color: white;
    font-weight: 700; border: none; border-radius: 8px; cursor: pointer;
    font-size: 15px; transition: 0.1s;
}
.confirm-btn:hover { background: #2ecc71; }

/* ================= CART SIDE PANEL ================= */

.cart-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    opacity: 0; visibility: hidden; transition: 0.3s; z-index: 998;
}

.cart-panel {
    position: fixed; top: 0; right: -450px; width: 450px; height: 100vh;
    background: #080808; border-left: 1px solid #222;
    display: flex; flex-direction: column; transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999; box-shadow: -20px 0 60px rgba(0,0,0,0.8);
}

.cart-overlay.active { opacity: 1; visibility: visible; }
.cart-panel.active { right: 0; }

.cart-header {
    padding: 24px; border-bottom: 1px solid #222;
    display: flex; justify-content: space-between; align-items: center; background: #111;
}
.cart-header h3 { font-size: 18px; font-weight: 700; color: #fff; }
.cart-badge { background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.cart-close { font-size: 20px; color: #666; cursor: pointer; transition: 0.2s; }
.cart-close:hover { color: #fff; }
.cart-clear { color: #ff4a4a; font-size: 13px; font-weight: 600; cursor: pointer; }

.cart-items { padding: 24px; flex: 1; overflow-y: auto; }

.cart-item {
    display: flex; gap: 16px; background: #141414; border: 1px solid #2a2a2a;
    padding: 16px; border-radius: 12px; margin-bottom: 12px;
}
.cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.cart-item-info h4 { font-size: 14px; color: #fff; margin-bottom: 4px; font-weight: 600; }
.cart-item-info p { font-size: 12px; color: #777; }

.cart-qty-price { display: flex; justify-content: space-between; margin-top: 12px; align-items: center; }

.qty-box { background: #000; border: 1px solid #333; border-radius: 6px; display: flex; }
.qty-box button { width: 28px; background: none; border: none; color: #888; cursor: pointer; }
.qty-box button:hover { color: #fff; background: #222; }
.qty-box span { font-size: 13px; padding: 4px; min-width: 20px; text-align: center; color: #fff; }

.price-box span { color: var(--accent); font-weight: 700; font-size: 15px; }

.cart-footer { padding: 24px; border-top: 1px solid #222; background: #111; }
.cart-total { display: flex; justify-content: space-between; margin-bottom: 20px; color: #fff; font-size: 18px; font-weight: 700; }
.checkout-btn {
    width: 100%; padding: 14px; background: var(--accent); color: #fff; border: none;
    border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.15s;
}
.checkout-btn:hover { background: #ff1f1f; }

/* ================= SETTINGS, LOGIN & HISTORY ================= */

/* Login */
.login-body {
    /* Фон как везде */
    background-image: 
        radial-gradient(circle at 85% 10%, rgba(255, 74, 74, 0.12), transparent 40%),
        radial-gradient(circle at 15% 90%, rgba(60, 60, 60, 0.2), transparent 40%);
    background-color: var(--bg-deep);
    height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
    width: 100%; max-width: 420px; background: rgba(20, 20, 20, 0.8); backdrop-filter: blur(15px);
    border: 1px solid #333; border-radius: 20px; padding: 40px; text-align: center;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}
.login-logo { width: 60px; height: 60px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 0 20px rgba(255, 74, 74, 0.2); }
.login-title { font-size: 24px; color: #fff; font-weight: 800; margin-bottom: 10px; }
.login-subtitle { color: #666; font-size: 14px; margin-bottom: 30px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-input {
    width: 100%; padding: 16px; background: #0a0a0a; border: 1px solid #2a2a2a;
    border-radius: 8px; color: #fff; font-size: 15px; outline: none; transition: 0.2s ease;
}
.login-input:focus { border-color: var(--accent); }
.login-btn {
    margin-top: 10px; padding: 16px; background: var(--accent); color: white; font-size: 16px;
    font-weight: 700; border: none; border-radius: 8px; cursor: pointer; transition: 0.2s ease;
}
.login-btn:hover { background: #ff2222; }
.login-footer { margin-top: 24px; display: flex; justify-content: center; gap: 15px; font-size: 13px; color: #555; }
.login-link { color: #888; text-decoration: none; transition: 0.2s; }
.login-link:hover { color: #fff; }

/* Settings (Admin Style Inputs) */
.settings-container {
    max-width: 600px; background: #141414; padding: 30px; border-radius: 16px; border: 1px solid #2a2a2a;
}
.settings-group { margin-bottom: 24px; }
.settings-group label { display: block; margin-bottom: 8px; color: #aaa; font-size: 14px; }
.input-group { display: flex; align-items: center; gap: 10px; }
.settings-input, .custom-select {
    width: 100%; padding: 12px; background: #0a0a0a; border: 1px solid #2f2f2f;
    border-radius: 8px; color: white; font-size: 15px; outline: none; transition: 0.2s ease;
}
.settings-input:focus, .custom-select:focus { border-color: var(--accent); }
.settings-input:disabled { opacity: 0.6; cursor: not-allowed; background: #111; color: #777; }
.edit-icon-btn {
    background: transparent; border: 1px solid #333; border-radius: 8px;
    min-width: 44px; height: 44px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #888; transition: 0.2s ease;
}
.edit-icon-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(255, 74, 74, 0.05); }
.save-btn {
    padding: 12px 24px; background: var(--accent); color: white; border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer; transition: 0.2s ease;
}
.save-btn:hover { background: #ff2222; }
.save-btn:disabled { background: #2a2a2a; color: #555; cursor: not-allowed; }

/* Special Buttons */
.category-btn.btn-funpay:hover, .category-btn.btn-funpay.active { color: #3498db; border-color: #3498db; background: rgba(52, 152, 219, 0.1); }
.category-btn.btn-plati:hover, .category-btn.btn-plati.active { color: #f39c12; border-color: #f39c12; background: rgba(243, 156, 18, 0.1); }
.category-btn.btn-playerok:hover, .category-btn.btn-playerok.active { color: #5dade2; border-color: #5dade2; background: rgba(93, 173, 226, 0.1); }
.sidebar-separator { height: 1px; background: #2a2a2a; margin: 10px 0 20px 0; }

/* Themes */
.custom-select-wrapper { position: relative; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.theme-card {
    background: #141414; border: 1px solid #2f2f2f; border-radius: 12px; padding: 20px;
    cursor: pointer; text-align: center; transition: 0.2s ease;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.theme-card:hover { background: #1a1a1a; border-color: #444; }
.theme-card.active { border-color: #ff4a4a; background: #1b1b1b; }
.theme-radio { width: 20px; height: 20px; border: 2px solid #444; border-radius: 50%; position: relative; }
.theme-card.active .theme-radio { border-color: #ff4a4a; }
.theme-card.active .theme-radio::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 10px; height: 10px; background: #ff4a4a; border-radius: 50%;
}
.theme-icon { width: 40px; height: 40px; margin-bottom: 5px; border-radius: 50%; }
.icon-night { background: #333; border: 1px solid #555; }
.icon-day { background: #f0f0f0; border: 1px solid #ccc; }

/* Security */
.section-divider { height: 1px; background: #2f2f2f; margin: 30px 0; }
.switch-group {
    display: flex; justify-content: space-between; align-items: center;
    background: #141414; padding: 16px; border-radius: 10px; border: 1px solid #2f2f2f;
}
.switch-label h4 { font-size: 15px; margin-bottom: 4px; color: #e0e0e0; }
.switch-label p { font-size: 12px; color: #888; }
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2a2a2a; transition: .4s; border-radius: 34px; border: 1px solid #3a3a3a;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: #ff4a4a; border-color: #ff4a4a; }
input:checked + .slider:before { transform: translateX(24px); }
.outline-btn {
    padding: 10px 20px; background: transparent; border: 1px solid #ff4a4a; color: #ff4a4a;
    border-radius: 8px; cursor: pointer; font-weight: 600; transition: 0.2s ease;
}
.outline-btn:hover { background: #ff4a4a; color: white; }

/* History Table */
.history-container {
    background: #141414; border-radius: 16px; border: 1px solid #2a2a2a; overflow: hidden; margin-top: 20px;
}
.history-header {
    padding: 18px 22px; border-bottom: 1px solid #2a2a2a; font-size: 18px; font-weight: 600; color: #e0e0e0;
}
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 16px 22px; text-align: left; }
.history-table th { font-size: 13px; color: #888; background: #0f0f0f; }
.history-table tr { border-top: 1px solid #2a2a2a; transition: 0.1s ease; }
.history-table tr:hover { background: #1a1a1a; }
.date-time { display: flex; flex-direction: column; font-size: 14px; }
.date-time span:last-child { font-size: 12px; color: #888; margin-top: 2px; }
.status { font-weight: 600; }
.status-done { color: #2ecc71; }
.status-pending { color: #f39c12; }
.status-cancel { color: #ff4a4a; }
.amount-negative { color: #ff4a4a; font-weight: 600; }
.amount-positive { color: #2ecc71; font-weight: 600; }



/* CATEGORY BUTTONS (ADMIN STYLE) */
.category-btn {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: 0.15s ease;
    
    /* === НОВОЕ: Флекс для разделения текста и значков === */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-btn:hover {
    color: #fff;
    background: #1a1a1a;
    border-color: #333;
}

.category-btn.active {
    background: rgba(255, 74, 74, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* === НОВЫЕ СТИЛИ ДЛЯ ЗНАЧКОВ === */
.cat-badges {
    display: flex;
    align-items: center;
    gap: 6px; /* Расстояние между огоньком и процентом */
}

/* Стиль для процента (Скидка) */
.badge-sale {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Стиль для огонька (Hot) */
.badge-hot {
    font-size: 14px;
    /* Легкая анимация пульсации */
    animation: pulse-fire 1.5s infinite ease-in-out;
}

/* Анимация пульсации */
@keyframes pulse-fire {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 74, 74, 0)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 5px rgba(255, 100, 50, 0.6)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 74, 74, 0)); }
}