/* ============================================================================
 * Himawari Dashboard - CSS Best Practices
 * ============================================================================
 * Base styles, layout, controls, and responsive design for the satellite
 * imagery dashboard. Follows BEM methodology and alphabetized properties.
 */

/* CSS Variables for maintainability */
:root {
  --color-primary: #1f77b4;
  --color-primary-dark: #0d5fa4;
  --color-background: #e0e0e0;
  --color-background-dark: #f8f9fa;
  --color-text: #313f3f;
  --color-text-light: #666;
  --color-text-muted: #555;
  --color-white: #ffffff;
  --color-button-bg: #1a1a2e;
  --color-button-border: #3a8eed;
  --color-button-border-hover: #a78bfa;
  --color-button-glow: rgba(58, 61, 237, 0.5);
  --color-button-glow-hover: rgba(124, 58, 237, 0.8);
  --color-gradient-start: #667eea;
  --color-gradient-end: #764ba2;
  
  --size-border-radius: 8px;
  --size-button-radius: 25px;
  --size-spacing-xs: 0.5rem;
  --size-spacing-sm: 0.75rem;
  --size-spacing-md: 1rem;
  --size-spacing-lg: 1.5rem;
  --size-spacing-xl: 2rem;
  
  --transition-default: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: "Source Sans", sans-serif;
  line-height: 1.6;
}

/* Loading screen overlay */
.loading-screen {
  align-items: center;
  background: linear-gradient(135deg, var(--color-gradient-start) 0%, var(--color-gradient-end) 100%);
  display: flex;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  transition: opacity var(--transition-slow);
  width: 100%;
  z-index: 9999;
}

/* Loading content container */
.loading-content {
  color: var(--color-white);
  max-width: 400px;
  padding: var(--size-spacing-xl);
  text-align: center;
}

/* Loading spinner animation */
.loading-spinner {
  animation: spin 1s linear infinite;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--color-white);
  height: 60px;
  margin: 0 auto var(--size-spacing-lg);
  width: 60px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-content h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: var(--size-spacing-xs);
}

.loading-content p {
  font-size: 1rem;
  margin-bottom: var(--size-spacing-md);
  opacity: 0.9;
}

.loading-bar {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  height: 8px;
  margin: var(--size-spacing-md) 0;
  overflow: hidden;
  width: 100%;
}

.loading-progress {
  background: var(--color-white);
  border-radius: 4px;
  height: 100%;
  transition: width var(--transition-slow);
  width: 0%;
}

.loading-details {
  font-size: 0.9rem;
  margin-top: var(--size-spacing-xs);
  opacity: 0.8;
}

.container {
  margin: 0 auto;
  max-width: 100%;
  padding: var(--size-spacing-xl) 5rem;
  width: 100%;
}

/* Header section */
.header {
  margin-bottom: var(--size-spacing-xl);
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: var(--size-spacing-xs);
}

.header h3 {
  color: var(--color-text-muted);
  font-size: 1.5rem;
  font-weight: 400;
}

/* Image container and display */
.image-container {
  align-items: center;
  display: flex;
  justify-content: center;
  margin-bottom: var(--size-spacing-xl);
  min-height: 200px;
  width: 100%;
}

.image-container img {
  border: 3px solid var(--color-primary);
  border-radius: var(--size-border-radius);
  display: block;
  height: auto;
  max-height: 60vh;
  max-width: 100%;
  object-fit: contain;
}

/* Slider section */
.slider-section {
  margin-bottom: var(--size-spacing-xl);
}

.slider-section hr {
  border: none;
  border-top: 1px solid #ddd;
  margin-bottom: var(--size-spacing-lg);
}

.slider-wrapper {
  padding: 0 var(--size-spacing-md);
  width: 100%;
}

.slider {
  appearance: none;
  background: #5c5c5c;
  border-radius: 3px;
  cursor: pointer;
  height: 6px;
  outline: none;
  width: 100%;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  height: 18px;
  width: 18px;
}

.slider::-moz-range-thumb {
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  height: 18px;
  width: 18px;
}

.slider:hover::-webkit-slider-thumb {
  background: var(--color-primary-dark);
}

.slider:hover::-moz-range-thumb {
  background: var(--color-primary-dark);
}

#date-info {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-top: var(--size-spacing-md);
  text-align: center;
}

/* Control buttons section */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-spacing-sm);
  justify-content: center;
  margin-bottom: var(--size-spacing-xl);
  margin-left: auto;
  margin-right: auto;
  max-width: 900px;
}

.control-btn {
  background-color: var(--color-button-bg);
  border: 2px solid var(--color-button-border);
  border-radius: var(--size-button-radius);
  box-shadow: 0 0 15px var(--color-button-glow);
  color: var(--color-white);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 500;
  padding: var(--size-spacing-sm) 1.5rem;
  transition: all var(--transition-default);
  white-space: nowrap;
}

.control-btn.small-btn {
  font-size: 0.9rem;
  padding: var(--size-spacing-sm) 1rem;
}

.control-btn:hover {
  background-color: #2d2d44;
  border-color: var(--color-button-border-hover);
  box-shadow: 0 0 25px var(--color-button-glow-hover);
}

.control-btn:active {
  background-color: var(--color-button-bg);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.6);
}

.control-btn.playing {
  background-color: var(--color-button-bg);
  border-color: #7c3aed;
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.5);
  color: var(--color-white);
}

.control-btn.playing:hover {
  background-color: #2d2d44;
  border-color: var(--color-button-border-hover);
  box-shadow: 0 0 25px var(--color-button-glow-hover);
}

/* Responsive design - tablet and above */
@media (max-width: 1024px) {
  .container {
    padding: 1.5rem 3rem;
  }

  .header h1 {
    font-size: 2.2rem;
  }

  .header h3 {
    font-size: 1.3rem;
  }

  .control-btn {
    font-size: 0.95rem;
    padding: 0.7rem 1.2rem;
  }

  .control-btn.small-btn {
    font-size: 0.85rem;
    padding: 0.7rem 0.9rem;
  }
}

/* Responsive design - tablet */
@media (max-width: 768px) {
  .container {
    padding: 1rem 1rem;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .header h3 {
    font-size: 1rem;
  }

  .image-container {
    margin-bottom: 1.5rem;
    min-height: 150px;
  }

  .image-container img {
    border-width: 2px;
    max-height: 50vh;
  }

  .slider-section {
    margin-bottom: 1.5rem;
  }

  .slider-section hr {
    margin-bottom: 1rem;
  }

  .controls {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .control-btn {
    border-width: 1.5px;
    font-size: 0.85rem;
    padding: 0.65rem 1rem;
  }

  .control-btn.small-btn {
    font-size: 0.75rem;
    padding: 0.65rem 0.75rem;
  }

  #date-info {
    font-size: 0.85rem;
  }
}

/* Responsive design - mobile */
@media (max-width: 480px) {
  .container {
    padding: 0.75rem 0.5rem;
  }

  .header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
  }

  .header h3 {
    font-size: 0.9rem;
  }

  .image-container {
    margin-bottom: 1rem;
    min-height: 120px;
  }

  .image-container img {
    border-radius: 6px;
    border-width: 2px;
    max-height: 45vh;
  }

  .slider-section {
    margin-bottom: 1rem;
  }

  .slider-section hr {
    margin-bottom: 0.75rem;
  }

  .slider-wrapper {
    padding: 0 0.5rem;
  }

  .slider {
    height: 5px;
  }

  .slider::-webkit-slider-thumb,
  .slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
  }

  .controls {
    gap: 0.4rem;
    justify-content: center;
    margin-bottom: 1rem;
    width: 100%;
  }

  .control-btn {
    border-width: 1.5px;
    font-size: 0.75rem;
    padding: 0.6rem 0.8rem;
  }

  .control-btn.small-btn {
    font-size: 0.7rem;
    padding: 0.6rem 0.65rem;
  }

  #date-info {
    font-size: 0.8rem;
    margin-top: 0.75rem;
  }
}

/* Dark mode support */
.dark-mode,
.dark-mode body {
  background-color: #0b0b0b !important;
  color: #e6eef0 !important;
}

.dark-mode .header h1 {
  color: #f6fbff !important;
}

.dark-mode .header h3,
.dark-mode #date-info {
  color: #c9d6db !important;
}

.dark-mode .image-container img {
  border-color: #2b6aa3 !important;
}

.dark-mode .slider {
  background: #3b3b3b !important;
}

.dark-mode .slider::-webkit-slider-thumb,
.dark-mode .slider::-moz-range-thumb {
  background: #3a8eed !important;
}

.dark-mode .control-btn {
  background-color: #11121a !important;
  border-color: #3a8eed !important;
  color: #fff !important;
}
