/* Widget Tools CSS - CSS for use in Atacama widgets */

/* === CORE LAYOUT COMPONENTS === */

/* Main widget container - responsive by default */
.w-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-large);
    min-height: 100vh;
    background: var(--color-background);
    color: var(--color-text);
}

/* Fullscreen mode */
.w-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    padding: var(--spacing-base);
}

/* === RESPONSIVE LAYOUT SYSTEM === */

/* Two-column layout for desktop, stacked for mobile */
.w-layout-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-large);
}

/* Desktop: content on left, sidebar on right */
@media screen and (min-width: 1024px) {
    .w-layout-main {
        grid-template-columns: 2fr 1fr;
    }
}

/* Landscape mobile/tablet: content on left, controls on right */
@media screen and (min-width: 768px) and (orientation: landscape) {
    .w-layout-main {
        grid-template-columns: 2fr 1fr;
        height: 100vh;
    }
    
    .w-layout-content {
        overflow-y: auto;
    }
    
    .w-layout-sidebar {
        overflow-y: auto;
    }
}

/* Game header - always at top */
.w-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-base) 0;
    margin-bottom: var(--spacing-large);
    border-bottom: 1px solid var(--color-border);
}

@media screen and (max-width: 767px) {
    .w-game-header {
        flex-direction: column;
        gap: var(--spacing-base);
        text-align: center;
    }
}

/* === ESSENTIAL WIDGET COMPONENTS === */

/* Card container for main content */
.w-card {
    background: var(--color-card-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-large);
    box-shadow: var(--box-shadow);
    transition: all 0.2s ease;
}

.w-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Interactive card (clickable) */
.w-card-interactive {
    cursor: pointer;
}

.w-card-interactive:hover {
    border-color: var(--color-primary);
}

/* === BUTTON SYSTEM === */

/* Base button - all buttons should use this */
.w-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: var(--spacing-base) var(--spacing-large);
    font-size: inherit;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    background-color: var(--color-primary);
    color: white;
}

.w-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.w-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Button variants */
.w-button-secondary {
    background: var(--color-background);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.w-button-secondary:hover {
    background: var(--color-annotation-bg);
    border-color: var(--color-primary);
}

.w-button-success {
    background: var(--color-success);
}

.w-button-error {
    background: var(--color-error);
}

/* Fullscreen toggle - integrated into UI, not floating */
.w-fullscreen-toggle {
    background: var(--color-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: var(--spacing-small) var(--spacing-base);
    font-size: 0.9rem;
}

.w-fullscreen-toggle:hover {
    background: var(--color-annotation-bg);
}

/* === MULTIPLE CHOICE SYSTEM === */

/*
 * Standard 4-option multiple choice layout
 * Usage: 
 * <div class="w-multiple-choice">
 *   <button class="w-choice-option">Option 1</button>
 *   <button class="w-choice-option">Option 2</button>
 *   <button class="w-choice-option">Option 3</button>
 *   <button class="w-choice-option">Option 4</button>
 * </div>
 */
.w-multiple-choice {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-base);
    margin: var(--spacing-large) 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.w-choice-option {
    padding: var(--spacing-base);
    border: 2px solid var(--color-border);
    background: var(--color-card-bg);
    color: var(--color-text);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
}

.w-choice-option:hover {
    background: var(--color-annotation-bg);
    border-color: var(--color-primary);
}

.w-choice-option:disabled {
    cursor: not-allowed;
}

/* Multiple choice states */
.w-choice-option.w-correct {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.w-choice-option.w-incorrect {
    background: var(--color-error);
    color: white;
    border-color: var(--color-error);
}

.w-choice-option.w-unselected {
    opacity: 0.5;
}

/* Mobile: stack vertically */
@media screen and (max-width: 767px) {
    .w-multiple-choice {
        grid-template-columns: 1fr;
        max-width: none;
    }
}

/* === MODE SELECTOR SYSTEM === */

/*
 * Mode selector for switching between options
 * Usage:
 * <div class="w-mode-selector">
 *   <button class="w-mode-option active">Mode 1</button>
 *   <button class="w-mode-option">Mode 2</button>
 * </div>
 */
.w-mode-selector {
    display: flex;
    gap: var(--spacing-small);
    justify-content: center;
    margin: var(--spacing-large) 0;
    flex-wrap: wrap;
}

.w-mode-option {
    padding: var(--spacing-small) var(--spacing-base);
    border: 1px solid var(--color-border);
    background: var(--color-background);
    color: var(--color-text);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.w-mode-option:hover {
    background: var(--color-annotation-bg);
}

.w-mode-option.w-active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

@media screen and (max-width: 767px) {
    .w-mode-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .w-mode-option {
        width: 100%;
        max-width: 200px;
    }
}

/* === NAVIGATION CONTROLS === */

/*
 * Navigation bar with previous/next and center controls
 * Usage:
 * <div class="w-nav-controls">
 *   <button class="w-button">← Previous</button>
 *   <div class="w-nav-center">
 *     <button class="w-button-secondary">Reset</button>
 *   </div>
 *   <button class="w-button">Next →</button>
 * </div>
 */
.w-nav-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-base);
    align-items: center;
    margin: var(--spacing-large) 0;
}

.w-nav-center {
    display: flex;
    gap: var(--spacing-base);
    justify-content: center;
}

@media screen and (max-width: 767px) {
    .w-nav-controls {
        grid-template-columns: 1fr;
        gap: var(--spacing-base);
        text-align: center;
    }
}

/* === STATS DISPLAY === */

/*
 * Statistics display for games
 * Usage:
 * <div class="w-stats">
 *   <div class="w-stat-item">
 *     <div class="w-stat-value">15</div>
 *     <div class="w-stat-label">Correct</div>
 *   </div>
 * </div>
 */
.w-stats {
    display: flex;
    gap: var(--spacing-large);
    justify-content: center;
    margin: var(--spacing-large) 0;
}

.w-stat-item {
    padding: var(--spacing-base);
    background: var(--color-annotation-bg);
    border-radius: var(--border-radius);
    text-align: center;
    min-width: 80px;
}

.w-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.w-stat-label {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

@media screen and (max-width: 767px) {
    .w-stats {
        flex-direction: column;
        gap: var(--spacing-base);
    }
}

/* === UTILITY CLASSES === */

/* Essential layout utilities */
.w-text-center { text-align: center; }
.w-font-bold { font-weight: bold; }
.w-mb-large { margin-bottom: var(--spacing-large); }

/* Question display */
.w-question {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: var(--spacing-large);
}

/* Progress indicator */
.w-progress {
    text-align: center;
    margin: var(--spacing-base) 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Feedback messages */
.w-feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: var(--spacing-base) 0;
    padding: var(--spacing-base);
    border-radius: var(--border-radius);
}

.w-feedback.w-success {
    color: var(--color-success);
    background: rgba(76, 175, 80, 0.1);
}

.w-feedback.w-error {
    color: var(--color-error);
    background: rgba(255, 0, 0, 0.1);
}

/* Audio button for language widgets */
.w-audio-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.w-audio-button:hover {
    background: var(--color-annotation-bg);
    transform: scale(1.1);
}

/* Category badge */
.w-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--color-annotation-bg);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* === RESPONSIVE HELPERS === */

/* Hide on mobile */
@media screen and (max-width: 767px) {
    .w-hide-mobile {
        display: none;
    }
}

/* Hide on desktop */
@media screen and (min-width: 768px) {
    .w-hide-desktop {
        display: none;
    }
}