/* ============================================
   V-GURU VPN SERVICE — ЛИЧНЫЙ КАБИНЕТ (PWA)
   Версия: 4.1.2 | Дата: Апрель 2026
   Файл: static/css/user.css
   ============================================ */

/* ============================================
   CSS VARIABLES (:root)
   ============================================ */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --error-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --bg-primary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #764ba2;
}

/* ============================================
   LOADING SPINNER (для защиты от мигания)
   ============================================ */
#loading-spinner {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--border);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-spinner p { color: var(--text-secondary); font-size: 14px; }

/* ============================================
   USER HEADER
   ============================================ */
.user-header {
    background: var(--primary-gradient);
    color: white;
    padding: 60px 20px 40px;
    text-align: center;
    border-radius: 0 0 30px 30px;
    margin-bottom: 40px;
}

.user-header h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.user-header p {
    font-size: 14px;
    opacity: 0.9;
}

/* ============================================
   USER CONTENT
   ============================================ */
.user-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* ============================================
   STATISTICS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #e0f2fe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.purple { background: #f3e8ff; }
.stat-icon.orange { background: #ffedd5; }

.stat-info value {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-info label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   SECTION STYLES
   ============================================ */
.section {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    padding: 12px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 12px 24px;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    border-color: #667eea;
}

/* ===== НОВЫЕ КНОПКИ ДЛЯ pwa-keys.html ===== */
.btn-danger {
    padding: 12px 24px;
    background: white;
    color: #ef4444;
    border: 2px solid #fecaca;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.btn-add {
    width: 100%;
    padding: 18px;
    background: white;
    color: #667eea;
    border: 2px dashed #667eea;
    border-radius: 16px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-add:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.quick-action-btn {
    padding: 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.quick-action-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.quick-action-btn-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.quick-action-btn-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

/* ============================================
   KEY CARDS (pwa-keys.html) — ОБНОВЛЕНО
   ============================================ */
.key-card {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid #10b981;
}

.key-card.inactive {
    border-left-color: #ef4444;
}

/* ===== НОВЫЕ СТИЛИ ДЛЯ КАРТОЧКИ КЛЮЧА ===== */
.key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.key-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.key-info {
    margin-bottom: 20px;
}

.key-info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.key-info-row:last-child {
    border-bottom: none;
}

.key-info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.key-info-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.key-devices {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
}

.device-slot {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.device-slot.active {
    background: #d1fae5;
}

.device-slot.empty {
    background: #f3f4f6;
    opacity: 0.5;
}

/* ===== АВТОПРОДЛЕНИЕ — НОВЫЕ СТИЛИ ===== */
.auto-renewal-section {
    background: rgba(102, 126, 234, 0.08);
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.auto-renewal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.auto-renewal-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.auto-renewal-info {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ АВТОПРОДЛЕНИЯ — НОВЫЕ СТИЛИ ===== */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #10b981;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ===== ДЕЙСТВИЯ С КЛЮЧОМ — ОБНОВЛЕНО ===== */
.key-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.key-actions-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.key-actions .btn-primary,
.key-actions .btn-secondary,
.key-actions-secondary .btn-secondary,
.key-actions-secondary .btn-danger {
    padding: 10px 16px;
    font-size: 13px;
}

/* ============================================
   DEVICE CARDS (pwa-devices.html)
   ============================================ */
.device-card {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.device-icon {
    font-size: 32px;
}

.device-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-primary);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online { background: #10b981; }
.status-dot.offline { background: #9ca3af; }

.btn-delete {
    width: 36px;
    height: 36px;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
}

.btn-delete:hover {
    background: #fecaca;
    transform: scale(1.1);
}

/* ============================================
   REFERRAL STATS
   ============================================ */
.referral-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.referral-stat {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
}

.referral-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #667eea;
}

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

/* ============================================
   REFERRAL LINKS
   ============================================ */
.referral-links-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.referral-link-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.referral-link-item:last-child {
    border-bottom: none;
}

.referral-url {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-link-item .btn-primary {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 13px;
}

.referral-note {
    background: rgba(102, 126, 234, 0.08);
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   BALANCE SECTION
   ============================================ */
.balance-display {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 10px;
}

.balance-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   KEY STATUS GRID
   ============================================ */
.key-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.key-status-item {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
}

.key-status-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.key-status-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ============================================
   MODAL WINDOWS — СТАТИЧНЫЕ (оригинальные)
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 10000;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 760px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    margin: 0 auto;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 20px;
    color: #667eea;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: rotate(90deg);
}

.modal-header {
    padding: 30px 30px 20px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 14px;
    color: #6b7280;
}

.modal-body {
    padding: 30px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    outline: none;
}

.form-group select {
    padding: 14px 45px 14px 16px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.captcha-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.captcha-question {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 12px;
}

.captcha-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
}

.captcha-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.payment-amounts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.amount-btn {
    padding: 14px;
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.amount-btn:hover,
.amount-btn.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.balance-info {
    background: rgba(102, 126, 234, 0.08);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.balance-info-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.balance-info-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.modal-footer .btn-primary {
    width: 100%;
}

.modal-footer .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* ============================================
   TABLES
   ============================================ */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table tr:hover {
    background: #f9fafb;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green { background: #10b981; }

/* ============================================
   CHAT BUTTON
   ============================================ */
.chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    z-index: 999;
    border: none;
    opacity: 0.9;
}

.chat-button:hover {
    transform: scale(1.1);
    opacity: 1;
}

.chat-button-icon {
    font-size: 28px;
    color: white;
}

/* ============================================
   FAQ ACCORDION (pwa-faq.html)
   ============================================ */
.faq-section {
    margin-bottom: 25px;
}

.faq-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.faq-item {
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-question {
    padding: 18px 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.faq-question:hover {
    background: #f3f4f6;
}

.faq-question::after {
    content: '+';
    font-size: 24px;
    color: #667eea;
    transition: transform 0.3s;
}

.faq-item.active .faq-question::after {
    content: '−';
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s;
    color: var(--text-secondary);
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    padding: 0 20px 20px;
    max-height: 500px;
}

.faq-answer ul {
    margin-left: 20px;
    margin-top: 10px;
}

.faq-answer li {
    margin-bottom: 8px;
}

/* ============================================
   BACK BUTTON
   ============================================ */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 25px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.back-button:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* ============================================
   WARNING BOX
   ============================================ */
.warning-box {
    background: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   RESPONSIVE — ПЛАНШЕТ (≤1024px)
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .referral-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .key-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   RESPONSIVE — МОБИЛЬНЫЕ (≤768px)
   ============================================ */
@media (max-width: 768px) {
    .user-header {
        padding: 50px 15px 35px;
    }
    
    .user-header h1 {
        font-size: 24px;
    }
    
    .section {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .referral-stats {
        grid-template-columns: 1fr;
    }
    
    .key-status-grid {
        grid-template-columns: 1fr;
    }
    
    .balance-actions {
        justify-content: center;
    }
    
    .chat-button {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
    }
    
    .referral-link-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .referral-url {
        width: 100%;
        white-space: normal;
        word-break: break-all;
    }
    
    .referral-link-item .btn-primary {
        width: 100%;
    }
    
    .key-info {
        grid-template-columns: 1fr;
    }
    
    .key-actions,
    .key-actions-secondary {
        grid-template-columns: 1fr;
    }
    
    .key-actions .btn-primary,
    .key-actions .btn-secondary,
    .key-actions-secondary .btn-secondary,
    .key-actions-secondary .btn-danger {
        width: 100%;
    }
}

/* ============================================
   RESPONSIVE — ОЧЕНЬ МАЛЕНЬКИЙ (≤480px)
   ============================================ */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .user-header h1 {
        font-size: 22px;
    }
    
    .stat-info value {
        font-size: 28px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .balance-display {
        font-size: 28px;
    }
    
    .key-name {
        font-size: 16px;
    }
	
	.modal-body {
    padding: 10px 30px 10px 30px;
	}
}

/* ============================================
   FAQ PAGE SPECIFIC STYLES (pwa-faq.html)
   ============================================ */

/* ----- Section Accordion (FAQ) ----- */
.section-header {
    cursor: pointer;
    user-select: none;
}

.section-header:hover {
    background: rgba(102, 126, 234, 0.05);
}

.section-toggle {
    font-size: 24px;
    color: #667eea;
    transition: transform 0.3s;
    flex-shrink: 0;
    line-height: 1;
}

.section.active .section-toggle {
    transform: rotate(45deg);
}

.section-content {
    display: none;
    padding-top: 10px;
}

.section.active .section-content {
    display: block;
}

/* ----- FAQ Items ----- */
.faq-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.faq-question {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.faq-answer {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 28px;
}

.faq-answer strong {
    color: var(--text-primary);
}

.faq-answer ul,
.faq-answer ol {
    margin: 10px 0 10px 20px;
    padding-left: 10px;
}

.faq-answer li {
    margin-bottom: 8px;
}

.faq-answer ol li {
    list-style-type: decimal;
}

.faq-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 25px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.faq-back-button:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* ----- Highlight Boxes ----- */
.highlight-box {
    background: rgba(102, 126, 234, 0.08);
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin: 15px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.highlight-box.warning {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
}

.highlight-box.success {
    background: rgba(16, 185, 129, 0.08);
    border-left-color: #10b981;
}

.highlight-box.info {
    background: rgba(14, 165, 233, 0.08);
    border-left-color: #0ea5e9;
}

/* ----- Code Examples ----- */
.code-example {
    background: #1a1a1a;
    color: #10b981;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    margin: 10px 0;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ----- App Links Grid ----- */
.app-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.app-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
}

.app-link:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.app-link-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.app-link-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.app-link-title {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-link-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.app-link-download {
    font-size: 20px;
    color: #667eea;
    margin-left: auto;
    flex-shrink: 0;
}

/* ----- Mobile Adjustments for FAQ ----- */
@media (max-width: 768px) {
    .faq-question {
        font-size: 14px;
    }
    
    .faq-answer {
        padding-left: 24px;
    }
    
    .app-links {
        grid-template-columns: 1fr;
    }
    
    .highlight-box {
        font-size: 12px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .faq-question {
        font-size: 13px;
    }
    
    .faq-answer {
        font-size: 13px;
        padding-left: 20px;
    }
}

/* ===== FAQ PAGE SPECIFIC STYLES ===== */

/* Только для страницы FAQ */
.faq-page .section-header {
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px;
    cursor: pointer;
}

.faq-page .section-title {
    flex: 1;
    font-size: 15px;
}

.faq-page .section-toggle {
    flex-shrink: 0;
    font-size: 20px;
    width: 30px;
    text-align: center;
    color: #667eea;
    transition: transform 0.3s;
}

.faq-page .section.active .section-toggle {
    transform: rotate(45deg);
}

/* Мобильная адаптация только для FAQ */
@media (max-width: 768px) {
    .faq-page .section-header {
        padding: 15px 20px;
    }
    
    .faq-page .section-title {
        font-size: 14px;
    }
    
    .faq-page .section-toggle {
        font-size: 18px;
        width: 28px;
    }
}

@media (max-width: 480px) {
    .faq-page .section-header {
        padding: 12px 15px;
    }
    
    .faq-page .section-toggle {
        font-size: 16px;
        width: 26px;
    }
}

/* ============================================ */
/* МОБИЛЬНЫЕ КНОПКИ В section-header */
/* ============================================ */
@media (max-width: 768px) {
    
    /* Принудительно растягиваем section-header */
    .section-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Принудительно растягиваем кнопки */
    .section-header .btn-primary {
        width: 100% !important;
        display: block !important;
        text-align: center !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
        margin: 0 !important;
        flex: 1 !important;
    }
    
    /* Если кнопки в обёртке */
    .section-header .btn-group,
    .section-header .buttons,
    .section-header .balance-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }
    
    .section-header .btn-group .btn-primary,
    .section-header .buttons .btn-primary,
    .section-header .balance-actions .btn-primary {
        width: 100% !important;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .section-header .btn-primary {
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
}

/* ============================================================================
   🔥 УСТРОЙСТВА (pwa-devices.html) — НОВЫЕ СТИЛИ
   ============================================================================ */

/* Инфо о лимите устройств */
.device-limit-info {
    background: rgba(102, 126, 234, 0.08);
    border-left: 4px solid #667eea;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Список устройств */
.device-list {
    display: grid;
    gap: 12px;
}

/* Карточка устройства */
.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f9fafb;
    border-radius: 10px;
    gap: 15px;
}

/* Левая часть: иконка + имя */
.device-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Иконка устройства */
.device-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* Имя устройства (с обрезкой) */
.device-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Статус устройства */
.device-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.device-status.online {
    background: #d1fae5;
    color: #065f46;
}

.device-status.offline {
    background: #f3f4f6;
    color: #6b7280;
}

/* Кнопка удаления устройства */
.btn-delete {
    width: 32px;
    height: 32px;
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
}

.btn-delete:hover {
    background: #fecaca;
    transform: scale(1.1);
}

/* ============================================================================
   🔥 АДАПТИВ ДЛЯ УСТРОЙСТВ (мобильные)
   ============================================================================ */
@media (max-width: 768px) {
    .device-name {
        max-width: 70px;
        font-size: 14px;
    }
    
    .device-item {
        padding: 10px 12px;
    }
    
    .device-left {
        gap: 8px;
    }
    
    .device-icon {
        font-size: 18px;
    }
    
    .device-status {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .btn-delete {
        width: 28px;
        height: 28px;
        font-size: 16px;
        margin-left: 5px;
    }
}

@media (max-width: 480px) {
    .device-name {
        max-width: 60px;
    }
    
    .btn-delete {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
}

/* ============================================================================
   🔥 МОДАЛЬНЫЕ ОКНА — БАЗОВЫЕ СТИЛИ (десктоп)
   ============================================================================ */
.modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 100%;
    width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

.modal-content {
    white-space: pre-line;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
    text-align: left;
}

/* ============================================================================
   🔥 АДАПТИВ ДЛЯ МОБИЛЬНЫХ (≤480px)
   ============================================================================ */
@media (max-width: 480px) {
    .modal-card {
        padding: 20px;
        width: 95%;
    }
    
    .modal-content {
        font-size: 12px;
    }
	
	.referral-url {
        font-size: 11px;
    }
}

/* ============================================================================
   🔥 ТРАФИК — МОБИЛЬНАЯ ВЕРСИЯ (вертикальное расположение)
   ============================================================================ */
@media (max-width: 480px) {
    .traffic-footer {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    
    .traffic-footer .btn-secondary {
        width: 100% !important;
        text-align: center !important;
    }
}

/* ============================================================================
   🔥 CSS для бейджа TRIAL
   ============================================================================ */
.badge-trial {
    display: inline-block;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ============================================================================
   🔥 ВЫПИСКА ПО ДАТАМ (минимальные стили)
   ============================================================================ */
.export-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.export-date-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.export-date-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.export-date-field input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

.export-date-field input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

.export-hint {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    margin-top: 15px;
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
    .export-date-grid {
        grid-template-columns: 1fr;
    }
    .modal-footer {
        flex-direction: column-reverse;
    }
    .modal-footer .btn-primary,
    .modal-footer .btn-secondary {
        width: 100%;
    }
	.export-hint {
    font-size: 12px;
	}
	
	.modal-footer {
		margin-top: 0px;
	}
}

/* ============================================================================
   🔥 КАЛЕНДАРЬ: кастомная иконка для мобильных
   ============================================================================ */

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper input[type="date"] {
    width: 100%;
    padding: 10px 40px 10px 10px; /* Отступ справа для иконки */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    appearance: none; /* Скрываем стандартную иконку */
    -webkit-appearance: none;
    -moz-appearance: none;
}

.date-input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Прозрачный, но кликабельный */
    cursor: pointer;
}

.date-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none; /* Чтобы клики проходили сквозь иконку */
    z-index: 1;
    color: var(--text-secondary);
}

/* Фокус на поле */
.date-input-wrapper input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

/* ============================================================================
   🔥 ПРОМОКОД: стили для модалки создания ключа
   ============================================================================ */

.promo-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.promo-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.promo-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.promo-input:focus {
    outline: none;
    border-color: #667eea;
}

.promo-check-btn {
    padding: 12px 20px;
    white-space: nowrap;
}

.promo-result {
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 10px;
}

.promo-discount-display {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.promo-discount-badge {
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.promo-original-price {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.promo-new-price {
    color: #10b981;
    font-weight: 600;
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
    .promo-input-group {
        flex-direction: column;
    }
    .promo-check-btn {
        width: 100%;
    }
    .promo-discount-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* ============================================================================
   🔥 QR MODAL — ТОЛЬКО ДЛЯ #qrModal (не влияет на другие модалки)
   ============================================================================ */

/* Компактная модалка для QR */
#qrModal .modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalPop 0.25s ease;
    position: relative;
    overflow: hidden;
    margin: auto;
}

#qrModal .qr-modal-body {
		padding: 30px;
	}

@keyframes modalPop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* QR контейнер */
#qrcode-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
}

#qrcode-container canvas,
#qrcode-container img {
    width: 180px !important;
    height: 180px !important;
    display: block;
}

/* Уведомление внутри QR модалки */
.modal-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1001;
    animation: notifyFade 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	white-space: nowrap; /* 🔥 Запрет переноса строки */
    max-width: 90%;      /* 🔥 Не шире 90% от модалки */
}

@keyframes notifyFade {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Адаптив для QR модалки */
@media (max-width: 480px) {
    #qrModal .modal {
        max-width: 280px;
    }
    
    #qrcode-container canvas,
    #qrcode-container img {
        width: 160px !important;
        height: 160px !important;
    }
	
	.modal-notification {
        font-size: 13px;
        padding: 10px 16px;
    }
	
	#qrModal .qr-modal-body {
		padding: 10px 30px 25px 30px;
	}
}

container.className = 'payment-amounts';

/* ============================================================================ */
/* ✅ КОНЕЦ USER.CSS */
/* ============================================================================ */