/**
 * Bot4Games - Main Styles
 * Загальні стилі для всього сайту
 */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    line-height: 1.6;
}

/* === HEADER === */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

.logo:hover {
    color: #5568d3;
}

/* === USER INFO === */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.user-name {
    color: #333;
    font-weight: 500;
    font-size: 15px;
}

/* Ім'я з аватаром — посилання на профіль (колишня карта-привітання) */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    border-radius: 999px;
    padding: 2px;
    transition: background .15s;
}
.user-chip:hover { background: rgba(102, 126, 234, .1); }

/* Баланс у шапці: веде на поповнення */
.balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f3f0ff;
    color: #4b3fa7;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}
.balance-chip:hover { background: #e8e3ff; }

/* Підвал панелі: Telegram, підтримка, профіль, вихід */
.panel-footer {
    max-width: 900px;
    margin: 30px auto 24px;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    font-size: 14px;
}
.panel-footer a {
    color: #777;
    text-decoration: none;
}
.panel-footer a:hover { color: #4b3fa7; text-decoration: underline; }

.page-title {
    color: #fff;
    font-size: 24px;
    margin: 0 0 18px;
}
.profile-balance { font-size: 22px; margin: 0 0 4px; }
.mt-2 { margin-top: 14px; }

/* === BUTTONS === */
.btn, button[type="submit"] {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary, button[type="submit"] {
    background: #667eea;
    color: white;
}

.btn-primary:hover, button[type="submit"]:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.btn-primary:active, button[type="submit"]:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.logout-btn, .back-btn {
    padding: 8px 16px;
    font-size: 14px;
    text-decoration: none;
    border-radius: 8px;
    color: white;
}

.logout-btn {
    background: #e74c3c;
}

.logout-btn:hover {
    background: #c0392b;
}

.back-btn {
    background: #6c757d;
    color: white;
    text-decoration: none;
}

.back-btn:hover {
    background: #5a6268;
}

/* === CONTAINER === */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* === CARDS === */
.card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Проста біла карта. Раніше звалась .welcome-card — так її охрестила карта-привітання
   кабінету, якої вже немає; лишилась як загальний контейнер (наприклад, у /topup). */
.panel-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.panel-card h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}
.panel-card p {
    color: #666;
    font-size: 16px;
}

/* === SECTIONS === */
.accounts-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #333;
    font-size: 22px;
}

.add-account-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.add-account-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* === ACCOUNTS LIST === */
.accounts-list {
    display: grid;
    gap: 20px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.account-card:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-info h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-game {
    color: #666;
    font-size: 14px;
    margin-bottom: 3px;
}

.account-login {
    color: #888;
    font-size: 13px;
    margin-bottom: 5px;
}

.account-status {
    font-size: 13px;
    margin-top: 5px;
}

.status-success {
    color: #28a745;
    font-weight: 500;
}

.status-error {
    color: #dc3545;
    font-weight: 500;
}

.status-pending {
    color: #ffc107;
    font-weight: 500;
}

.account-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-details, .btn-delete {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-details {
    background: #667eea;
    color: white;
}

.btn-details:hover {
    background: #5568d3;
}

.btn-delete {
    background: white;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-delete:hover {
    background: #dc3545;
    color: white;
}

/* === FORMS === */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

label .required {
    color: #e74c3c;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

.help-text {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.password-toggle {
    position: relative;
}

.password-toggle input {
    padding-right: 45px;
}

.toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}


/* === ПЕРЕМИКАЧ (замість прапорця) ===
   Розмір задається змінними, тож .toggle-sm лише їх перекриває. */
.toggle-switch {
    --tg-w: 48px;
    --tg-h: 26px;
    --tg-pad: 3px;
    --tg-on: #27ae60;
    position: relative;
    display: inline-block;
    flex: none;
    width: var(--tg-w);
    height: var(--tg-h);
    margin: 0;
    vertical-align: middle;
}

.toggle-switch.toggle-sm {
    --tg-w: 42px;
    --tg-h: 23px;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #cfd4dc;
    border-radius: 999px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
    transition: background-color .25s ease, box-shadow .25s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    top: var(--tg-pad);
    left: var(--tg-pad);
    width: calc(var(--tg-h) - var(--tg-pad) * 2);
    height: calc(var(--tg-h) - var(--tg-pad) * 2);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .25s cubic-bezier(.3, 1.4, .5, 1), width .15s ease;
}

.toggle-switch input:not(:checked):not(:disabled) + .toggle-slider:hover {
    background: #c2c8d2;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--tg-on);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
}

.toggle-switch input:checked:not(:disabled) + .toggle-slider:hover {
    filter: brightness(1.06);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(calc(var(--tg-w) - var(--tg-h)));
}

/* Видно, де фокус, бо сам прапорець прихований */
.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .35);
}

/* Натиснуто — кнопка трохи витягується */
.toggle-slider:active:before {
    width: calc(var(--tg-h) - var(--tg-pad) * 2 + 3px);
}

/* Вимкнений: приглушений, але стан (увімкнено/ні) лишається видним */
.toggle-switch.disabled .toggle-slider,
.toggle-switch input:disabled + .toggle-slider {
    cursor: not-allowed;
    filter: grayscale(.55);
    opacity: .55;
}

@media (prefers-reduced-motion: reduce) {
    .toggle-slider,
    .toggle-slider:before {
        transition: none;
    }
}

/* === ALERTS === */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 14px;
}

.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

.alert-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #004085;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 25px 20px;
    }
    
    .panel-card h1 {
        font-size: 24px;
    }
    
    .account-card {
        flex-direction: column;
        text-align: center;
    }
    
    .account-info {
        text-align: center;
    }
    
    .account-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-details, .btn-delete {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .add-account-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .panel-card h1 {
        font-size: 22px;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
}

/* === UTILITIES === */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden {
    display: none;
}
/* === ПЕРЕМИКАЧ МОВИ === */
/* Перемикач мов — випадаючий <details>: кнопка з поточною мовою, під нею список */
.lang-switch {
    position: relative;
    flex-shrink: 0;
}

.lang-switch > summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #f0f2ff;
    border-radius: 8px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::after {
    content: "▾";
    font-size: 10px;
    opacity: .7;
}
.lang-switch > summary:hover { background: #e2e6ff; }
.lang-switch[open] > summary { background: #e2e6ff; }
.lang-switch > summary:focus-visible { outline: 2px solid #667eea; outline-offset: 2px; }

.lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-width: 92px;
    padding: 4px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.lang-menu a {
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    white-space: nowrap;
}
.lang-menu a:hover { background: #f0f2ff; color: #667eea; }
.lang-menu a.active { background: #667eea; color: #fff; }

/* У підвалі списку нема куди падати вниз — відкриваємо вгору */
.lang-switch-up .lang-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.lang-switch-corner {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}
.lang-switch-corner > summary {
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

/* === Телефон: шапка === */
.user-avatar {
    flex-shrink: 0;
}

.logout-btn,
.back-btn,
.header-btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .user-info {
        gap: 10px;
        flex-wrap: nowrap;
    }
    .user-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 400px) {
    /* ім'я не вміщається: лишається аватар з першою літерою, баланс лишаємо — він важливіший */
    .user-name {
        display: none;
    }
    .balance-chip {
        padding: 5px 9px;
        font-size: 13px;
    }
    .user-info .logout-btn {
        margin-left: auto;
    }
}

@media (max-width: 300px) {
    .user-info {
        gap: 6px;
    }
    .user-info .logout-btn,
    .user-info .back-btn {
        padding: 8px 10px;
    }
}

/* Довгий і короткий варіант підпису: короткий на вузьких екранах */
.label-short {
    display: none;
}

@media (max-width: 400px) {
    .label-long {
        display: none;
    }
    .label-short {
        display: inline;
    }
}
