/* BlinkBoard Web Player — Styles */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

/* ──────────────────────────────────────────────────────────────── */
/* Player Screen */
/* ──────────────────────────────────────────────────────────────── */

#screen-player {
    position: fixed;
    inset: 0;
    background: #000;
    display: none; /* Hidden until registration completes */
    z-index: 1;
}

#player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#player-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain; /* Overridden by JS */
    -webkit-app-region: drag;
}

/* Hide video controls and ensure no UI elements appear */
#player-video::-webkit-media-controls {
    display: none !important;
}

#player-video::-webkit-media-controls-panel {
    display: none !important;
}

/* Fullscreen: When entering fullscreen, cover the entire screen */
#player-video:fullscreen {
    width: 100vw;
    height: 100vh;
}

/* ──────────────────────────────────────────────────────────────── */
/* Overlays */
/* ──────────────────────────────────────────────────────────────── */

.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Loading spinner */
#overlay-loading {
    background: rgba(0, 0, 0, 0.85);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* No content */
#overlay-no-content {
    background: rgba(0, 0, 0, 0.9);
}

.no-content-msg {
    text-align: center;
    color: #999;
    font-size: 18px;
    padding: 32px;
}

/* Error */
#overlay-error {
    background: rgba(0, 0, 0, 0.9);
    flex-direction: column;
    gap: 16px;
}

.error-content {
    text-align: center;
    padding: 32px;
}

#error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

#error-message {
    color: #f87171;
    font-size: 16px;
    margin-bottom: 16px;
    max-width: 400px;
}

.error-btn {
    padding: 12px 24px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.error-btn:hover {
    background: #4338ca;
}

/* ──────────────────────────────────────────────────────────────── */
/* Banners */
/* ──────────────────────────────────────────────────────────────── */

#banner-offline {
    position: fixed;
    top: 12px;
    right: 12px;
    background: rgba(249, 115, 22, 0.95);
    color: #1f2937;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    z-index: 20;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ──────────────────────────────────────────────────────────────── */
/* Registration Screen */
/* ──────────────────────────────────────────────────────────────── */

#screen-register {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2;
}

.reg-card {
    background: #1e293b;
    padding: 48px 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
}

.reg-header {
    text-align: center;
    margin-bottom: 32px;
}

.reg-logo {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.reg-subtitle {
    color: #94a3b8;
    font-size: 14px;
}

.reg-group {
    margin-bottom: 20px;
}

.reg-label {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.reg-input {
    width: 100%;
    padding: 14px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 18px;
    transition: all 0.2s;
}

.reg-input:focus {
    outline: none;
    border-color: #6366f1;
    background: #1e293b;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.reg-input::placeholder {
    color: #64748b;
}

/* Select dropdown styling — ONLY for select, not text input */
select.reg-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    background-color: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    cursor: pointer;
}

.reg-btn {
    width: 100%;
    padding: 16px;
    margin-top: 24px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.reg-btn:hover {
    background: #4f46e5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.reg-btn:active {
    transform: scale(0.98);
}

.reg-btn:focus {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

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

.reg-status {
    margin-top: 20px;
    padding: 12px;
    background: #0f172a;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 14px;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reg-status.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.reg-status.success {
    color: #86efac;
    background: rgba(134, 239, 172, 0.1);
    border: 1px solid rgba(134, 239, 172, 0.3);
}

.reg-status.loading {
    color: #bfdbfe;
}

/* ──────────────────────────────────────────────────────────────── */
/* TV Focus Styles (for D-pad navigation) */
/* ──────────────────────────────────────────────────────────────── */

.reg-input:focus,
.reg-btn:focus {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

.reg-input:focus {
    outline-color: #6366f1;
}

.reg-btn:focus {
    outline-color: #4f46e5;
}

/* ──────────────────────────────────────────────────────────────── */
/* Reset Button (long-press to clear and return to registration) */
/* ──────────────────────────────────────────────────────────────── */

#btn-reset {
    position: fixed;
    bottom: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    color: #ef4444;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.2s;
}

#btn-reset:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Show reset button on player screen */
#screen-player.active #btn-reset {
    display: flex;
}

/* ──────────────────────────────────────────────────────────────── */
/* Category Selection Pills */
/* ──────────────────────────────────────────────────────────────── */

.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.category-pill {
    padding: 12px 20px;
    background: #0f172a;
    border: 2px solid #334155;
    color: #cbd5e1;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: capitalize;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-pill:hover {
    border-color: #6366f1;
    background: #1e293b;
    color: #e2e8f0;
}

.category-pill.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.category-pill:focus {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

/* On TV/mobile with D-pad navigation, highlight the focused pill */
.category-pill:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}
