/* app/static/css/styles.css */

/* --- Fonts & Base --- */
:root {
    --bg-deep: #050507;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #a855f7; /* Purple */
    --text-main: #ffffff;
    --text-muted: #94a3b8;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
}

/* --- Ambient Glow (Фоновые шары) --- */
.ambient-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
}

.blob-1 {
    top: -10%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #4c1d95 0%, transparent 70%);
}

.blob-2 {
    bottom: -10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #0f766e 0%, transparent 70%); /* Emerald tint */
}

/* --- Glassmorphism Components --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
    transform: scale(1.02);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    transition: all 0.2s;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Status Badges --- */
.badge {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.badge-pending {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Table Styles (History) --- */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* Отступы между строками */
}

.history-table th {
    text-align: left;
    padding: 12px 20px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-table tr.row-item {
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.history-table tr.row-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-table td {
    padding: 16px 20px;
    border: none;
}

.history-table td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.history-table td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* HTMX Loading Indicator */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* --- Новые стили Sidebar --- */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin-bottom: 8px;
    border-radius: 16px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1); /* Легкий индиго фон */
    color: #a5b4fc; /* Светлый индиго текст */
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-item i { font-size: 1.25rem; }

/* --- Стиль полоски прогресса (Subscription Bar) --- */
.progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.1); /* Серый фон трека */
    border-radius: 99px;
    height: 8px; /* Сделали повыше */
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #10b981; /* Чистый изумрудный цвет (Emerald) */
    border-radius: 99px;
    width: 0%; /* Будет задаваться через inline style в HTML */
    transition: width 1s ease-in-out;
}

/* --- Auth Forms & Inputs --- */
.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    outline: none;
    transition: all 0.3s;
    font-family: 'Outfit', sans-serif;
}

.form-input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-left: 4px;
}

.auth-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.auth-link:hover { color: var(--accent-secondary); }

/* --- Modal Animations --- */
.modal-overlay {
    transition: opacity 0.3s ease;
}
.modal-content {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Эффект пружины */
}

/* Скрытое состояние */
.modal-hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-hidden .modal-content {
    transform: scale(0.95) translateY(10px);
}

/* Видимое состояние */
.modal-visible {
    opacity: 1;
    pointer-events: auto;
}
.modal-visible .modal-content {
    transform: scale(1) translateY(0);
}

/* Chips (Кнопки быстрых сумм) */
.amount-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.amount-chip:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.2);
}
.amount-chip.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

/* app/static/css/styles.css */

/* --- МОДАЛЬНЫЕ ОКНА (ВАЖНО) --- */
.modal-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Скрыто */
.modal-hidden {
    opacity: 0;
    visibility: hidden; /* Важно: чтобы нельзя было кликнуть */
    pointer-events: none;
}
.modal-hidden .modal-content {
    transform: scale(0.95) translateY(10px);
}

/* Видимо */
.modal-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.modal-visible .modal-content {
    transform: scale(1) translateY(0);
}

/* Чипсы (Кнопки сумм) */
.amount-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.amount-chip:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.amount-chip.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

/* --- Mobile Bottom Navigation --- */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    background: rgba(5, 5, 7, 0.85); /* Чуть темнее фона, чтобы читалось */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding-bottom: env(safe-area-inset-bottom); /* Отступ для iPhone */
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    gap: 4px;
    transition: all 0.2s;
    width: 100%;
}

.mobile-nav-item i {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--accent-primary);
}

.mobile-nav-item.active i {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* --- Toggle Switch (Автопродление) --- */
.toggle-checkbox {
    display: none;
}
.toggle-label {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    border: 1px solid var(--glass-border);
}
.toggle-label::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.toggle-checkbox:checked + .toggle-label {
    background: var(--accent-primary); /* Фиолетовый при включении */
    border-color: var(--accent-primary);
}
.toggle-checkbox:checked + .toggle-label::after {
    transform: translateX(20px);
}

/* --- Plan Selection Cards --- */
.plan-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.plan-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}
.plan-card.active {
    background: rgba(99, 102, 241, 0.1); /* Indigo tint */
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}
.plan-card.active .plan-price {
    color: #fff;
}
.plan-discount {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent-primary);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 8px;
    border-bottom-left-radius: 10px;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(120%); /* Скрыт справа */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.toast-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Полоска таймера */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 100%;
    animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Типы уведомлений */
.toast-success .toast-icon { color: #10b981; }
.toast-success .toast-progress { background: #10b981; }

.toast-error .toast-icon { color: #ef4444; }
.toast-error .toast-progress { background: #ef4444; }