/**
 * GOES Satellite Imagery Viewer - Stylesheet
 * Optimized for large satellite image display and minimal UI interference
 * Dark theme designed for meteorological analysis and extended viewing
 */

/* ============================================================================
   SECTION 1: RESET AND BASE STYLES
   ============================================================================ */

/**
 * Universal reset for consistent cross-browser behavior
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/**
 * Base body styling - dark theme optimized for image viewing
 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================================================
   SECTION 2: HEADER AND BRANDING
   ============================================================================ */

/**
 * Main header with site title
 */
.header {
    background: #2d2d2d;
    padding: 15px 20px;
    border-bottom: 2px solid #444;
}

/**
 * Header title with accent color
 */
.header h1 {
    font-size: 24px;
    font-weight: 300;
    color: #00aaff; /* Blue accent matching meteorological themes */
}

/* ============================================================================
   SECTION 3: CONTROL PANEL INTERFACE
   ============================================================================ */

/**
 * Main controls bar - houses all user interface elements
 */
.controls {
    background: #262626;
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/**
 * Individual control group container
 */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/**
 * Labels for control groups - small, muted text
 */
.control-group label {
    font-size: 12px;
    color: #aaaaaa;
    font-weight: 500;
}

/* ============================================================================
   SECTION 4: FORM CONTROLS AND BUTTONS
   ============================================================================ */

/**
 * Dropdown select styling for product/region selection
 */
.control-select {
    background: #333333;
    border: 1px solid #555;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    min-width: 180px;
    font-size: 14px;
}

/**
 * Disabled state for dropdowns
 */
.control-select:disabled {
    background: #2a2a2a;
    color: #666;
    cursor: not-allowed;
}

/**
 * Focus state with blue accent
 */
.control-select:focus {
    outline: none;
    border-color: #00aaff;
    box-shadow: 0 0 5px rgba(0, 170, 255, 0.3);
}

/**
 * Standard button styling for all control buttons
 */
.control-btn {
    background: #444444;
    border: 1px solid #666;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

/**
 * Button hover effect (not applied to disabled buttons)
 */
.control-btn:hover:not(:disabled) {
    background: #555555;
}

/**
 * Disabled button styling
 */
.control-btn:disabled {
    background: #2a2a2a;
    color: #666;
    cursor: not-allowed;
}

/* ============================================================================
   SECTION 5: NAVIGATION AND ANIMATION CONTROL GROUPS
   ============================================================================ */

/**
 * Container for navigation buttons (prev/next)
 */
.nav-controls {
    display: flex;
    gap: 10px;
}

/**
 * Container for animation buttons (loop and speed control)
 */
.animation-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/**
 * Container for display controls (fullscreen and auto-refresh)
 */
.display-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/**
 * Compact speed selector for loop timing
 */
.speed-select {
    min-width: 110px;
    font-size: 12px;
}

/* ============================================================================
   SECTION 6: LOADING AND STATUS INDICATORS
   ============================================================================ */

/**
 * Loading spinner and message container
 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    font-size: 18px;
    color: #aaaaaa;
}

/**
 * Animated loading spinner (created via CSS pseudo-element)
 */
.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #444;
    border-top: 2px solid #00aaff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/**
 * Keyframe animation for loading spinner
 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================================
   SECTION 7: IMAGE DISPLAY AND LAYOUT
   ============================================================================ */

/**
 * Main container for satellite image and metadata
 */
.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
    min-height: calc(100vh - 140px); /* Subtract header and controls height */
}

/**
 * Fullscreen mode adjustments
 * Maximize image viewing area when in fullscreen
 */
:fullscreen .image-container,
:-webkit-full-screen .image-container,
:-moz-full-screen .image-container {
    min-height: calc(100vh - 80px); /* Smaller header in fullscreen */
    padding: 10px;
}

:fullscreen #satellite-image,
:-webkit-full-screen #satellite-image,
:-moz-full-screen #satellite-image {
    max-height: calc(100vh - 120px); /* More space for image in fullscreen */
}

:fullscreen .header,
:-webkit-full-screen .header,
:-moz-full-screen .header {
    padding: 8px 20px; /* Compressed header in fullscreen */
}

:fullscreen .controls,
:-webkit-full-screen .controls,
:-moz-full-screen .controls {
    padding: 8px 20px; /* Compressed controls in fullscreen */
}

/**
 * Image metadata bar (timestamp, frame counter)
 */
.image-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #cccccc;
}

/**
 * Main satellite image display
 * Constrained to viewport size while maintaining aspect ratio
 */
#satellite-image {
    max-width: 100%;
    max-height: calc(100vh - 200px); /* Leave room for controls and info */
    border: 2px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================================================
   SECTION 8: ERROR HANDLING AND FEEDBACK
   ============================================================================ */

/**
 * Error message container with red background
 */
.error-message {
    background: #8b0000; /* Dark red for errors */
    color: #ffffff;
    padding: 15px;
    margin: 20px;
    border-radius: 6px;
    text-align: center;
}

/* ============================================================================
   SECTION 9: RESPONSIVE DESIGN
   ============================================================================ */

/**
 * Mobile and tablet optimizations
 */
@media (max-width: 768px) {
    /**
     * Stack controls vertically on narrow screens
     */
    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    /**
     * Full-width control groups on mobile
     */
    .control-group {
        width: 100%;
    }
    
    /**
     * Full-width dropdowns on mobile
     */
    .control-select {
        width: 100%;
        min-width: auto;
    }
    
    /**
     * Center navigation controls on mobile
     */
    .nav-controls {
        justify-content: center;
    }
    
    /**
     * Stack image metadata vertically on small screens
     */
    .image-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* ============================================================================
   SECTION 10: ACCESSIBILITY AND USABILITY
   ============================================================================ */

/**
 * Ensure sufficient color contrast for all text elements
 * All color combinations meet WCAG AA standards
 */

/**
 * Focus indicators for keyboard navigation
 * Visible focus rings on all interactive elements
 */
.control-btn:focus,
.control-select:focus {
    outline: 2px solid #00aaff;
    outline-offset: 2px;
}

/**
 * Smooth transitions for interactive feedback
 * Provides visual confirmation of user actions
 */
.control-btn,
.control-select {
    transition: all 0.2s ease-in-out;
}

/* ============================================================================
   END OF STYLESHEET
   ============================================================================ */