/*
 * Binqo Web Player - iOS App Style
 * Kahoot-inspired dark purple theme
 */

:root {
    /* Primary Colors */
    --deep-purple: #46178F;
    --vibrant-pink: #FF3355;
    --kahoot-green: #26890C;
    --kahoot-blue: #1368CE;
    --kahoot-yellow: #FFA602;
    --bright-cyan: #00C2FF;

    /* Background Colors */
    --bg-dark: #1A0A2E;
    --bg-medium: #2D1B4E;
    --bg-card: #3D2B5E;

    /* Bingo Cell Colors */
    --cell-red: #E21B3C;
    --cell-blue: #1368CE;
    --cell-yellow: #FFA602;
    --cell-green: #26890C;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Shadows */
    --shadow-pink: rgba(255, 51, 85, 0.3);
    --shadow-green: rgba(38, 137, 12, 0.3);
    --shadow-blue: rgba(19, 104, 206, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.3);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--deep-purple) 100%);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    position: relative;
}

/* Logo & Header */
.logo {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: var(--space-xl);
    text-shadow: 0 4px 20px var(--shadow-pink);
    background: linear-gradient(135deg, var(--vibrant-pink), var(--kahoot-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    text-align: center;
}

/* Card Container */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px var(--shadow-dark),
                0 0 40px var(--shadow-pink);
}

.card-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* PIN Input */
.pin-container {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.pin-digit {
    width: 50px;
    height: 60px;
    background: var(--bg-medium);
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.pin-digit:focus {
    outline: none;
    border-color: var(--bright-cyan);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3),
                0 0 20px rgba(0, 194, 255, 0.3);
}

.pin-digit::placeholder {
    color: var(--text-muted);
}

/* Text Input */
.input-group {
    margin-bottom: var(--space-lg);
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-medium);
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.text-input:focus {
    outline: none;
    border-color: var(--bright-cyan);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3),
                0 0 20px rgba(0, 194, 255, 0.3);
}

.text-input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--vibrant-pink);
    color: var(--text-primary);
    box-shadow: 0 6px 0 #CC2944,
                0 10px 20px var(--shadow-pink);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #CC2944,
                0 15px 30px var(--shadow-pink);
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #CC2944,
                0 5px 10px var(--shadow-pink);
}

.btn-green {
    background: var(--kahoot-green);
    color: var(--text-primary);
    box-shadow: 0 6px 0 #1E6B09,
                0 10px 20px var(--shadow-green);
}

.btn-green:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #1E6B09,
                0 15px 30px var(--shadow-green);
}

.btn-green:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1E6B09,
                0 5px 10px var(--shadow-green);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 3px solid var(--text-primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* BINGO Button */
.btn-bingo {
    background: linear-gradient(135deg, var(--kahoot-yellow), var(--vibrant-pink));
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 4px;
    padding: var(--space-lg);
    box-shadow: 0 8px 0 #CC7A00,
                0 15px 40px rgba(255, 166, 2, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

.btn-bingo:disabled {
    animation: none;
    background: var(--bg-medium);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 0 #CC7A00,
                    0 15px 40px rgba(255, 166, 2, 0.4);
    }
    50% {
        box-shadow: 0 8px 0 #CC7A00,
                    0 15px 60px rgba(255, 166, 2, 0.6),
                    0 0 80px rgba(255, 51, 85, 0.3);
    }
}

/* Error Message */
.error-message {
    background: rgba(226, 27, 60, 0.2);
    border: 2px solid var(--cell-red);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: center;
    font-size: 14px;
    color: #FF6B6B;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Success Message */
.success-message {
    background: rgba(38, 137, 12, 0.2);
    border: 2px solid var(--kahoot-green);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: center;
    font-size: 14px;
    color: #7ED957;
}

/* Waiting Room */
.waiting-room {
    text-align: center;
}

.pin-display {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.pin-display-digit {
    width: 45px;
    height: 55px;
    background: var(--bg-medium);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.player-count {
    font-size: 48px;
    font-weight: 900;
    color: var(--kahoot-yellow);
    margin-bottom: var(--space-sm);
}

.player-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.waiting-dots {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-lg);
}

.waiting-dot {
    width: 12px;
    height: 12px;
    background: var(--vibrant-pink);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.waiting-dot:nth-child(1) { animation-delay: -0.32s; }
.waiting-dot:nth-child(2) { animation-delay: -0.16s; }
.waiting-dot:nth-child(3) { animation-delay: 0; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1.0); opacity: 1; }
}

/* Bingo Grid */
.game-container {
    width: 100%;
    max-width: 500px;
    padding: var(--space-md);
}

.round-indicator {
    text-align: center;
    margin-bottom: var(--space-md);
}

.round-badge {
    display: inline-block;
    background: var(--bg-card);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.round-badge span {
    color: var(--kahoot-yellow);
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.bingo-cell {
    aspect-ratio: 1;
    background: var(--kahoot-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 0 #0E52A3;
    overflow: hidden;
}

/* All cells same blue color - matching iOS app */
/* Blue: #1368CE with darker shadow #0E52A3 */

.bingo-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    pointer-events: none;
}

.bingo-cell:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
}

.bingo-cell.marked {
    background: var(--kahoot-green) !important;
    box-shadow: 0 4px 0 #1E6B09 !important;
}

.bingo-cell.marked.locked {
    background: var(--kahoot-yellow) !important;
    box-shadow: 0 4px 0 #CC8500 !important;
}

.bingo-cell.locked {
    cursor: not-allowed;
}

/* Checkmark icon for marked cells (not locked) */
.bingo-cell.marked:not(.locked)::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2326890C"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>') center/70% no-repeat white;
    border-radius: 50%;
}

/* Lock icon for locked cells */
.bingo-cell.marked.locked::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFA602"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>') center/70% no-repeat white;
    border-radius: 50%;
}

.cell-text {
    font-size: clamp(9px, 2.5vw, 14px);
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    word-break: break-word;
    hyphens: auto;
    max-height: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Claim Status Banner */
.claim-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 100;
    animation: slideDown 0.3s var(--spring);
}

.claim-banner.pending {
    background: var(--kahoot-yellow);
    color: #1A0A2E;
}

.claim-banner.approved {
    background: var(--kahoot-green);
    color: white;
}

.claim-banner.rejected {
    background: var(--cell-red);
    color: white;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Winner Celebration */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.5s ease;
}

.winner-content {
    text-align: center;
    animation: scaleIn 0.5s var(--spring);
}

.winner-icon {
    font-size: 80px;
    margin-bottom: var(--space-lg);
    animation: bounce-trophy 1s ease infinite;
}

@keyframes bounce-trophy {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.winner-title {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--kahoot-yellow), #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-md);
}

.winner-round {
    font-size: 18px;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Loading Spinner */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-medium);
    border-top-color: var(--vibrant-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Player List */
.player-list {
    margin-top: var(--space-lg);
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-medium);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.player-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.player-you {
    font-size: 11px;
    color: var(--kahoot-yellow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 400px) {
    .pin-digit {
        width: 42px;
        height: 52px;
        font-size: 24px;
    }

    .pin-display-digit {
        width: 38px;
        height: 48px;
        font-size: 24px;
    }

    .bingo-grid {
        gap: 4px;
    }

    .card {
        padding: var(--space-lg);
    }
}

/* Hide on desktop message */
@media (min-width: 768px) {
    .mobile-hint {
        display: none;
    }
}

/* Confetti (for celebration) */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    to {
        top: 100vh;
        transform: rotate(720deg);
    }
}
