/* === Firewood: Monetization Styles v1.0 ===
   🔹 Стили для topup.php и transactions.php
   🔹 Адаптивность для мобильных устройств
*/

/* 🔹 Контейнеры */
.history-container,
.topup-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* 🔹 Баланс */
.balance-summary,
.balance-display {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}
.balance-summary.balance-ok,
.balance-display.balance-ok {
    background: #f0fff4;
    border: 2px solid #28a745;
}
.balance-summary.balance-low,
.balance-display.balance-low {
    background: #fff5f5;
    border: 2px solid #dc3545;
}
.balance-amount {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}
.balance-amount.ok { color: #28a745; }
.balance-amount.low { color: #dc3545; }
.balance-status {
    font-size: 14px;
    color: #6c757d;
}

/* 🔹 Таблицы с адаптивностью */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    margin: 0 -15px; /* Компенсация padding контейнера */
    padding: 0 15px;
}
.table-wrapper table {
    min-width: 600px; /* Мин. ширина, чтобы не сжималось */
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.table-wrapper th,
.table-wrapper td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}
.table-wrapper th {
    background: #f8f9fa;
    font-weight: 600;
}
.table-wrapper tr:hover { background: #f8f9fa; }
.amount-positive { color: #28a745; font-weight: 600; }
.amount-negative { color: #dc3545; font-weight: 600; }

/* 🔹 Бейджи типов транзакций */
.type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.type-subscription { background: #e7f1ff; color: #2481cc; }
.type-commission   { background: #fff3cd; color: #856404; }
.type-refund       { background: #d4edda; color: #155724; }
.type-fine         { background: #f8d7da; color: #721c24; }
.type-topup        { background: #d1ecf1; color: #0c5460; }

/* 🔹 Фильтры */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.filter-btn:hover,
.filter-btn.active {
    border-color: #2481cc;
    background: #e7f1ff;
    color: #2481cc;
}

/* 🔹 Ссылка "Назад" */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
}
.back-link:hover { color: #333; }

/* 🔹 Пустое состояние */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* 🔹 Форма пополнения */
.amount-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}
.amount-btn {
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    text-align: center;
}
.amount-btn:hover,
.amount-btn.selected {
    border-color: #2481cc;
    background: #e7f1ff;
}
.custom-amount { margin: 15px 0; }
.custom-amount input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}
.pay-btn {
    width: 100%;
    padding: 15px;
    background: #2481cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
}
.pay-btn:hover { background: #1a68a8; }
.hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 15px;
    text-align: center;
}

/* 🔹 Справка */
.info-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    color: #6c757d;
}
.info-section strong { color: #333; }
.info-section ul {
    padding-left: 20px;
    margin: 10px 0;
    line-height: 1.6;
}

/* === Finance Hub (finance.php) === */

.finance-hub {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

.finance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.finance-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #2481cc;
    display: block;
}

.finance-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.finance-card.warning { border-left-color: #dc3545; }
.finance-card.success { border-left-color: #28a745; }

.finance-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.finance-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 10px 0;
}

.finance-desc {
    font-size: 14px;
    color: #6c757d;
    margin: 5px 0 15px;
    line-height: 1.4;
}

.finance-cta {
    font-size: 14px;
    color: #2481cc;
    font-weight: 500;
}

.finance-card:hover .finance-cta {
    text-decoration: underline;
}

.balance-mini {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.balance-mini.balance-ok {
    background: #f0fff4;
    border: 2px solid #28a745;
}

.balance-mini.balance-low {
    background: #fff5f5;
    border: 2px solid #dc3545;
}

.balance-mini .amount {
    font-size: 2em;
    font-weight: bold;
    margin: 5px 0;
}

.balance-mini .amount.ok { color: #28a745; }
.balance-mini .amount.low { color: #dc3545; }

.balance-mini .status {
    font-size: 14px;
    color: #6c757d;
}

/* 🔹 АДАПТИВНОСТЬ для finance */
@media (max-width: 768px) {
    .finance-hub { margin: 10px; padding: 15px; }
    .finance-cards { grid-template-columns: 1fr; }
    .balance-mini .amount { font-size: 1.5em; }
}

/* 🔹 АДАПТИВНОСТЬ (мобильные) */
@media (max-width: 768px) {
    .history-container,
    .topup-container {
        margin: 10px;
        padding: 15px;
    }
    .balance-amount { font-size: 24px; }
    .table-wrapper table th,
    .table-wrapper table td {
        padding: 8px 10px;
        font-size: 13px;
    }
    .filter-bar { flex-direction: column; }
    .amount-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    /* Скрыть колонку "Заявка" на очень маленьких экранах */
    .table-wrapper table th:nth-child(3),
    .table-wrapper table td:nth-child(3) {
        display: none;
    }
    .amount-grid { grid-template-columns: 1fr; }
    .balance-amount { font-size: 20px; }
}

/* === Order Form (order-form.php) === */

.order-form-page {
    max-width: 700px;
    margin: 40px auto;
    padding: 20px;
}

.order-form-container {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.order-form-header {
    text-align: center;
    margin-bottom: 30px;
}

.order-form-header h1 {
    color: #2481cc;
    margin: 0 0 10px 0;
}

.order-form-header p {
    color: #6c757d;
    margin: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2481cc;
    box-shadow: 0 0 0 3px rgba(36,129,204,0.1);
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.consent-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0;
}

.consent-group input {
    width: auto;
    margin-top: 4px;
}

.consent-group label {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}

.consent-group a {
    color: #2481cc;
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: #2481cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #1a68a8;
}

.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.form-hint {
    font-size: 13px;
    color: #6c757d;
    margin-top: 5px;
}

.required {
    color: #dc3545;
}

.volume-hints {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.volume-hint {
    padding: 4px 10px;
    background: #f0f7ff;
    border: 1px solid #2481cc;
    border-radius: 20px;
    font-size: 12px;
    color: #2481cc;
    cursor: pointer;
}

.volume-hint:hover {
    background: #2481cc;
    color: #fff;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .order-form-container {
        padding: 20px;
    }
}