/* ===================================
   GLOBAL STYLES & RESET
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ===================================
   MAIN CONTAINER - RESPONSIVE HEIGHT
   =================================== */
#mainContainer {
    width: 100%;
    height: 450px; /* Default for iframe */
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

/* Full page mode - detect if not in iframe */
@media (min-height: 500px) {
    body:not(.in-iframe) #mainContainer {
        height: 90vh;
    }
}

/* ===================================
   BASKETBALL COURT SECTION
   =================================== */
#courtSection {
    flex: 1;
    position: relative;
    background: linear-gradient(to bottom, #e8f4f8 0%, #b8d4e0 100%);
    overflow: hidden;
    min-height: 200px;
}

#basketballCourt {
    width: 100%;
    height: 100%;
    display: block;
}

/* ===================================
   CONTROLS OVERLAY
   =================================== */
#controlsOverlay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.action-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 44px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-text {
    font-size: 13px;
    white-space: nowrap;
}

/* ===================================
   QUIZ SECTION
   =================================== */
#quizSection {
    background: #f8f9fa;
    padding: 12px;
    border-top: 3px solid #667eea;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}

#questionDisplay {
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#questionText {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.4;
}

#optionsContainer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    min-height: 44px;
    width: 100%;
}

.option-btn:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.option-btn.correct {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    animation: correctPulse 0.5s ease;
}

.option-btn.incorrect {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    animation: incorrectShake 0.5s ease;
}

.option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

/* ===================================
   QUIZ CONTROLS
   =================================== */
#quizControls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    min-height: 44px;
    white-space: nowrap;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0);
}

#scoreDisplay {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #667eea;
}

/* ===================================
   ANALYTICS PANEL
   =================================== */
#analyticsPanel {
    background: #2c3e50;
    color: white;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    border-top: 3px solid #3498db;
    transition: max-height 0.3s ease;
    overflow: hidden;
}

#analyticsPanel.collapsed {
    max-height: 40px;
}

#analyticsHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #34495e;
    border-bottom: 1px solid #3498db;
}

#analyticsHeader h3 {
    font-size: 14px;
    margin: 0;
}

.toggle-btn {
    background: #3498db;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 32px;
}

.toggle-btn:hover {
    background: #2980b9;
}

#analyticsContent {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#analyticsLog {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.log-entry {
    background: #34495e;
    padding: 8px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    font-size: 12px;
    line-height: 1.5;
}

.log-entry.correct {
    border-left-color: #51cf66;
    background: #2d4a3e;
}

.log-entry.incorrect {
    border-left-color: #ff6b6b;
    background: #4a2d2d;
}

.log-entry-header {
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-entry-detail {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
}

/* ===================================
   TOOLTIP
   =================================== */
.tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 250px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip.visible {
    opacity: 1;
}

/* ===================================
   ANIMATIONS FOR BASKETBALL
   =================================== */
@keyframes ballBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

@keyframes ballShoot {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(0, -100px) scale(0.8); }
    100% { transform: translate(0, -150px) scale(0.5); opacity: 0; }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 600px) {
    .action-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .btn-text {
        display: none;
    }
    
    .btn-icon {
        font-size: 24px;
    }
    
    #questionText {
        font-size: 13px;
    }
    
    .option-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ===================================
   SCROLLBAR STYLING
   =================================== */
#analyticsContent::-webkit-scrollbar,
#quizSection::-webkit-scrollbar {
    width: 6px;
}

#analyticsContent::-webkit-scrollbar-track,
#quizSection::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

#analyticsContent::-webkit-scrollbar-thumb,
#quizSection::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#analyticsContent::-webkit-scrollbar-thumb:hover,
#quizSection::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}