/* =============================================================================
   SnowWatch — Main Stylesheet
   Adapted from WindWatch (windwatch.css) by the same author.
   
   Organization:
     1. CSS custom properties (design tokens)
     2. Reset / base
     3. Layout
     4. Banner & nav links
     5. Tab system
     6. Flipbook widget
     7. Text product panels (warnings, zone forecast)
     8. Utility classes
============================================================================= */


/* -----------------------------------------------------------------------------
   1. Design tokens
----------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-bg:           #e8eaed;
  --color-surface:      #ffffff;
  --color-border:       #c8ccd4;
  --color-border-light: #e0e2e6;

  --color-accent:       #8b0000;   /* dark red — active states */
  --color-accent-hover: #cc0000;
  --color-active-tab:   #ffffff;
  --color-tab-bg:       #eef0f4;
  --color-tab-hover:    #dde0e8;

  --color-btn-bg:       #f0f2f6;
  --color-btn-hover:    #dde0e8;
  --color-btn-active:   #c8ccd8;
  --color-btn-text:     #222222;

  --color-text:         #222222;
  --color-text-muted:   #666666;
  --color-text-light:   #999999;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;

  /* Typography */
  --font-ui:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Consolas", "Menlo", "Courier New", monospace;
  --font-size-base: 13px;
  --font-size-sm:   11px;
  --font-size-md:   14px;

  /* Radii / shadows */
  --radius-sm: 3px;
  --radius-md: 5px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.10);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.14);

  /* Flipbook */
  --fb-controls-width: 220px;
}


/* -----------------------------------------------------------------------------
   2. Reset / base
----------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: auto;
  background-color: var(--color-bg);
  font-family: var(--font-ui);
  font-size: var(--font-size-base);
  color: var(--color-text);
  min-width: 1000px;
}

p {
  font-size: var(--font-size-base);
  line-height: 1.55;
}


/* -----------------------------------------------------------------------------
   3. Layout
----------------------------------------------------------------------------- */
#page-container {
  width: 98%;
  min-width: 1000px;
  max-width: 1400px;
  margin: 1% auto;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}


/* -----------------------------------------------------------------------------
   4. Banner
   Uses the existing SCL image assets (banner left, logo, background jpg,
   UW seal). Preserves the original visual identity.
----------------------------------------------------------------------------- */
#banner {
  height: 72px;
  display: flex;
  align-items: center;
  background-image: url(../images/SCL_background.jpg);
  background-repeat: repeat-x;
  background-size: auto 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
}

#banner-left {
  height: 72px;
  flex-shrink: 0;
}

#banner-logo {
  height: 72px;
  flex-shrink: 0;
}

#banner-links {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  padding: 6px 8px 0 0;
  gap: var(--space-xs);
  flex-shrink: 0;
}

#banner-right {
  height: 72px;
  width: 182px;
  flex-shrink: 0;
  background-image: url(../images/uw_seal_plus_winter_driving.png);
  background-repeat: no-repeat;
  background-position: center center;
}

.banner-link {
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.35);
  transition: background-color 0.15s, border-color 0.15s;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
.banner-link:hover {
  background: rgba(0,0,0,0.40);
  border-color: rgba(255,255,255,0.60);
  text-decoration: none;
  color: #ffffff;
}


/* -----------------------------------------------------------------------------
   5. Tab system  (jQuery UI tabs — styled to match WindWatch)
----------------------------------------------------------------------------- */
#tabs-div .ui-tabs-nav {
  padding: var(--space-xs) var(--space-sm) 0;
  background-color: var(--color-tab-bg);
  border: none;
  border-bottom: 2px solid var(--color-border);
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

#tabs-div .ui-tabs-nav li {
  margin: 0;
  border: none;
  background: none;
  border-radius: 0;
  top: 0;
}

#tabs-div .ui-tabs-nav li a {
  display: block;
  padding: 7px 14px;
  font-size: var(--font-size-base);
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}

#tabs-div .ui-tabs-nav li a:hover {
  background-color: var(--color-tab-hover);
  color: var(--color-text);
}

#tabs-div .ui-tabs-nav li.ui-tabs-active a {
  background-color: var(--color-active-tab);
  color: var(--color-text);
  font-weight: 600;
  border-color: var(--color-border);
  border-bottom-color: var(--color-active-tab);
  margin-bottom: -2px;
}

/* Tab content area */
#tabs-div .ui-tabs-panel {
  padding: var(--space-md);
  border: none;
  background: var(--color-surface);
}

/* Red highlight for NWS Warnings tab when alerts are active */
#tabs-div .ui-tabs-nav li a .red {
  color: #cc0000;
  font-weight: 700;
}


/* -----------------------------------------------------------------------------
   6. Flipbook widget
----------------------------------------------------------------------------- */

/* Outer wrapper */
.sw-flipbook {
  display: flex;
  align-items: flex-start;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  width: fit-content;
  width: -moz-fit-content;
}

/* Controls sidebar */
.sw-fb-controls {
  width: var(--fb-controls-width);
  flex-shrink: 0;
  padding: var(--space-md) var(--space-sm);
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sw-fb-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Transport buttons: Prev / Play / Next — match WindWatch icon buttons */
.sw-fb-transport {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
}

.sw-transport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background-color 0.1s, border-color 0.1s;
  user-select: none;
}
.sw-transport-btn:hover  { background: var(--color-btn-hover);  border-color: #aaa; }
.sw-transport-btn:active { background: var(--color-btn-active); }

/* Speed slider — native range input (matches WindWatch) */
.sw-fb-speed-wrap {
  padding: 0 var(--space-sm);
}
.sw-fb-speed-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  font-style: italic;
  margin-bottom: 4px;
}
.sw-fb-speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--color-border);
  outline: none;
  cursor: pointer;
}
.sw-fb-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}
.sw-fb-speed-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: 2px solid #fff;
}

/* Option button groups */
.sw-fb-btngroup {
  display: flex;
  flex-direction: column;
}

.sw-fb-btn-option {
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  font-size: var(--font-size-base);
  font-family: var(--font-ui);
  border: 1px solid var(--color-border);
  border-top: none;
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  cursor: pointer;
  transition: background-color 0.1s;
}
.sw-fb-btn-option:first-of-type {
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.sw-fb-btn-option:last-of-type {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.sw-fb-btn-option:only-of-type {
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.sw-fb-btn-option:hover {
  background: var(--color-btn-hover);
}
.sw-fb-btn-option.fb-active {
  background: var(--color-btn-active);
  font-weight: 600;
  color: var(--color-text);
  border-color: #9aa;
}

/* Legend image */
.sw-fb-legend {
  text-align: center;
}
.sw-fb-legend img {
  max-width: 100%;
}

/* About link */
.sw-fb-about-wrap {
  text-align: center;
}
.sw-about-link {
  color: var(--color-accent);
  font-size: var(--font-size-base);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}
.sw-about-link:hover {
  color: var(--color-accent-hover);
}

/* Frame indicator dots */
ul.sw-fb-indicators {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-xs);
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
ul.sw-fb-indicators li {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  cursor: pointer;
  transition: background-color 0.1s;
  font-size: 0;   /* hide number text, use dot shape only */
}
ul.sw-fb-indicators li.fb-dot-active {
  background: var(--color-accent);
}
ul.sw-fb-indicators li.sw-not-loaded {
  background: var(--color-border-light);
  cursor: default;
}
ul.sw-fb-indicators li.sw-skipped {
  background: var(--color-border-light);
  opacity: 0.4;
}

/* Image area */
.sw-fb-images {
  position: relative;
  min-width: 200px;
  min-height: 150px;
  overflow: hidden;
  background: #111;
  /* width/height set dynamically by JS on first image load */
}

.sw-fb-images img {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
}

.sw-fb-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 5;
}


/* -----------------------------------------------------------------------------
   7. Text product panels
----------------------------------------------------------------------------- */
.textProductDiv {
  padding: 12px 14px;
  border: 1px solid #9999cc;
  border-radius: var(--radius-sm);
  background-color: #f9f9ff;
  margin-top: var(--space-xs);
  font-size: 12px;
  line-height: 1.5;
  max-height: 600px;
  overflow-y: auto;
}

.textProductDiv pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--color-text);
}


/* -----------------------------------------------------------------------------
   8. Utility
----------------------------------------------------------------------------- */
.red { color: #cc0000; }

.copyright {
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  padding: var(--space-sm) var(--space-md);
  text-align: right;
}
