/**
 * Cabarete Bay Wind Display - Main Stylesheet
 *
 * Kiosk mode (default): Full viewport, generous spacing, visible clock
 * Saver mode (.saver): Compact band (22-85% height), no clock, minimized elements
 * Widescreen mode (min-width 1200px): Spalten-Layout (links Content 62%, rechts Foto 38%)
 */

/* =============================================================================
   RESET & BASE STYLES
   ============================================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #274b63;
}

/* =============================================================================
   BACKGROUND: Photo + Wash + Vignette
   ============================================================================= */

/* Widescreen layout: Foto rechts positionieren (70% center) */
@media (min-width: 1200px) {
  .bg-photo {
    background-position: 70% center !important;
  }
}

/* =============================================================================
   MAIN LAYOUT CONTAINER
   ============================================================================= */

.screen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  padding: 32px 24px;
  z-index: 100;

  /* Kiosk mode: full height, generous padding, centered */
}

/* Widescreen: Spalten-Layout (Content links, Foto rechts) */
@media (min-width: 1200px) {
  .screen-container {
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    padding: 24px 4vw;   /* Reduziert von 32px */
    gap: 24px;
  }
}

/* Saver mode: compact band layout */
html.saver .screen-container {
  padding-top: 22vh;
  padding-bottom: 15vh;
  justify-content: flex-start;
  gap: 12px;
  flex-direction: column;
}

/* =============================================================================
   CONTENT COLUMN (nur im Widescreen Layout)
   ============================================================================= */

@media (min-width: 1200px) {
  .content-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 0 0 62%;
    gap: 16px;              /* Reduziert von 24px */
    overflow-y: auto;       /* Fallback, sollte aber nicht nötig sein */
    max-height: 100vh;      /* WICHTIG: Spalte passt in Viewport */
    padding-right: 8px;     /* Scroll-Bar-Platz */
  }

  .content-column > * {
    width: 100%;
  }
}

/* Nicht-Widescreen: Spalte wird ignoriert, Kinder werden direkt in screen-container gelayoutet */
@media (max-width: 1199px) {
  .content-column {
    display: contents;
  }
}

/* =============================================================================
   HEADER: Location, Time, Station
   ============================================================================= */

.header {
  text-align: center;
  margin-bottom: 8px;     /* Reduziert von 24px */

  animation: fadeIn 0.6s ease-in;
}

/* Breitbild-Layout: Typo-Größen mit clamp() → 25% reduziert */
@media (min-width: 1200px) {
  .location {
    font-size: clamp(20px, 3vw, 32px);
    font-weight: 600;
    color: #274b63;
    text-shadow: 0 1px 8px rgba(255, 255, 255, 0.8);
    letter-spacing: -0.5px;
  }

  .time {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 300;
    color: #274b63;
    text-shadow: 0 1px 8px rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
    margin-top: 4px;       /* Reduziert von 8px */
  }

  .station-name {
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 600;
    color: #274b63;
    text-shadow: 0 1px 8px rgba(255, 255, 255, 0.8);
  }

  .station-label {
    font-size: clamp(9px, 1.2vw, 11px);
    font-weight: 400;
    color: #274b63;
    opacity: 0.8;
    margin-top: 2px;       /* Reduziert von 4px */
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

/* Fallback für kleinere Screens */
@media (max-width: 1199px) {
  .location {
    font-size: 36px;
    font-weight: 600;
    color: #274b63;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.3);
    letter-spacing: -0.5px;
  }

  .time {
    font-size: 48px;
    font-weight: 300;
    color: #274b63;
    letter-spacing: 2px;
    margin-top: 8px;
  }

  .station-name {
    font-size: 20px;
    font-weight: 600;
    color: #274b63;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
  }

  .station-label {
    font-size: 12px;
    font-weight: 400;
    color: #274b63;
    opacity: 0.8;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

.station-badge {
  margin-top: 6px;         /* Reduziert von 12px */
  animation: slideUp 0.6s ease-in 0.1s both;
}

.status-badge {
  font-size: 10px;         /* Reduziert von 11px */
  font-weight: 600;
  margin-top: 6px;         /* Reduziert von 8px */
  padding: 3px 6px;        /* Reduziert von 4px 8px */
  border-radius: 4px;
  display: inline-block;
  min-height: 18px;        /* Reduziert von 20px */
  line-height: 1.4;
  animation: slideUp 0.6s ease-in 0.15s both;
}

.status-badge.fallback {
  background-color: rgba(255, 165, 0, 0.25);
  color: #b8860b;
  border: 1px solid rgba(255, 165, 0, 0.5);
}

.status-badge.no-data {
  background-color: rgba(100, 100, 100, 0.2);
  color: #274b63;
  border: 1px solid rgba(100, 100, 100, 0.4);
}

/* Saver mode: hide clock */
html.saver .time {
  display: none;
}

/* Saver mode: smaller header */
html.saver .location {
  font-size: 24px;
  margin-bottom: 4px;
}

html.saver .station-name {
  font-size: 16px;
}

html.saver .station-label {
  font-size: 10px;
}

/* =============================================================================
   WIDGET CONTAINER: KWind iframe
   ============================================================================= */

.widget-container {
  flex: 0 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;

  margin: 0;
  min-height: auto;
  animation: slideUp 0.6s ease-in 0.2s both;
}

/* FIX: Apply zoom to the wrapper, reduced from 1.4 to 1.1 */
@media (min-width: 1200px) {
  .widget-container {
    zoom: 1.1;             /* Reduziert von 1.4 */
    transform-origin: top center;
  }
}

.kwind-iframe {
  max-width: 560px;
  width: 100%;
  border: none;
  border-radius: 8px;

  min-height: 400px;
  zoom: 1;
}

/* Saver mode: no scaling, compact sizing */
html.saver .widget-container {
  flex: none;
  min-height: auto;
  margin: 0;
  zoom: 1;
}

html.saver .kwind-iframe {
  max-width: 480px;
  min-height: 320px;
  zoom: 1;
}

/* =============================================================================
   WINDGURU PANEL
   ============================================================================= */

.windguru-panel {
  margin-top: 0;
  max-width: 100%;
  width: 100%;

  overflow-x: hidden;
  animation: slideUp 0.6s ease-in 0.3s both;

  height: auto;
  min-height: auto;
  
  /* Breitbild: Straffe Paddings */
  @media (min-width: 1200px) {
    padding: 12px !important;  /* Reduziert von 16px default */
  }
}

.windguru-panel > div {
  transform-origin: top center;
  width: 100%;
}

/* Saver mode: more compact */
html.saver .windguru-panel {
  max-width: 100%;
  margin-top: 0;
  padding: 12px !important;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.footer {
  text-align: center;
  margin-top: 0;
  font-size: 11px;         /* Reduziert von 12px */
  color: #274b63;
  opacity: 0.7;

  animation: slideUp 0.6s ease-in 0.4s both;
}

.footer p {
  margin: 0;
}

/* Saver mode: hide footer or make very compact */
html.saver .footer {
  display: none;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================================
   RESPONSIVE: TABLET (unchanged, centered layout)
   ============================================================================= */

@media (max-width: 768px) {
  .screen-container {
    padding: 24px 16px;
  }

  .location {
    font-size: 28px;
  }

  .time {
    font-size: 40px;
  }

  .station-name {
    font-size: 16px;
  }

  .widget-container {
    margin: 20px 0;
    min-height: 300px;
    zoom: 1;
  }

  .kwind-iframe {
    max-width: 100%;
    min-height: 350px;
    zoom: 1;
  }

  .windguru-panel {
    font-size: 12px;
  }
}

/* =============================================================================
   RESPONSIVE: MOBILE
   ============================================================================= */

@media (max-width: 480px) {
  .screen-container {
    padding: 16px 12px;
  }

  .location {
    font-size: 24px;
  }

  .time {
    font-size: 32px;
    letter-spacing: 1px;
  }

  .station-name {
    font-size: 14px;
  }

  .station-label {
    font-size: 10px;
  }

  .widget-container {
    margin: 20px 0;
    min-height: 300px;
    zoom: 1;
  }

  .kwind-iframe {
    min-height: 300px;
    zoom: 1;
  }

  .windguru-panel {
    font-size: 11px;
    padding: 12px !important;
  }
}

/* =============================================================================
   DARK MODE SUPPORT (if needed in future)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
  /* Optional: adjust colors for dark mode */
  /* For now, light mode is sufficient for kiosk/screensaver use */
}
