/* ═══════════════════════════════════════════
   DonutGames — Shared Design System v2
   Premium Casino Aesthetic
═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #131720;
    --bg2:         #1a2030;
    --bg3:         #212840;
    --bg4:         #283050;
    --bg5:         #2f3860;
    --accent:      #22c55e;
    --accent-dim:  rgba(34, 197, 94, 0.15);
    --accent-glow: rgba(34, 197, 94, 0.45);
    --gold:        #fbbf24;
    --gold-dim:    rgba(251, 191, 36, 0.15);
    --gold-glow:   rgba(251, 191, 36, 0.4);
    --red:         #ef4444;
    --red-dim:     rgba(239, 68, 68, 0.15);
    --text:        #e8eef5;
    --text-muted:  #7a8baa;
    --text-dim:    #3d4f70;
    --border:      rgba(255, 255, 255, 0.1);
    --border2:     rgba(255, 255, 255, 0.06);
    --font:        'Inter', sans-serif;
    --radius:      10px;
}

html, body { height: 100%; overflow: hidden; }

/* Hide scrollbars globally */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
*::-webkit-scrollbar { display: none; } /* Chrome/Safari */

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* No padding-top: the fixed navbar overlays, layout fills full height */
}

/* ─── Page Transition Overlay ─── */
/* Starts at opacity:0 in CSS — JS sets it to 1 immediately on load */
#page-transition-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
}

/* ─────────────────────────────────────────
   LAYOUT WRAPPER
───────────────────────────────────────── */
.game-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    flex: 1;
    padding-top: 52px; /* offset for fixed navbar */
}

/* ─────────────────────────────────────────
   ICON SIDEBAR (far left, 64px)
───────────────────────────────────────── */
.icon-sidebar {
    width: 64px;
    min-width: 64px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    gap: 1px;
    z-index: 30;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}
.icon-sidebar:hover {
    width: 220px;
}

.icon-sidebar .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    box-shadow: 0 0 20px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.5);
    flex-shrink: 0;
    text-decoration: none;
    transition: 0.2s;
}
.icon-sidebar .logo-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 0 28px var(--accent-glow), 0 4px 16px rgba(0,0,0,0.5);
}

.icon-sidebar .sep {
    width: 28px;
    height: 1px;
    background: var(--border);
    margin: 4px auto;
}

.icon-btn {
    width: calc(100% - 16px);
    margin: 0 8px;
    height: 36px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 9px;
    font-size: 1.05rem;
    transition: 0.15s;
    position: relative;
    text-decoration: none;
    box-sizing: border-box;
}
.icon-btn:hover {
    background: var(--bg4);
    color: var(--text);
}
.icon-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(34,197,94,0.2);
}

.icon-btn > .nav-icon {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.icon-btn > .nav-label {
    margin-left: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
    color: inherit;
    white-space: nowrap;
}
.icon-sidebar:hover .icon-btn {
    justify-content: flex-start;
}
.icon-sidebar:hover .icon-btn > .nav-label {
    opacity: 1;
}

/* Tooltip */
.icon-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg4);
    color: var(--text);
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    border: 1px solid var(--border);
    z-index: 100;
    transition: opacity 0.12s;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.icon-btn[data-tip]:hover::after { opacity: 1; }

/* ─────────────────────────────────────────
   GAME LIST SIDEBAR — hidden, icons only mode
───────────────────────────────────────── */
.game-list {
    display: none !important;
}

.game-list::-webkit-scrollbar { width: 3px; }
.game-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.game-list-label {
    font-size: 0.63rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 14px 8px;
}

.game-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 600;
    transition: 0.14s;
    position: relative;
    border-left: 2px solid transparent;
}
.game-link:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text);
}
.game-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 700;
}
.game-link .g-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.game-list-sep {
    height: 1px;
    background: var(--border);
    margin: 10px 14px;
}

/* ─────────────────────────────────────────
   CONTROL PANEL (280px)
───────────────────────────────────────── */
.control-panel {
    width: 280px;
    min-width: 280px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    gap: 14px;
    overflow-y: auto;
    z-index: 15;
}
.control-panel::-webkit-scrollbar { width: 3px; }
.control-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.game-title {
    font-size: 1.55rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
}
.game-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* Control section */
.ctrl-section { display: flex; flex-direction: column; gap: 7px; }
.ctrl-label {
    font-size: 0.71rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Bet input row */
.bet-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.bet-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 13px;
    color: #fff;
    font-family: var(--font);
    font-size: 0.97rem;
    font-weight: 700;
    outline: none;
    transition: 0.15s;
    min-width: 0;
}
.bet-input:focus {
    border-color: rgba(255,255,255,0.18);
    background: var(--bg4);
}
.bet-input::placeholder { color: var(--text-muted); font-weight: 500; }

.bet-quick {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px;
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.14s;
    white-space: nowrap;
    flex-shrink: 0;
}
.bet-quick:hover { background: var(--bg4); color: var(--text); }

/* Generic styled select */
.ctrl-select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 13px;
    color: #fff;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    transition: 0.14s;
}
.ctrl-select:focus { border-color: rgba(255,255,255,0.18); background-color: var(--bg4); }
.ctrl-select option { background: #1a1f2e; color: #e2e8f0; }

/* Slider */
.ctrl-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    background: var(--bg3);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
.ctrl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 19px; height: 19px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: 0.12s;
}
.ctrl-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Stat row */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 10px 13px;
    border: 1px solid var(--border2);
}
.stat-row .s-label { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.stat-row .s-val   { font-size: 0.93rem; font-weight: 800; color: var(--accent); }
.stat-row .s-val.gold  { color: var(--gold); }
.stat-row .s-val.red   { color: var(--red); }

/* Difficulty/Mode tabs */
.diff-tabs { display: flex; gap: 5px; }
.diff-tab {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: 0.13s;
    text-align: center;
    font-family: var(--font);
}
.diff-tab:hover { color: var(--text); background: var(--bg4); }
.diff-tab.active {
    background: var(--accent-dim);
    border-color: rgba(34,197,94,0.35);
    color: var(--accent);
}

/* Main CTA button */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #000;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: 0.16s;
    box-shadow: 0 0 24px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.4s;
}
.btn-primary:hover:not(:disabled)::after { left: 150%; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(-1px); filter: brightness(0.95); }
.btn-primary:disabled {
    background: var(--bg3);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.btn-primary:disabled::after { display: none; }

/* Secondary/cashout button */
.btn-secondary {
    width: 100%;
    padding: 13px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.16s;
}
.btn-secondary:hover:not(:disabled) { border-color: rgba(255,255,255,0.18); color: var(--text); background: var(--bg3); }
.btn-secondary.cashout-active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 14px rgba(34,197,94,0.15);
}
.btn-secondary:disabled { opacity: 0.3; cursor: not-allowed; }

/* Provably Fair link */
.provably-fair {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    padding: 6px 0;
    transition: 0.14s;
}
.provably-fair:hover { color: var(--text); }

/* Push items to bottom */
.ctrl-spacer { flex: 1; }

/* ─────────────────────────────────────────
   MAIN GAME AREA
───────────────────────────────────────── */
.main-game {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

/* Top strip inside main game */
.game-top-bar {
    height: 50px;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
}
.game-top-bar .top-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}
.game-top-bar .top-stat .ts-label {
    font-size: 0.61rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.game-top-bar .top-stat .ts-val {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.game-top-bar .top-stat .ts-val.green { color: var(--accent); }
.game-top-bar .top-stat .ts-val.gold  { color: var(--gold);   }
.game-top-bar .top-stat .ts-val.red   { color: var(--red);    }

.game-canvas {
    flex: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* ─────────────────────────────────────────
   CHAT SIDEBAR (right, 240px)
───────────────────────────────────────── */
.chat-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.chat-header {
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
}
.chat-header .ch-title {
    font-size: 0.83rem;
    font-weight: 800;
    color: var(--text);
}
.chat-header .ch-online {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
}
.chat-header .ch-online::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.chat-messages::-webkit-scrollbar { width: 2px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg { display: flex; flex-direction: column; gap: 2px; }
.chat-msg-user {
    font-size: 0.73rem;
    font-weight: 800;
    color: var(--accent);
}
.chat-msg-user.gold  { color: var(--gold); }
.chat-msg-user.blue  { color: #60a5fa; }
.chat-msg-user.pink  { color: #f472b6; }
.chat-msg-text {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.chat-win-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(34,197,94,0.07);
    border: 1px solid rgba(34,197,94,0.18);
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.71rem;
}
.chat-win-pill .cwp-name   { font-weight: 800; color: var(--text); }
.chat-win-pill .cwp-game   { color: var(--text-muted); flex: 1; }
.chat-win-pill .cwp-amount { font-weight: 900; color: var(--accent); }

.chat-login-msg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--text-dim);
    padding: 16px;
    text-align: center;
}

.chat-input-row {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
}
.chat-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 11px;
    font-family: var(--font);
    font-size: 0.76rem;
    color: var(--text);
    outline: none;
}
.chat-input::placeholder { color: var(--text-dim); }
.chat-send {
    background: var(--accent);
    border: none;
    border-radius: 7px;
    width: 32px;
    height: 32px;
    color: #000;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.14s;
    flex-shrink: 0;
    font-weight: 800;
}
.chat-send:hover { filter: brightness(1.1); transform: scale(1.05); }

/* ─────────────────────────────────────────
   UTILITY
───────────────────────────────────────── */
.empty-state {
    color: var(--text-dim);
    font-size: 0.74rem;
    text-align: center;
    padding: 12px 0;
}

/* Animations */
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50%       { box-shadow: 0 0 0 8px transparent; }
}
@keyframes slide-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pop-in {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}
