/* ============================================================
   Reef Manager - Tema reef (oceánico, dark-first, responsive)
   ============================================================ */
:root {
  --bg:        #071320;   /* fondo profundo */
  --bg-2:      #0a1a2f;   /* barras */
  --card:      #0e2138;   /* tarjetas */
  --card-2:    #12294a;
  --border:    #1c3a5e;
  --text:      #e8f2fb;
  --muted:     #8fb0cc;
  --primary:   #22d3ee;   /* cian agua */
  --primary-d: #0891b2;
  --coral:     #ff7a59;   /* acento coral */
  --coral-d:   #e85d3a;
  --green:     #34d399;
  --amber:     #fbbf24;
  --red:       #f87171;
  --shadow:    0 6px 20px rgba(0,0,0,.35);
  --radius:    16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #0d2a49 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

#app { max-width: 900px; margin: 0 auto; padding-bottom: 84px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--bg-2), rgba(10,26,47,.85));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 22px; }
.brand-name { font-weight: 700; letter-spacing: .3px; font-size: 18px; }
.brand-name span { color: var(--primary); }
.topbar-status { font-size: 12px; color: var(--muted); }

/* ---------- Vistas ---------- */
.view { padding: 18px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1.title { font-size: 20px; margin: 4px 0 2px; }
p.subtitle { color: var(--muted); margin: 0 0 18px; font-size: 13px; }

/* ---------- Tarjetas ---------- */
.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h2 .ico { font-size: 18px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

/* ---------- Formularios ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px;
  background: #08192c; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,211,238,.15); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--card-2); color: var(--text); border: 1px solid var(--border);
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-d)); color: #04222b; border: none; }
.btn-coral   { background: linear-gradient(180deg, var(--coral), var(--coral-d)); color: #2a0e06; border: none; }
.btn-ghost   { background: transparent; }
.btn-sm      { padding: 7px 12px; font-size: 13px; }
.btn-block   { width: 100%; }

/* ---------- Resultado volumen (destacado) ---------- */
.big-result {
  text-align: center; padding: 20px;
  background: radial-gradient(400px 200px at 50% 0%, rgba(34,211,238,.18), transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.big-result .value { font-size: 42px; font-weight: 800; color: var(--primary); line-height: 1; }
.big-result .unit  { font-size: 16px; color: var(--muted); }
.big-result .caption { font-size: 12px; color: var(--muted); margin-top: 8px; }
.sub-results { display: flex; justify-content: center; gap: 24px; margin-top: 14px; flex-wrap: wrap; }
.sub-results div { text-align: center; }
.sub-results b { display: block; font-size: 18px; }
.sub-results small { color: var(--muted); font-size: 11px; }

/* ---------- Estado / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip.ok    { background: rgba(52,211,153,.15); color: var(--green); }
.chip.warn  { background: rgba(251,191,36,.15); color: var(--amber); }
.chip.bad   { background: rgba(248,113,113,.15); color: var(--red); }
.chip.muted { background: rgba(143,176,204,.12); color: var(--muted); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); } .dot.muted { background: var(--muted); }

/* ---------- Listas ---------- */
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--muted); font-size: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(8,20,34,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  max-width: 900px; margin: 0 auto;
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; cursor: pointer; font: inherit;
}
.nav-btn span { font-size: 20px; }
.nav-btn label { font-size: 10px; cursor: pointer; }
.nav-btn.active { color: var(--primary); }
.nav-btn.active span { filter: drop-shadow(0 0 6px rgba(34,211,238,.6)); }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50;
  box-shadow: var(--shadow); animation: fade .2s ease;
}

/* Desktop: nav a la izquierda */
@media (min-width: 760px) {
  #app { display: grid; grid-template-columns: 190px 1fr; grid-template-rows: auto 1fr; max-width: 1100px; padding-bottom: 0; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: 64px; flex-direction: column; justify-content: flex-start;
    height: calc(100vh - 64px); border-top: none; border-right: 1px solid var(--border);
    background: transparent; max-width: none; margin: 0; padding: 14px 8px;
  }
  .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; }
  .nav-btn span { font-size: 18px; }
  .nav-btn label { font-size: 14px; }
  .nav-btn.active { background: var(--card); }
  .view { grid-column: 2; }
}
