/* webapp/style.css */

/* --- GLOBAL THEME --- */
:root { --bg-deep: #0f172a; --accent: #6366f1; }

body { 
    font-family: 'Manrope', sans-serif; 
    background-color: var(--bg-deep); 
    color: #ffffff; 
    padding-bottom: 120px;
    background: radial-gradient(circle at top left, #1e293b, #0f172a, #020617);
    background-attachment: fixed;
    min-height: 100vh;
}

.no-scrollbar::-webkit-scrollbar { display: none; }

/* HEADER & PANELS */
.glass-panel {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.glass-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.solid-nav {
    background-color: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}

/* FILTER PANEL (INLINE) */
.filter-panel-inline {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid rgba(255,255,255,0);
}
.filter-panel-inline.open {
    max-height: 800px;
    opacity: 1;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 10px;
    padding-top: 15px;
    padding-bottom: 5px;
}

#docsWrapper.open {
    max-height: 1000px; /* Достаточно для 20-30 документов */
    margin-bottom: 15px;
}

#docsCaret.rotate {
    transform: rotate(180deg);
}

/* BADGES */
.badge-solid { opacity: 1 !important; color: white; font-weight: 800; box-shadow: 0 4px 10px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); z-index: 10; }
.bg-etp { background-color: #2563eb; } .bg-sauda { background-color: #db2777; }

/* REC STATUS BADGES */
.badge-rec { padding: 2px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; }
.rec-green { background: rgba(34, 197, 94, 0.15); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }
.rec-yellow { background: rgba(234, 179, 8, 0.15); color: #facc15; border-color: rgba(234, 179, 8, 0.3); }
.rec-red { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.rec-gray { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.3); }

/* ANIMATION */
@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}
.animate-pop { animation: heart-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* MODAL */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0f172a; z-index: 200; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); display: flex; flex-direction: column; }
.modal.open { transform: translateY(0); }

.sort-btn.active { background-color: #2563eb; color: white; border-color: #2563eb; }
.fav-cat-btn.active, .fav-site-btn.active { background-color: #2563eb; color: white; border-color: #2563eb; }

.attr-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; align-items: center; }
.attr-label { color: #94a3b8; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.attr-value { color: #f1f5f9; font-weight: 700; text-align: right; max-width: 60%; line-height: 1.2; }
.stars { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; background-image: radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)), radial-gradient(1px 1px at 40px 70px, #fff, rgba(0,0,0,0)); background-size: 200px 200px; opacity: 0.2; }

select { -webkit-appearance: none; appearance: none; }
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* --- BILLING STYLES --- */

/* Переключатель Периода */
.billing-toggle {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    position: relative;
    margin-bottom: 20px;
}

.billing-toggle button {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    z-index: 2;
    transition: color 0.3s;
}

.billing-toggle button.active {
    color: white;
}

.toggle-bg {
    position: absolute;
    top: 4px; bottom: 4px; left: 4px;
    width: calc(33.33% - 5px);
    background: #2563eb;
    border-radius: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
}

/* Карточки планов */
.plan-card {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.02);
    transition: all 0.2s;
}
.plan-card.selected {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.2);
}
.plan-card.best-value {
    border-color: #eab308;
    background: linear-gradient(145deg, rgba(234, 179, 8, 0.1), transparent);
}
.plan-card.best-value.selected {
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.2);
}

/* Kaspi Button */
.kaspi-btn {
    background: #f14635; /* Kaspi Red */
    color: white;
    font-family: 'Manrope', sans-serif; 
}
.kaspi-btn:active {
    background: #d93f30;
    transform: scale(0.98);
}

/* Progress Bar в профиле */
.progress-track {
    background: rgba(255,255,255,0.1);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #a855f7);
    border-radius: 3px;
    width: 0%;
    transition: width 1s ease-out;
}

/* --- DESKTOP ADAPTATION (ПК ВЕРСИЯ - ИСПРАВЛЕННАЯ) --- */
@media (min-width: 640px) {
    /* 1. Настраиваем фон страницы */
    body {
        background: #020617;
        background-image: 
            radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(219, 39, 119, 0.05) 0%, transparent 50%);
        min-height: 100vh;
        width: 100%;
        display: block; /* Убираем flex, используем стандартный поток */
    }

    /* 2. Фон звезд на весь экран */
    .stars {
        position: fixed;
        width: 100vw;
        height: 100vh;
        left: 0; top: 0;
        z-index: -1;
    }

    /* 3. Основной контейнер экрана - СТРОГО ПО ЦЕНТРУ */
    .screen {
        width: 100%;
        max-width: 1280px; /* Максимальная ширина */
        margin-left: auto !important;  /* Толкаем слева */
        margin-right: auto !important; /* Толкаем справа */
        
        background: #0f172a;
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
        min-height: 100vh;
        position: relative;
        border-left: 1px solid rgba(255,255,255,0.05);
        border-right: 1px solid rgba(255,255,255,0.05);
    }

    /* 4. Центрируем ШАПКУ и МЕНЮ (Fixed элементы) */
    /* Хак: left:0 + right:0 + margin:auto заставляет fixed элемент встать по центру */
    .fixed, .glass-panel, .solid-nav, #mainHeader {
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 1280px !important;
        width: 100% !important;
    }

    /* 5. Модальные окна - делаем узкими и по центру */
    .modal {
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 500px !important; /* Оставляем размер как на мобильном */
        
        border-left: 1px solid rgba(255,255,255,0.1);
        border-right: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 0 100px rgba(0,0,0,0.8);
    }

    /* Красивый скроллбар */
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: #0f172a; }
    ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #475569; }

    .plan-features {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .plan-feature-row {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 10px;
        color: #94a3b8;
        margin-bottom: 4px;
    }
    
    .plan-feature-row i {
        font-size: 12px;
    }
    
    .plan-feature-row.highlight {
        color: #fff;
        font-weight: 600;
    }
    
    .plan-card.best-value {
        background: linear-gradient(145deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.05));
        border-color: rgba(37, 99, 235, 0.4);
    }
    
    .plan-card.premium-value {
        background: linear-gradient(145deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
        border-color: rgba(168, 85, 247, 0.4);
    }
    
}

