/* ===================================
   TRIVIA SYSTEM - MODERN CSS
   =================================== */

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

body#nav_master_modern {
    font-family: "ofelia-display", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #003462;
    color: #fff;
    overflow-x: hidden;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    margin-top: 15px;
    font-size: 16px;
}

/* Main Container */
.trivia-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    padding: 10px;
}

/* ===================================
   LEFT SIDEBAR
   =================================== */
.sidebar-left {
    width: 520px;
    min-width: 520px;
    padding: 10px;
    background: #002953;
    border-radius: 15px;
    margin-right: 10px;
    overflow-y: auto;
    max-height: 100vh;
    font-size: 16px; /* Increased from default for better readability */
}

/* Menu Toggle */
.menu-toggle {
    margin-bottom: 10px;
}

#menu-toggle-btn {
    width: 100%;
    background: #0666a4;
    border: none;
    color: #fff;
    font-size: 18px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

#menu-toggle-btn:hover {
    background: #0888d4;
}

/* Sidebar Menu */
.sidebar-menu {
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-menu.collapsed {
    max-height: 0;
}

.menu-buttons {
    padding: 10px 0;
}

.menu-buttons .btn {
    margin-bottom: 8px;
    font-size: 14px;
    padding: 8px;
    border-radius: 8px;
}

/* Settings Panel */
.settings-panel {
    background: #001a33;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
}

.settings-panel h5 {
    color: #92c83e;
    margin-bottom: 15px;
    font-size: 18px;
}

.settings-panel .form-group {
    margin-bottom: 12px;
}

.settings-panel label {
    display: block;
    color: #febe10;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.settings-panel .form-control {
    background: #fff;
    border: none;
    border-radius: 5px;
    padding: 6px;
    font-size: 14px;
}

/* Content Sections */
.content-section {
    margin-bottom: 15px;
}

/* Launch Buttons */
.launch-button {
    background: #414141;
    border-radius: 15px;
    margin-bottom: 10px;
    transition: background 0.3s;
}

.launch-button.launch-game {
    background: grey;
}

.launch-button.launch-rules {
    background: orange;
}

.launch-button.launch-start {
    background: #d72136;
}

.launch-button:hover {
    opacity: 0.9;
}

.launch-button .btn-launch {
    display: block;
    padding: 15px;
    text-align: center;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
}

/* Splash Navigation */
.splash-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.splash-controls button {
    flex: 1;
    padding: 10px;
    font-size: 12px;
    border-radius: 8px;
}

.splash-round-info {
    background: #DF691A;
    padding: 15px;
    text-align: center;
    border-radius: 15px;
    margin-bottom: 10px;
}

.splash-round-info .round-title {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}

.splash-categories {
    background: #002953;
    padding: 15px;
    border-radius: 15px;
    color: #fff;
    text-align: center;
    line-height: 1.6;
}

/* Question Navigation */
#question-nav {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.current-rq {
    background: #002953;
    padding: 15px;
    text-align: center;
    border-radius: 15px;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.question-nav-options {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.question-nav-options button {
    flex: 1;
    padding: 10px;
    font-size: 12px;
    border-radius: 8px;
    font-weight: bold;
}

/* Info Boxes */
.info-box {
    background: #002953;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
}

.info-header.category-box .info-header { color: mediumpurple; }
.info-header.question-box .info-header { color: #d72136; }
.info-header.answer-box .info-header { color: #febe10; }
.info-header.host-info-box .info-header { color: #0666a4; }
.info-header.coming-up-box .info-header { color: #92c83e; }

.info-content {
    color: #fff;
    font-size: 17px; /* Increased from 15px for better readability */
    line-height: 1.6;
}

.info-box .btn-link {
    color: #fff;
    text-decoration: none;
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.info-box .btn-link:hover {
    background: rgba(255,255,255,0.3);
}

/* Jump To Box */
.jump-to-box {
    background: #92c83e;
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
}

.jump-to-box label {
    display: block;
    color: #000;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 5px;
}

.jump-to-box .form-control {
    background: #fff;
    border: none;
    border-radius: 5px;
    padding: 6px;
}

/* Webcam Section */
.webcam-section {
    background: #002953;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.webcam-header {
    color: #febe10;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 8px;
}

.webcam-controls {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.webcam-controls button {
    flex: 1;
    font-size: 12px;
}

.webcam-preview {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

#webcam-video, #webcam-canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   RIGHT CONTENT AREA (SCORING)
   =================================== */
.content-area {
    flex: 1;
    background: #001a33;
    border-radius: 15px;
    padding: 10px;
    overflow-y: auto;
    max-height: 100vh;
}

/* Add Team Bar */
.add-team-bar {
    background: linear-gradient(135deg, #92c83e 0%, #7ab62c 100%);
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 10px;
}

.add-team-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-team-form input {
    flex: 1;
    min-width: 80px;
}

.add-team-form input[name="team_id"] {
    max-width: 60px;
}

.add-team-form input[name="players"] {
    max-width: 70px;
}

.btn-add-team {
    background: mediumpurple;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-add-team:hover {
    background: #8a6fc4;
}

/* Scoring Info Bar */
.scoring-info-bar {
    background: #febe10;
    color: #000;
    padding: 12px;
    border-radius: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.scoring-info-left {
    font-size: 16px;
}

.scoring-info-right button {
    background: #d72136;
    color: #fff;
    border: none;
    padding: 6px 15px;
    border-radius: 8px;
    font-weight: bold;
}

/* Team Scoring Container */
.team-scoring-container {
    margin-bottom: 10px;
}

.team-columns {
    display: flex;
    gap: 15px;
}

.team-column {
    flex: 1;
    min-width: 0; /* Allow flex shrinking */
}

/* Team Row */
.team-row {
    background: #333;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.team-row:nth-child(even) {
    background: #414141;
}

.team-row:hover {
    background: #555;
}

.team-name {
    flex: 1;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-score-buttons {
    display: flex;
    gap: 3px;
}

.team-score-buttons.correct {
    /* Green buttons */
}

.team-score-buttons.incorrect {
    /* Red buttons */
}

.score-btn {
    width: 35px;
    height: 35px;
    border: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.score-btn:hover {
    transform: scale(1.1);
}

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

/* Score button backgrounds (using images) */
.score-btn[data-value="5"][data-yn="Y"] {
    background-image: url('../images/score_nums/5y.png');
}
.score-btn[data-value="3"][data-yn="Y"] {
    background-image: url('../images/score_nums/3y.png');
}
.score-btn[data-value="1"][data-yn="Y"] {
    background-image: url('../images/score_nums/1y.png');
}
.score-btn[data-value="5"][data-yn="N"] {
    background-image: url('../images/score_nums/5n.png');
}
.score-btn[data-value="3"][data-yn="N"] {
    background-image: url('../images/score_nums/3n.png');
}
.score-btn[data-value="1"][data-yn="N"] {
    background-image: url('../images/score_nums/1n.png');
}

.team-final-score {
    min-width: 30px;
    text-align: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

/* Jump To Scoring Bar */
.jump-to-scoring-bar {
    background: #d72136;
    border-radius: 15px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.jump-label {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.jump-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
}

.jump-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.jump-btn:hover {
    background: #febe10;
}

.jump-btn.active {
    background: #92c83e;
    color: #fff;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.btn-orange {
    background: #DF691A;
    color: #fff;
    border: none;
}

.btn-orange:hover {
    background: #c55a15;
}

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

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 1400px) {
    .sidebar-left {
        width: 350px;
        min-width: 350px;
    }
}

@media (max-width: 1200px) {
    .trivia-container {
        flex-direction: column;
    }
    
    .sidebar-left {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .content-area {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .team-columns {
        flex-direction: column;
    }
    
    .add-team-form {
        flex-wrap: wrap;
    }
    
    .add-team-form input {
        min-width: 100%;
    }
}

/* ===================================
   ANIMATION CLASSES
   =================================== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Score Update Flash */
.score-flash {
    animation: scoreFlash 0.5s ease-out;
}

@keyframes scoreFlash {
    0% {
        background: #febe10;
    }
    100% {
        background: inherit;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .sidebar-left,
    .add-team-bar,
    .scoring-info-bar,
    .jump-to-scoring-bar {
        display: none;
    }
    
    body {
        background: #fff;
    }
    
    .team-row {
        background: #fff;
        border: 1px solid #000;
        color: #000;
    }
}
