/**
 * JET-CRASH Game Styles
 * Aviator-style crash game UI
 */

:root {
    --bg-primary: #101112;
    --bg-secondary: #1b1c1d;
    --bg-tertiary: #2c2d30;
    --brand-red: #e21543;
    --success-green: #28a909;
    --alert-orange: #d07206;
    --text-primary: #ffffff;
    --text-secondary: #9ca0a9;
    --history-blue: #3b82f6;
    --history-purple: #8b5cf6;
    --history-pink: #ec4899;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    background-color: #000;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    border-left: 1px solid #222;
    border-right: 1px solid #222;
}

@media (min-width: 481px) {
    .app-container {
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
}

/* Zone A: Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    color: var(--brand-red);
    font-weight: 900;
    font-size: 1.3rem;
    font-style: italic;
    letter-spacing: -1px;
    text-shadow: 0 0 20px rgba(226, 21, 67, 0.5);
}

.wallet-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance {
    color: var(--success-green);
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    padding: 6px 12px;
    background: rgba(40, 169, 9, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(40, 169, 9, 0.3);
}

.menu-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--bg-primary);
    color: white;
}

.login-btn {
    padding: 8px 20px;
    background: var(--success-green);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.login-btn:hover {
    opacity: 0.9;
}

/* User Menu Dropdown */
.user-menu {
    position: absolute;
    top: 60px;
    right: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    z-index: 200;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    min-width: 180px;
}

.user-menu .menu-item {
    display: block;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    border-bottom: 1px solid var(--bg-tertiary);
}

.user-menu .menu-item:last-child {
    border-bottom: none;
}

.user-menu .menu-item:hover {
    background: var(--bg-tertiary);
}

/* History Bar */
.history-bar {
    padding: 8px 12px;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    height: 45px;
    overflow: hidden;
    border-bottom: 1px solid var(--bg-tertiary);
}

.history-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.history-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.pill:hover {
    transform: scale(1.05);
}

.pill.blue {
    color: var(--history-blue);
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.pill.purple {
    color: var(--history-purple);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.pill.pink {
    color: var(--history-pink);
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

/* Zone B: Game Stage */
.game-stage {
    position: relative;
    min-height: 25vh;
    height: 25vh;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0a0a0a 0%, #101112 100%);
    border-bottom: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.stage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.multiplier-container {
    text-align: center;
}

.multiplier-text {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    font-family: 'Roboto Mono', monospace;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    transition: color 0.3s;
}

.multiplier-text.crashed {
    color: var(--brand-red);
    text-shadow: 0 0 30px rgba(226, 21, 67, 0.5);
    animation: shake 0.5s ease-in-out;
}

.multiplier-text.waiting {
    font-size: 1.8rem;
    color: var(--text-secondary);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 8px;
}

.provably-fair {
    position: absolute;
    bottom: 10px;
    left: 12px;
    font-size: 0.65rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.2s;
}

.provably-fair:hover {
    color: #888;
}

.sound-toggle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.sound-toggle:active {
    transform: translateX(-50%) scale(0.95);
}

.player-count {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 0.7rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Zone C: Betting Deck */
.betting-deck {
    background-color: var(--bg-primary);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bet-panel {
    background-color: var(--bg-secondary);
    border-radius: 10px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 12px;
    align-items: center;
}

.panel-tabs {
    grid-column: 1 / -1;
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    background: #151617;
    padding: 3px;
    border-radius: 20px;
    width: fit-content;
}

.tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background-color: var(--bg-tertiary);
    color: white;
}

.bet-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #0a0a0a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 3px;
}

.qty-btn {
    background: var(--bg-tertiary);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: var(--bg-primary);
}

.qty-btn:active {
    transform: scale(0.95);
}

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

.amount-input-wrapper input {
    width: 100%;
    background: none;
    border: none;
    color: white;
    font-weight: 700;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    padding: 6px 0;
}

.amount-input-wrapper input:focus {
    outline: none;
}

.amount-input-wrapper input::-webkit-inner-spin-button,
.amount-input-wrapper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.amount-input-wrapper input[type=number] {
    -moz-appearance: textfield;
}

.currency {
    position: absolute;
    right: 8px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.quick-bets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.quick-bets button {
    background: var(--bg-tertiary);
    border: none;
    color: #bbb;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-bets button:hover {
    background: var(--bg-primary);
    color: white;
}

/* Auto Options */
.auto-options {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--bg-tertiary);
}

.auto-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--success-green);
}

.auto-value-input {
    width: 70px;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    font-family: 'Roboto Mono', monospace;
    text-align: center;
}

.auto-value-input:focus {
    outline: none;
    border-color: var(--brand-red);
}

/* Action Button */
.action-btn {
    height: 100%;
    min-height: 70px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 rgba(0,0,0,0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    overflow: hidden;
}

.action-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bet-btn {
    background: linear-gradient(180deg, #2ed812 0%, #28a909 100%);
    color: white;
}

.cancel-btn {
    background: linear-gradient(180deg, #ff2d55 0%, #e21543 100%);
    color: white;
}

.cashout-btn {
    background: linear-gradient(180deg, #ff9500 0%, #d07206 100%);
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 0 20px rgba(208, 114, 6, 0.3); }
    50% { box-shadow: 0 4px 0 rgba(0,0,0,0.3), 0 0 30px rgba(208, 114, 6, 0.5); }
}

.action-btn .label {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-btn .sub-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 2px;
    font-family: 'Roboto Mono', monospace;
}

/* Zone D: Social Panel */
.social-panel {
    flex: 1;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    min-height: 50vh;
}

.social-tabs {
    display: flex;
    border-bottom: 1px solid var(--bg-tertiary);
}

.social-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.social-tab.active {
    color: white;
    border-bottom-color: var(--brand-red);
}

.social-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 10px 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background-color: #151617;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.social-list {
    flex: 1;
    overflow-y: auto;
    min-height: 50vh;
    max-height: none;
    scroll-behavior: smooth;
}

.social-list::-webkit-scrollbar {
    width: 4px;
}

.social-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.bet-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}

.bet-row.winner {
    background-color: rgba(40, 169, 9, 0.08);
    animation: flashGreen 0.5s ease-out;
}

.bet-row.loser {
    opacity: 0.5;
}

.bet-row.loser .mult-col,
.bet-row.loser .win-col {
    color: var(--brand-red);
}

.bet-row.more-bets {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: none;
}

@keyframes flashGreen {
    0% { background-color: rgba(40, 169, 9, 0.3); }
    100% { background-color: rgba(40, 169, 9, 0.08); }
}

.bet-row.winner .mult-col,
.bet-row.winner .win-col {
    color: var(--success-green);
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 6px;
    background: linear-gradient(135deg, var(--brand-red), var(--history-purple));
}

.user-col {
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bet-col, .mult-col, .win-col {
    text-align: right;
    font-family: 'Roboto Mono', monospace;
}

.round-summary {
    padding: 10px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.round-summary strong {
    color: var(--text-primary);
}

#bet-stats {
    font-family: 'Roboto Mono', monospace;
}

/* Live activity indicator */
.live-activity {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--success-green);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--success-green);
    border-radius: 50%;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.empty-state {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-secondary);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success-green);
}

.toast.error {
    background: var(--brand-red);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: white;
}

/* Utility Classes */
.text-green { color: var(--success-green); }
.text-red { color: var(--brand-red); }
.text-orange { color: var(--alert-orange); }
.text-muted { color: var(--text-secondary); }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* FOMO Notification System */
.fomo-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 900;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: 320px;
    pointer-events: none;
}

.fomo-notification {
    background: linear-gradient(135deg, rgba(27, 28, 29, 0.95) 0%, rgba(44, 45, 48, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    animation: fomoSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), fomoFadeOut 0.5s ease-out 4.5s forwards;
    pointer-events: auto;
    transform-origin: left center;
}

.fomo-notification.deposit {
    border-left: 3px solid var(--success-green);
}

.fomo-notification.withdrawal {
    border-left: 3px solid var(--alert-orange);
}

.fomo-notification.win {
    border-left: 3px solid #8b5cf6;
}

.fomo-notification.big_win {
    border-left: 3px solid var(--brand-red);
    background: linear-gradient(135deg, rgba(226, 21, 67, 0.15) 0%, rgba(44, 45, 48, 0.95) 100%);
    animation: fomoSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), fomoGlow 2s ease-in-out infinite, fomoFadeOut 0.5s ease-out 4.5s forwards;
}

.fomo-notification.bet {
    border-left: 3px solid #3b82f6;
}

@keyframes fomoSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-100%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes fomoFadeOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
}

@keyframes fomoGlow {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(226, 21, 67, 0.2);
    }
    50% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(226, 21, 67, 0.4);
    }
}

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

.fomo-content {
    flex: 1;
    min-width: 0;
}

.fomo-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fomo-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.fomo-amount {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--success-green);
    white-space: nowrap;
}

.fomo-notification.withdrawal .fomo-amount {
    color: var(--alert-orange);
}

.fomo-notification.big_win .fomo-amount {
    color: var(--brand-red);
    font-size: 1rem;
}

/* Mobile adjustments for FOMO */
@media (max-width: 480px) {
    .fomo-container {
        left: 10px;
        right: 10px;
        bottom: 120px;
        max-width: none;
    }
    
    .fomo-notification {
        padding: 10px 12px;
    }
    
    .fomo-icon {
        font-size: 1.2rem;
    }
    
    .fomo-message {
        font-size: 0.8rem;
    }
}

