@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* High contrast text tokens for dark theme */
  --color-text-highlight: #ffffff;
  --color-text-paragraph: #f8fafc;
  --color-text-base: #e2e8f0;
  --color-text-base-muted: #cbd5e1;
  --color-text-subdue: #94a3b8;

  /* Accent colors */
  --color-primary: #a78bfa;
  --color-info: #38bdf8;
  --color-positive: #4ade80;
  --color-warning: #fbbf24;
  --color-negative: #f87171;
  --color-popover-border: rgba(167, 139, 250, 0.4);
  --color-background: #090e18;

  /* Glass tokens */
  --color-widget-background: rgba(15, 23, 42, 0.65);
  --glass-saturation: 1.2;
  --glass-blur: 16px;
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
}

/* SVG filter container from RedVelocity */
.glass-surface__filter {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Fullscreen background with Patagonia image */
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-image: url('/assets/images/patagonia.png');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  min-height: 100vh;
  color: var(--color-text-base);
  overflow-y: auto;
}

/* ============================================================
   Top Navigation Bar & Header
   ============================================================ */

.header-container {
  margin-bottom: var(--widget-gap);
}

.header {
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation)) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  padding: 0 1.6rem !important;
  height: var(--header-height) !important;
  display: flex !important;
  align-items: center !important;
}

.header .logo {
  border-right: none !important;
  padding-right: 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
}

.header .logo-svg {
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.5));
}

.nav {
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
}

.nav-item {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  font-size: 1.35rem !important;
  font-weight: 500 !important;
  color: rgba(241, 245, 249, 0.72) !important;
  border-bottom: 2px solid transparent !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  padding: 0 0.8rem !important;
  line-height: normal !important;
}

.nav-item:hover {
  color: #ffffff !important;
  border-bottom-color: rgba(255, 255, 255, 0.4) !important;
}

.nav-item.nav-item-current {
  color: #ffffff !important;
  font-weight: 600 !important;
  border-bottom-color: #a78bfa !important;
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.4) !important;
}

.nav-item-icon {
  width: 1.65rem !important;
  height: 1.65rem !important;
  margin-right: 0.6rem !important;
  vertical-align: middle !important;
}

/* ============================================================
   Widget Titles (High Contrast Badge Style)
   ============================================================ */

.widget-header {
  margin-bottom: 0.9rem;
  padding-inline: 0 !important;
}

.widget-title-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px 14px !important;
  border-radius: 8px !important;
  background: rgba(15, 23, 42, 0.78) !important;
  backdrop-filter: blur(12px) saturate(1.2) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.widget-title-wrapper span {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 1.25rem !important;
  letter-spacing: 0.07em !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

.widget-title-wrapper:hover {
  border-color: rgba(167, 139, 250, 0.45) !important;
  box-shadow: 0 4px 16px rgba(167, 139, 250, 0.25) !important;
}

.widget-header h2 {
  color: #ffffff !important;
}

/* ============================================================
   Widget Content Cards (Frosted Glass)
   ============================================================ */

.widget-content:not(.widget-content-frameless),
.widget-content-frame {
  position: relative;
  background: var(--color-widget-background) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--border-radius) !important;
  box-shadow:
    0 8px 32px 0 rgba(0, 0, 0, 0.38),
    0 2px 6px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 16px rgba(167, 139, 250, 0.03) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.widget-content:not(.widget-content-frameless):hover {
  border-color: rgba(167, 139, 250, 0.3) !important;
  box-shadow:
    0 12px 40px 0 rgba(0, 0, 0, 0.48),
    0 2px 8px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 20px rgba(167, 139, 250, 0.08) !important;
}

/* ============================================================
   Search Widget
   ============================================================ */

.search {
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.25s ease !important;
}

.search:hover {
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.search:focus-within {
  border-color: rgba(167, 139, 250, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.25), 0 8px 30px rgba(0, 0, 0, 0.4) !important;
}

.search-input {
  color: #ffffff !important;
  font-size: 1.45rem !important;
}

.search-input::placeholder {
  color: rgba(226, 232, 240, 0.5) !important;
}

.search-icon {
  stroke: rgba(226, 232, 240, 0.8) !important;
}

/* ============================================================
   Bookmarks Widget
   ============================================================ */

.bookmarks-group-title {
  font-weight: 700 !important;
  font-size: 1.5rem !important;
  letter-spacing: 0.03em !important;
  margin-bottom: 0.8rem !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7) !important;
}

.bookmarks-link {
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 1.35rem !important;
  text-decoration: none !important;
  transition: color 0.15s ease !important;
}

.bookmarks-link:hover {
  color: var(--bookmarks-group-color) !important;
  text-shadow: 0 0 8px currentColor !important;
}

.bookmarks-icon-container {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  padding: 0.5rem !important;
  opacity: 0.9 !important;
}

.bookmarks-icon {
  width: 20px;
  height: 20px;
  opacity: 1 !important;
}

/* Bookmark descriptions */
.bookmarks-group li > div:not(.flex) {
  color: rgba(226, 232, 240, 0.72) !important;
  font-size: 1.15rem !important;
  margin-top: 0.15rem !important;
  line-height: 1.35 !important;
}

/* ============================================================
   Server Stats Widget
   ============================================================ */

.server-details .size-h3 {
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 1.5rem !important;
}

.server-details .color-subdue {
  color: rgba(203, 213, 225, 0.75) !important;
  font-size: 1.2rem !important;
}

.server-stats {
  color: rgba(241, 245, 249, 0.9) !important;
  font-weight: 500 !important;
}

.server-icon {
  color: #a78bfa !important;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.35));
}

/* ============================================================
   Weather & Clock
   ============================================================ */

.widget-type-clock {
  color: #ffffff !important;
  padding-top: 4.2rem !important;
}

.widget-type-clock .size-h1 {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6) !important;
}

.widget-type-weather {
  color: #ffffff !important;
}

.widget-type-weather .size-h2,
.widget-type-weather .size-h3 {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.widget-type-weather .color-subdue {
  color: rgba(226, 232, 240, 0.8) !important;
}

/* ============================================================
   F1 Next Race Widget
   ============================================================ */

.widget-type-custom-api .color-highlight {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.widget-type-custom-api .color-primary {
  color: #38bdf8 !important;
  font-weight: 600 !important;
}

.widget-type-custom-api .size-h5 {
  color: rgba(226, 232, 240, 0.82) !important;
}

/* F1 session countdown badges */
.widget-type-custom-api .color-highlight[title] {
  display: inline-block;
  background: rgba(167, 139, 250, 0.22) !important;
  color: #c084fc !important;
  border: 1px solid rgba(167, 139, 250, 0.4) !important;
  border-radius: 5px !important;
  padding: 1px 7px !important;
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  margin-left: 6px !important;
}

/* F1 Circuit tag badges */
.widget-type-custom-api .attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}

.widget-type-custom-api .attachments li {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 6px !important;
  color: #e2e8f0 !important;
  padding: 2px 8px !important;
  font-size: 1.15rem !important;
  font-weight: 500 !important;
}

/* ============================================================
   Service Health Monitor
   ============================================================ */

.monitor-site a {
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 1.35rem !important;
  text-decoration: none !important;
}

.monitor-site a:hover {
  color: #a78bfa !important;
}

.monitor-site .color-subdue,
.monitor-site .text-truncate:not(a) {
  color: rgba(226, 232, 240, 0.72) !important;
  font-size: 1.15rem !important;
}

/* Glowing positive status icon */
svg[fill="var(--color-positive)"],
.monitor-site-status-icon svg[fill="var(--color-positive)"] {
  fill: #4ade80 !important;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.45));
}

/* Glowing negative status icon */
svg[fill="var(--color-negative)"],
.monitor-site-status-icon svg[fill="var(--color-negative)"] {
  fill: #f87171 !important;
  filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.5));
}

/* ============================================================
   Clean Scrollbars
   ============================================================ */

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* ============================================================
   Horizontal Row Alignment (Subgrid)
   Aligns Row 1 elements (Clock, Search, Services) with whitespace
   under smaller items so Row 2 (Weather, Bookmarks, F1 Next Race)
   starts at the exact same horizontal height.
   ============================================================ */

@media (min-width: 1191px) {
  .page-columns:has(> .page-column:nth-child(3)) {
    display: grid !important;
    grid-template-columns: var(--page-column-small-width, 300px) minmax(0, 1fr) var(--page-column-small-width, 300px) !important;
    grid-template-rows: auto auto auto !important;
    gap: var(--widget-gap) !important;
    align-items: start !important;
  }

  .page-columns:has(> .page-column:nth-child(3)) > .page-column {
    display: grid !important;
    grid-template-rows: subgrid !important;
    grid-row: span 3 !important;
    gap: var(--widget-gap) !important;
    width: 100% !important;
  }

  /* Reset margin-top between widgets since grid gap handles row spacing */
  .page-columns:has(> .page-column:nth-child(3)) > .page-column > .widget + .widget {
    margin-top: 0 !important;
  }

  /* Row 1 widgets sit at the top of their cell; whitespace naturally flows beneath */
  .page-columns:has(> .page-column:nth-child(3)) > .page-column > .widget:first-child {
    align-self: start !important;
  }

  /* In Column 2 (Bookmarks) and Column 3 (F1 Next Race), the 2nd widget spans rows 2 and 3 */
  .page-columns:has(> .page-column:nth-child(3)) > .page-column:nth-child(2) > .widget:nth-child(2),
  .page-columns:has(> .page-column:nth-child(3)) > .page-column:nth-child(3) > .widget:nth-child(2) {
    grid-row: 2 / span 2 !important;
    align-self: start !important;
  }
}

