@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0616;
    --bg-secondary: #0f0c20;
    --bg-surface: rgba(26, 21, 48, 0.45);
    --bg-surface-hover: rgba(38, 30, 70, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-purple: #8a2be2;
    --accent-purple-glow: rgba(138, 43, 226, 0.35);
    --accent-pink: #ff007f;
    --accent-pink-glow: rgba(255, 0, 127, 0.35);
    --accent-cyan: #00ffff;
    --accent-cyan-glow: rgba(0, 255, 255, 0.35);
    --accent-gold: #ffd700;
    --accent-green: #39ff14;
    --text-main: #ffffff;
    --text-muted: #b0a9cd;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: radial-gradient(circle at 50% 50%, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(138, 43, 226, 0.1);
}

/* Page Header & Navigation */
header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 6, 22, 0.7);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 0 15px var(--accent-purple-glow);
    animation: rotate-logo 10s infinite linear;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 15px;
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.4), 0 0 10px var(--accent-purple-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.2);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 114, 255, 0.4), 0 0 10px var(--accent-cyan-glow);
}

.btn-danger {
    background: linear-gradient(135deg, #d31027 0%, #ea384d 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(234, 56, 77, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* Home Portal Design (index.html) */
.portal-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.portal-hero {
    text-align: center;
    margin-bottom: 50px;
    animation: fade-in-up 0.8s ease;
}

.portal-title {
    font-size: 64px;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff 30%, var(--accent-pink) 70%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(138, 43, 226, 0.2);
}

.portal-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.portal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 900px;
    animation: fade-in-up 1s ease;
}

.portal-card {
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 380px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(138, 43, 226, 0.15), transparent 60%);
    opacity: 0;
    transition: var(--transition);
}

.portal-card:hover::before {
    opacity: 1;
}

.portal-card:hover {
    transform: translateY(-8px);
}

.portal-card-caller:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 40px rgba(0, 255, 255, 0.15);
}

.portal-card-player:hover {
    border-color: var(--accent-pink);
    box-shadow: 0 10px 40px rgba(255, 0, 127, 0.15);
}

.portal-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.portal-card-caller .portal-card-icon {
    color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.05);
    border-color: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.05);
}

.portal-card-player .portal-card-icon {
    color: var(--accent-pink);
    background: rgba(255, 0, 127, 0.05);
    border-color: rgba(255, 0, 127, 0.2);
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.05);
}

.portal-card h2 {
    font-size: 26px;
    margin-bottom: 12px;
}

.portal-card p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Page Layouts for Game & Sorteio */
.game-container {
    max-width: 1400px;
    width: 100%;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    flex-grow: 1;
}

@media (max-width: 992px) {
    .game-container {
        grid-template-columns: 1fr;
    }
}

/* Left Sidebar: Stats & Game Info */
.sidebar-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: fit-content;
}

.stats-card {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stats-value {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.stats-value.pulse-neon {
    animation: neon-pulse-pink 2s infinite alternate;
}

/* Current Draw Panel */
.current-draw-card {
    text-align: center;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
}

.ball-display {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 64px;
    font-weight: 800;
    background: radial-gradient(circle at 30% 30%, #fff 0%, #e0e0e0 20%, #a0a0a0 80%, #606060 100%);
    color: #111;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), inset 0 -10px 20px rgba(0,0,0,0.4), inset 0 10px 20px rgba(255,255,255,0.8);
    position: relative;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ball-display.pop-anim {
    animation: ball-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.ball-letter {
    position: absolute;
    top: 15px;
    font-size: 14px;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 700;
    text-transform: uppercase;
}

.ball-number {
    margin-top: 10px;
}

/* Color themed bingo balls based on letters */
.ball-B { background: radial-gradient(circle at 30% 30%, #ff9ebb 0%, #ff4081 50%, #c60055 100%); color: white; }
.ball-I { background: radial-gradient(circle at 30% 30%, #9effeb 0%, #00e5ff 50%, #00b2cc 100%); color: white; }
.ball-N { background: radial-gradient(circle at 30% 30%, #e8bbff 0%, #d500f9 50%, #9e00c5 100%); color: white; }
.ball-G { background: radial-gradient(circle at 30% 30%, #ffe9a6 0%, #ffab00 50%, #c67c00 100%); color: white; }
.ball-O { background: radial-gradient(circle at 30% 30%, #b2ffba 0%, #00e676 50%, #00b348 100%); color: #000; }

.ball-display.ball-B .ball-letter,
.ball-display.ball-I .ball-letter,
.ball-display.ball-N .ball-letter,
.ball-display.ball-G .ball-letter {
    color: rgba(255, 255, 255, 0.7);
}

.ball-display.ball-O .ball-letter {
    color: rgba(0, 0, 0, 0.6);
}

/* History Box */
.history-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-purple) transparent;
}

.history-list::-webkit-scrollbar {
    height: 4px;
}
.history-list::-webkit-scrollbar-thumb {
    background-color: var(--accent-purple);
    border-radius: 4px;
}

.history-ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Main Panel for Player (jogar.html) */
.main-game-panel {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Bingo Card Component */
.bingo-card-wrapper {
    max-width: 550px;
    width: 100%;
    margin: 0 auto;
    perspective: 1000px;
}

.bingo-card {
    width: 100%;
    padding: 24px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.bingo-card-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    text-align: center;
    margin-bottom: 12px;
}

.bingo-letter {
    font-size: 32px;
    font-weight: 900;
    font-family: var(--font-heading);
    text-shadow: 0 0 10px var(--accent-purple-glow);
}

.bingo-letter:nth-child(1) { color: #ff4081; }
.bingo-letter:nth-child(2) { color: #00e5ff; }
.bingo-letter:nth-child(3) { color: #d500f9; }
.bingo-letter:nth-child(4) { color: #ffab00; }
.bingo-letter:nth-child(5) { color: #00e676; }

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.bingo-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: var(--transition);
}

@media (max-width: 480px) {
    .bingo-cell {
        font-size: 18px;
    }
    .bingo-letter {
        font-size: 24px;
    }
}

.bingo-cell:hover:not(.free-space):not(.marked) {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Free space styling */
.bingo-cell.free-space {
    background: rgba(138, 43, 226, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
    cursor: default;
}

/* Marked cell styling */
.bingo-cell.marked::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 0, 127, 0.7) 0%, rgba(138, 43, 226, 0.7) 70%, transparent 100%);
    box-shadow: 0 0 15px var(--accent-pink-glow), inset 0 0 8px rgba(255,255,255,0.4);
    z-index: 1;
    animation: mark-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.bingo-cell.marked .cell-value {
    z-index: 2;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.bingo-cell.marked.valid-match::after {
    background: radial-gradient(circle, rgba(0, 255, 255, 0.7) 0%, rgba(138, 43, 226, 0.7) 70%, transparent 100%);
    box-shadow: 0 0 15px var(--accent-cyan-glow), inset 0 0 8px rgba(255,255,255,0.4);
}

/* Coordinator Controls (sortear.html) */
.controls-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Caller Board (Painel de todos os 75 números) */
.caller-board {
    padding: 24px;
}

.caller-board-grid {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 8px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .caller-board-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (max-width: 480px) {
    .caller-board-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.board-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.board-cell.called {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    border-color: var(--accent-pink);
    color: white;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
    animation: cell-glow 1s infinite alternate;
}

.board-cell.last-called {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    border-color: var(--accent-cyan);
    color: white;
    box-shadow: 0 0 15px var(--accent-cyan-glow);
    transform: scale(1.1);
    z-index: 2;
}

/* Control Panel Card */
.control-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Switch Toggle Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

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

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--accent-purple);
}

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

/* Range input styling */
.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    outline: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-cyan-glow);
    transition: var(--transition);
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Real-time Toast Notifications */
.notification-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: rgba(15, 12, 32, 0.9);
    border: 1px solid var(--accent-pink);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 15px var(--accent-pink-glow);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slide-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.toast-info {
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 15px var(--accent-cyan-glow);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-weight: 500;
    font-size: 14px;
}

/* User Name Selection Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 3, 11, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fade-in 0.3s ease;
}

.modal-content {
    max-width: 450px;
    width: 90%;
    padding: 35px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 20px;
    color: white;
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

.modal-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
    background: rgba(255,255,255,0.08);
}

/* Footer styling */
footer {
    margin-top: auto;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
}

/* Confetti overlay for Wins */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

/* Keyframes & Animations */
@keyframes rotate-logo {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ball-pop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes mark-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes cell-glow {
    0% { box-shadow: 0 0 5px rgba(138, 43, 226, 0.3); }
    100% { box-shadow: 0 0 15px rgba(255, 0, 127, 0.5); }
}

@keyframes neon-pulse-pink {
    0% { text-shadow: 0 0 5px rgba(255, 0, 127, 0.3); }
    100% { text-shadow: 0 0 15px rgba(255, 0, 127, 0.8), 0 0 25px rgba(255, 0, 127, 0.5); }
}
