/* ========================================
   BETFITY - Complete Stylesheet
   ======================================== */

/* CSS Custom Properties */
:root {
    --bg-primary: #0E1013;
    --bg-secondary: #1A1C1F;
    --bg-tertiary: #252729;
    --bg-card: #1E2024;
    --bg-input: #2A2D31;
    --bg-hover: #2E3035;
    --bg-panel: #171A1D;

    --text-primary: #FFFFFF;
    --text-secondary: #9EA0A3;
    --text-muted: #6B6D70;

    --accent-red: #DC2626;
    --accent-red-hover: #EF4444;
    --accent-green: #22C55E;
    --accent-green-dark: #16A34A;
    --accent-green-glow: rgba(34, 197, 94, 0.3);
    --accent-blue: #34B4FF;
    --accent-purple: #913EF8;
    --accent-pink: #C017B4;
    --accent-yellow: #F59E0B;
    --accent-cyan: #06B6D4;

    --border-color: #2A2D31;
    --border-light: #3A3D41;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.4);
    --shadow-glow-red: 0 0 20px rgba(220, 38, 38, 0.4);
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    background-image: url('../images/global_bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Preloader */
body.loading-active {
    overflow: hidden;
}

#site-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0E1013;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

#site-preloader .preloader-logo {
    font-size: 48px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 3px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
}

#site-preloader .preloader-logo .highlight {
    color: #e61b1b;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots .dot {
    width: 12px;
    height: 12px;
    background: #DC2626;
    border-radius: 50%;
    animation: preloaderDotPulse 1.4s infinite ease-in-out both;
}

.loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes preloaderDotPulse {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ========================================
   HEADER
   ======================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #0E1013;
    border-bottom: 1px solid #1A1C1F;
    height: 55px;
    z-index: 1000;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transform: skewX(-10deg);
}

.logo-text {
    font-size: 24px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.logo-text .highlight {
    color: #e61b1b;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.user-balance-display {
    background: #1A1C1F;
    border-radius: 8px;
    padding: 4px 12px;
    border: 1px solid #2A2D31;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    height: 36px;
}

.user-balance-display #label {
    font-size: 10px;
    color: #22C55E;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
}

#header-balance {
    color: #22C55E;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
}

.btn-deposit {
    background: #16A34A;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    height: 36px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-deposit:hover {
    background: #22C55E;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

.btn-login {
    background: #E61B1B;
    color: white;
    border: none;
    height: 36px;
    padding: 0 24px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.btn-login:hover {
    background: #FF2E2E;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: #2A2D31;
    margin: 0 4px;
}

.header-global-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.header-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    color: #6B6D70;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
}

.header-icon i {
    font-size: 18px;
}

.header-icon:hover {
    background: #1A1C1F;
    color: white;
}

/* ========================================
   DROPDOWN MENU
   ======================================== */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #141518;
    border: 1px solid #2a2b2f;
    border-radius: 8px;
    width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
    animation: fadeInDown 0.2s ease-out forwards;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: #1e1f23;
    color: #fff;
}

.user-dropdown a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   LOBBY
   ======================================== */
.lobby-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.lobby-title {
    color: #fff;
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    font-weight: 800;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.game-card {
    background: #1a1b1f;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    border: 1px solid #2a2b2f;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: #3b82f6;
}

.game-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #2a2b2f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #4a4b4f;
}

.game-image.mines {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
}

.game-image.bottle {
    background: linear-gradient(135deg, #14532d 0%, #22c55e 100%);
    color: #fff;
}

.game-info {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.play-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.game-card:hover .play-btn {
    background: #2563eb;
}

/* ========================================
   AUTH PAGES
   ======================================== */
.auth-page {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.auth-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.auth-back {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
}

.auth-back:hover {
    background: var(--bg-tertiary);
}

.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 24px;
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    font-style: italic;
    align-self: flex-start;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--accent-cyan);
    margin-bottom: 28px;
    align-self: flex-start;
}

.auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s ease;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent-blue);
}

.form-input-group {
    position: relative;
}

.form-input-group .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.btn-auth-submit {
    width: 100%;
    padding: 12px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.btn-auth-submit:hover {
    background: var(--accent-red-hover);
    box-shadow: var(--shadow-glow-red);
}

.auth-switch {
    text-align: center;
    margin-top: 28px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent-red);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--accent-red);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-bottom: 14px;
    width: 100%;
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) transparent;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body h3 {
    color: var(--text-primary);
    margin: 14px 0 6px;
    font-size: 14px;
}

.modal-body p {
    margin-bottom: 10px;
}

/* ========================================
   PAYMENT BUTTONS
   ======================================== */
.btn-submit-payment {
    width: 100%;
    background: #28A909;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit-payment:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-submit-payment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.toast.active {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-success {
    border-left: 3px solid var(--accent-green);
}

.toast-error {
    border-left: 3px solid var(--accent-red);
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .header {
        padding: 0 10px;
        height: 48px;
    }

    .header-actions {
        gap: 4px;
    }

    .btn-deposit {
        padding: 0 10px;
        font-size: 10px;
        height: 32px;
    }

    .btn-login {
        padding: 0 12px;
        font-size: 10px;
        height: 32px;
    }

    .user-balance-display {
        min-width: 70px;
        height: 32px;
        padding: 0 8px;
    }

    #header-balance {
        font-size: 11px;
    }

    .logo-text {
        font-size: 18px;
    }

    .header-icon {
        width: 32px;
        height: 32px;
    }

    .lobby-container {
        padding: 20px 12px;
    }

    .lobby-title {
        font-size: 1.8rem;
        margin-bottom: 24px;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 100%;
    }

    .game-image {
        height: 140px;
        font-size: 3rem;
    }

    .game-title {
        font-size: 1.2rem;
    }

    .auth-container {
        padding: 24px 16px;
    }

    .auth-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 8px;
        height: 44px;
    }

    .logo-text {
        font-size: 16px;
    }

    .user-balance-display {
        min-width: 60px;
        height: 28px;
        padding: 0 6px;
    }

    .user-balance-display #label {
        font-size: 8px;
    }

    #header-balance {
        font-size: 10px;
    }

    .btn-deposit {
        padding: 0 8px;
        font-size: 9px;
        height: 28px;
        letter-spacing: 0.3px;
    }

    .btn-login {
        padding: 0 10px;
        font-size: 9px;
        height: 28px;
    }

    .header-icon {
        width: 28px;
        height: 28px;
    }

    .header-icon i {
        font-size: 14px;
    }

    .lobby-title {
        font-size: 1.5rem;
    }

    .game-image {
        height: 120px;
    }

    .modal {
        width: 95%;
        max-width: none;
    }

    .toast {
        min-width: 200px;
        max-width: 300px;
        padding: 12px 16px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}