/* ==============================
   GLOBAL THEME — matches iOS app
   ============================== */
:root {
  --bg: #020711;
  --bg-card: #061325;
  --accent: #29a8ff;
  --accent-soft: rgba(41,168,255,0.18);
  --text-main: #e5f1ff;
  --text-subtle: #91a8c7;
  --text-muted: #6e85a3;
  --radius: 18px;
  --shadow: 0 14px 32px rgba(0,0,0,0.65);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "SF Pro Text",
    "SF Pro Display", Inter, Arial, sans-serif;
}

body {
  background: radial-gradient(circle at top, #082446 0, #020711 45%, #000 100%);
  color: var(--text-main);
}

/* ==============================
   Landing page
   ============================== */

.landing-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 16px 40px;
}

.landing-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-icon {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 14px 32px rgba(0,0,0,0.6);
}

.title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

.hero-card {
  background: linear-gradient(145deg, #061325, #071a33);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin: 24px auto 26px;
}

.hero-title {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.hero-text {
  font-size: 0.95rem;
  color: var(--text-subtle);
  max-width: 640px;
}

.hero-buttons {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px; /* Reduced padding from 7px 14px */
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn.primary {
  background: var(--accent);
  color: #001524;
  border-color: var(--accent);
}

.btn.secondary {
  background: transparent;
  color: var(--text-main);
  border-color: var(--accent-soft);
}

.btn:hover {
  opacity: 0.88;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* grid of sections */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.section-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background 0.18s ease-out;
}

.section-item h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.section-item p {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.section-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.7);
}

.section-disabled {
  cursor: default;
  opacity: 0.85;
}

/* footer */

.footer {
  text-align: center;
  margin-top: 32px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links {
  margin-bottom: 4px;
}

.footer a {
  color: var(--text-subtle);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
}

/* ==============================
   Subpages (Lat/Long, Support, Privacy)
   ============================== */

.page-latlong .container,
.page-generic .container,
.page-hex .container,
.page-angles .container,
.page-links .container,
.page-time .container,
.page-flight .container {
  width: 92%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 0 60px; /* Reduced top padding from 32px */
}

/* Responsive Container - already used .container above */

/* Results - Responsive Row */
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* For compact results (Number Converter) */
.resultsInner {
  max-width: 540px; /* Reduced from 720px to tighten horizontally */
  margin: 0 auto;
  /* Remove or reduce internal padding if labels feel too indented */
}

/* Widen Number Converter results slightly (approx +18%) */
.page-hex .resultsInner,
.page-time .resultsInner,
.page-flight .resultsInner {
  max-width: 640px;
}

.result-group-right {
  display: flex;
  align-items: center;
  gap: 8px; /* Reduced from 12px */
  justify-content: flex-end;
}

.result-group-right .result-value {
  margin-bottom: 0; /* Remove bottom margin when inline */
  text-align: right;
}

@media (max-width: 768px) {
  .result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
  }

  .result-row:last-child {
    border-bottom: none;
  }

  .result-label {
    font-size: 0.85rem;
    margin-bottom: 2px;
  }

  .result-value, .result-note {
    font-size: 1.1rem;
    margin-bottom: 8px;
    word-break: break-all;
  }

  .result-group-right {
    width: 100%;
    justify-content: space-between; /* Spread out on mobile row */
    margin-top: 4px;
  }
  
  .result-group-right .result-value {
    text-align: left;
  }

  .chip-copy {
    width: 100%;
    padding: 10px;
    text-align: center;
    margin-top: 4px;
  }
  
  /* Override for group-right icon button */
  .result-group-right .chip-icon {
    width: auto;
    margin-top: 0;
    padding: 8px;
  }
  
  /* Pair copy container wrapping */
  /* The inline style currently handles wrapping, but let's ensure buttons grow */
  /* We target the div immediately following "Copy Both:" text if we can select it, 
     or rely on utility classes if we added them. 
     Since current implementation uses inline styles for that specific div, 
     we might need to add a class to it in HTML step or rely on button width. */
}

/* Quick Paste Responsive */
.quick-paste-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .quick-paste-container {
    flex-direction: column;
  }
  
  .quick-paste-container .field-input {
    width: 100%;
    min-width: 0 !important; /* Override inline style if present */
  }

  .quick-paste-container .btn {
    width: 100%;
    margin-top: 4px;
  }
}

/* DMS Responsive Stack */
@media (max-width: 600px) {
  .dms-row {
    flex-wrap: wrap;
    justify-content: center; /* Center items when wrapped */
  }
}

/* Links Page Cards */
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-decoration: none;
  background: #0e1726; /* Dark background */
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease-out; /* Smooth 200ms transition */
  text-align: left;
  appearance: none;
  font-family: inherit;
  color: inherit;
}

/* Hover effects (Desktop mainly) */
@media (hover: hover) {
  .link-card:hover {
    background: #142035; /* Brighter background (~+6% lightness) */
    border-color: rgba(41, 168, 255, 0.4);
    box-shadow: 0 0 12px rgba(41, 168, 255, 0.15); /* Soft outer glow */
    transform: translateY(-1px);
  }

  .link-card:hover .link-icon-arrow svg {
    transform: scale(1.08); /* Icon scales 1.08x */
    transition: transform 0.2s ease-out;
  }
}

.link-card:active {
  transform: scale(0.99);
}

.link-card-left {
  display: flex;
  align-items: flex-start;
  gap: 16px; /* Space between favicon and text */
  flex: 1;
}

.link-favicon {
  width: 27px; /* Reduced from 32px by ~15% */
  height: 27px;
  border-radius: 5px; /* Adjusted radius */
  flex-shrink: 0;
  margin-top: 1px; /* Slight optical adjustment */
}

.link-text-group {
  display: flex;
  flex-direction: column;
}

.link-title {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 4px;
  font-weight: 500;
}

.link-desc {
  font-size: 0.88rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

.link-icon-arrow {
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: 12px;
}

.link-card:hover .link-icon-arrow {
  color: var(--accent);
  opacity: 1;
}


/* Quick Tools Grid */
.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
}

.btn-quick {
  background: #0f2238;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 7px 4px; /* Reduced vertical padding from 8px */
  border-radius: 12px;
  font-size: 0.8rem; /* Slightly smaller text */
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.btn-quick:hover {
  background: #152d48;
  border-color: var(--accent-soft);
}

.btn-quick:active {
  transform: scale(0.98);
}


.subpage-header {
  width: 92%;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 18px;
}

/* Back link */

.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.back-link:hover {
  opacity: 0.85;
}

/* Cards */

.card {
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 16px 16px; /* Reduced padding from 16px 20px */
  margin-bottom: 16px; /* Reduced margin from 20px */
}

.card-tight {
  padding-top: 12px; /* Reduced from 14px */
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: 2px; /* Reduced from 4px to tighten header */
}

/* Page titles */

.page-title {
  font-size: 1.6rem;
  margin-bottom: 4px;
  color: var(--accent);
  font-weight: 700;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-subtle);
  margin-bottom: 16px;
}

/* segmented control */

.segmented-control {
  display: flex;
  gap: 8px;
  margin-top: 8px; /* Reduced from 12px */
}

.segment {
  flex: 1;
  padding: 4px 0; /* Reduced padding from 5px 0 */
  border-radius: 999px;
  background: #020c19;
  border: 1px solid var(--accent-soft);
  color: var(--text-main);
  font-size: 0.85rem; /* Reduced from 0.9rem */
  cursor: pointer;
}

.segment.is-active {
  background: var(--accent);
  color: #00263b;
}

/* Input groups */

.field-group {
  margin-bottom: 11px; /* Reduced from 14px */
}

.field-label {
  display: block;
  margin-bottom: 3px; /* Reduced from 5px */
  font-size: 0.88rem;
  color: var(--text-subtle);
}

/* ==============================
   Input Styling (Universal)
   ============================== */

/* Base Input Style */
.field-input,
.dms-input,
.dms-select,
textarea.field-input {
  background-color: #1d1f28;
  border: 1px solid #3c3f4d;
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.95rem; /* Standard body size */
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

/* Specific Padding & Layout */
.field-input {
  width: 100%;
  padding: 10px 10px; /* Reduced horizontal padding from 14px */
}

textarea.field-input {
  padding: 10px 10px;
  font-family: inherit;
  line-height: 1.5;
}

/* DMS Specific Row Layout */
.dms-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  width: fit-content;
}

.dms-input {
  flex: 0 0 auto;
  width: 80px; /* Increased to approx 7 characters width */
  min-width: 0;
  padding: 10px 4px;
  text-align: center;
}

.dms-select {
  flex: 0 0 auto;
  width: 60px; /* Slightly wider for comfort */
  text-align: center;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2329a8ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 10px;
  padding: 10px 10px 10px 2px;
  font-size: 0.88rem;
}

/* Focus State */
.field-input:focus,
.dms-input:focus,
.dms-select:focus,
textarea.field-input:focus {
  outline: none;
  border-color: #4da3ff;
  background-color: #181a22; /* Slightly darker */
  box-shadow: 0 0 8px rgba(77, 163, 255, 0.33); /* Soft glow */
}

/* Placeholder */
.field-input::placeholder,
.dms-input::placeholder,
textarea.field-input::placeholder {
  color: #7a7d88;
}

.field-input.short-input {
  max-width: 33%;
}

/* Hex / Bin / Dec Specific */

.field-group-row {
  display: flex;
  flex-direction: column; /* Stack vertically to allow input to be on left easily */
  align-items: flex-start;
  gap: 6px; /* Reduced from 8px */
  margin-bottom: 11px; /* Reduced from 14px */
}

.field-label-row {
  font-size: 0.88rem; /* Match other labels */
  color: var(--text-subtle);
  margin-bottom: 0;
  margin-right: 0;
}

.input-right {
  text-align: left;
  max-width: 30%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.result-blue {
  color: var(--accent);
  font-size: 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-all;
}

.chip-icon {
  background: transparent;
  color: var(--accent);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.chip-icon:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Helper text */

.helper-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Results */

.result-block {
  margin-bottom: 6px; /* Reduced from 8px */
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px; /* Reduced from 4px */
}

.result-label {
  font-size: 0.85rem; /* Slightly smaller label */
  color: var(--text-muted);
  line-height: 1.3;
}

.result-value {
  font-size: 1rem;
  margin-bottom: 0;
  line-height: 1.4;
}

.result-note {
  font-size: 0.82rem;
  opacity: 0.9;
}

.result-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  letter-spacing: 0.04em;
}

.divider {
  border: none;
  border-bottom: 1px solid #11253b;
  margin: 8px 0; /* Reduced from 10px */
}

/* Copy chips */

.chip {
  border-radius: 999px;
  padding: 3px 8px; /* Reduced horizontal padding from 10px */
  font-size: 0.76rem;
  border: none;
}

.chip-copy {
  background: var(--accent-soft);
  color: var(--text-main);
  cursor: pointer;
}

.chip-copy:hover {
  background: var(--accent);
  color: #001522;
}

.chip-copy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Generic content */

.body-text {
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 10px;
}

.body-list {
  margin: 10px 0 10px 18px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.body-list li {
  margin-bottom: 4px;
}

.link-strong {
  color: var(--accent);
  text-decoration: none;
}
.link-strong:hover {
  opacity: 0.85;
}

/* Bottom nav to mimic app */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(3, 10, 20, 0.96);
  border-top: 1px solid #071b2f;
  display: flex;
  justify-content: space-around;
  padding: 9px 0 10px;
}

.bottom-nav-item {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

.bottom-nav-item.is-active {
  color: var(--accent);
}

.bottom-nav-item.is-disabled {
  opacity: 0.35;
}

/* Subpage footer spacing */

.footer-subpage {
  margin-top: 24px;
  padding-bottom: 14px;
}

/* Responsive tweaks */

@media (max-width: 600px) {
  .hero-card {
    padding: 22px 18px;
  }

  .landing-main {
    padding-top: 28px;
  }
}

/* METAR Decoder - Crosswind severity status */

.wind-status-text {
  margin-top: 4px;
  font-size: 0.9rem;
}

.wind-status-minimal {
  color: #a9b3c7;
}

.wind-status-moderate {
  color: #f9c74f;
}

.wind-status-strong {
  color: #f94144;
}

/* METAR Crosswind Severity Classes */
.runway-winds-severity {
  margin-top: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.metar-xwind-low {
  color: #4ade80; /* Subtle green for minimal crosswind */
}

.metar-xwind-mod {
  color: #facc15; /* Amber/yellow for moderate crosswind */
}

.metar-xwind-high {
  color: #f97373; /* Muted red for strong crosswind */
}
