/* Água Tracker — dark, aqua + acentos lime/violeta (padrão Renan). */
:root {
  --bg: #0b1020;
  --bg-2: #10162e;
  --card: rgba(255, 255, 255, 0.04);
  --stroke: rgba(255, 255, 255, 0.10);
  --text: #eaf2ff;
  --muted: #93a0c4;
  --aqua: #2aa9ff;
  --aqua-soft: #5fe0ff;
  --lime: #b8ff3a;
  --violet: #7c5cff;
  --danger: #ff6b6b;
  --radius: 22px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(124, 92, 255, 0.20), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(42, 169, 255, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- barra de usuário ---------- */
.profilebar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: 16px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.profilebar:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #04121f;
  background: linear-gradient(135deg, var(--u1, #5fe0ff), var(--u2, #7c5cff));
  flex-shrink: 0;
}
.pb-name { font-weight: 700; font-size: 15px; }
.pb-switch { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .drop { font-size: 34px; filter: drop-shadow(0 4px 10px rgba(42,169,255,.5)); }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.5px; }
.tagline { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.09); transform: rotate(30deg); }

/* ---------- seletor de dia ---------- */
.day-nav {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.nav-arrow {
  width: 46px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.nav-arrow:hover { background: rgba(255,255,255,.08); }
.nav-arrow:active { transform: scale(.94); }
.nav-arrow:disabled { opacity: .3; cursor: not-allowed; }

.day-pick {
  position: relative;
  flex: 1;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: background .15s;
}
.day-pick:hover { background: rgba(255,255,255,.07); }
.day-label { font-weight: 700; font-size: 15px; }
.day-date { font-size: 12px; color: var(--muted); }
.day-pick input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ---------- abas ---------- */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 5px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .18s, color .18s;
}
.tab.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(42,169,255,.22), rgba(124,92,255,.22));
  box-shadow: inset 0 0 0 1px var(--stroke);
}
.tab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--violet);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- garrafa ---------- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bottle-wrap {
  position: relative;
  width: 220px;
  height: 400px;
  display: grid;
  place-items: center;
}
.bottle {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 24px 40px rgba(42, 169, 255, 0.22));
}
.glass { stroke: none; }
.outline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 2.5;
}
.wave { fill: url(#waterGrad); }
.wave-back { opacity: 0.55; animation: waveMove 5.5s linear infinite; }
.wave-front { animation: waveMove 3.2s linear infinite reverse; }
#waterGroup { transition: transform 0.9s cubic-bezier(.22,.61,.36,1); }

@keyframes waveMove {
  from { transform: translateX(0); }
  to   { transform: translateX(-200px); }
}

.ticks line { stroke: rgba(255,255,255,0.28); stroke-width: 1.5; stroke-dasharray: 3 4; }
.ticks text { fill: rgba(255,255,255,0.45); font-size: 9px; }

.readout {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0,0,0,.55);
}
.pct { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.liters { margin-top: 4px; font-size: 20px; font-weight: 700; }
.liters small { font-size: 13px; color: rgba(255,255,255,.75); font-weight: 600; }

/* ---------- andamento: fileira de garrafinhas ---------- */
.bottle-status {
  font-size: 15px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.2px;
}
.bottle-status.done { color: var(--lime); }
.bottle-track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px 8px;
  margin: 4px 0 2px;
  max-width: 320px;
}
.mini-bottle {
  position: relative;
  width: 22px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mb-cap {
  width: 9px;
  height: 6px;
  border-radius: 3px 3px 1px 1px;
  background: rgba(255, 255, 255, 0.25);
  margin-bottom: 1px;
}
.mb-body {
  position: relative;
  width: 100%;
  flex: 1;
  border: 1.5px solid var(--stroke);
  border-radius: 6px 6px 8px 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
.mb-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(180deg, var(--aqua-soft), var(--aqua));
  transition: height 0.6s cubic-bezier(.22,.61,.36,1);
}
.mini-bottle .mb-num {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
/* garrafa concluída */
.mini-bottle.done .mb-fill { background: linear-gradient(180deg, var(--lime), #7ecb1f); }
.mini-bottle.done .mb-cap { background: var(--lime); }
.mini-bottle.done .mb-num { color: #08210a; text-shadow: none; }
/* garrafa atual (a que você está enchendo) */
.mini-bottle.current .mb-body {
  border-color: var(--aqua-soft);
  box-shadow: 0 0 0 2px rgba(95, 224, 255, 0.35), 0 0 14px rgba(95, 224, 255, 0.4);
  animation: bottlePulse 1.6s ease-in-out infinite;
}
.mini-bottle.current .mb-cap { background: var(--aqua-soft); }
@keyframes bottlePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(95,224,255,0.30), 0 0 10px rgba(95,224,255,0.30); }
  50% { box-shadow: 0 0 0 3px rgba(95,224,255,0.55), 0 0 18px rgba(95,224,255,0.55); }
}

.bottles-count {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}
.remaining { font-size: 13px; color: var(--muted); }
.remaining.done { color: var(--lime); font-weight: 700; }

/* ---------- ações ---------- */
.actions { display: flex; flex-direction: column; gap: 12px; }

.add-main {
  border: none;
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(135deg, var(--aqua-soft), var(--aqua) 55%, var(--violet));
  color: #04121f;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 12px;
  box-shadow: 0 14px 30px rgba(42, 169, 255, 0.35);
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.add-main .plus { grid-row: 1 / 3; font-size: 30px; font-weight: 800; }
.add-main .add-label { font-size: 18px; font-weight: 800; text-align: left; }
.add-main .add-sub { grid-column: 2; grid-row: 2; font-size: 12.5px; font-weight: 700; opacity: .8; text-align: left; }
.add-main:hover { filter: brightness(1.05); }
.add-main:active { transform: scale(.97); }
.add-main.pop { animation: pop .35s ease; }
.add-main.compact { grid-template-columns: 1fr; padding: 12px 18px; text-align: center; box-shadow: none; }
.add-main.compact .add-label { text-align: center; font-size: 16px; }

@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.add-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.chip {
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: background .15s, transform .1s, border-color .15s;
}
.chip small { font-weight: 600; color: var(--muted); font-size: 11px; }
.chip:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }
.chip:active { transform: scale(.95); }

.minor-row { display: flex; justify-content: space-between; gap: 10px; }
.ghost {
  flex: 1;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.ghost:hover { background: rgba(255,255,255,.05); color: var(--text); }
.ghost.danger:hover { color: var(--danger); border-color: rgba(255,107,107,.4); }

/* ---------- histórico ---------- */
.history {
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
}
.history h2 { margin: 0 0 14px; font-size: 15px; color: var(--muted); font-weight: 700; }
.hist-bars {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 96px;
}
.hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.hist-track {
  width: 100%;
  max-width: 26px;
  flex: 1;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hist-fill {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--aqua-soft), var(--aqua));
  transition: height .6s cubic-bezier(.22,.61,.36,1);
  min-height: 3px;
}
.hist-fill.goal { background: linear-gradient(180deg, var(--lime), #7ecb1f); }
.hist-day { font-size: 10px; color: var(--muted); white-space: nowrap; }

.footer { text-align: center; font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* ---------- aba comprimidos ---------- */
.view { display: flex; flex-direction: column; gap: 18px; }

.pills-summary {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 0;
}
.pills-summary.done { color: var(--lime); }
.pills-summary small { display: block; font-weight: 600; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.periods { display: flex; flex-direction: column; gap: 14px; }

.period-card {
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 14px 8px;
}
.period-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.period-emoji { font-size: 20px; }
.period-title { font-size: 15px; font-weight: 800; }
.period-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  padding: 3px 9px;
  border-radius: 999px;
}
.period-count.done { color: var(--lime); background: rgba(184,255,58,.12); }

.med-list { display: flex; flex-direction: column; }
.med-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  background: none;
  border: none;
  border-top: 1px solid rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: opacity .15s;
}
.med-row:first-child { border-top: none; }
.med-emoji { font-size: 22px; width: 26px; text-align: center; flex-shrink: 0; }
.med-name { flex: 1; font-size: 15px; font-weight: 600; }
.med-check {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--stroke);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: transparent;
  flex-shrink: 0;
  transition: all .18s;
}
.med-row.taken .med-name { color: var(--muted); text-decoration: line-through; }
.med-row.taken .med-emoji { filter: grayscale(.3); opacity: .7; }
.med-row.taken .med-check {
  background: linear-gradient(135deg, var(--lime), #7ecb1f);
  border-color: transparent;
  color: #08210a;
}
.med-row:active { opacity: .6; }

.pills-empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
}
.pills-empty-emoji { font-size: 44px; margin-bottom: 10px; }
.pills-empty p { margin: 0; font-size: 14px; line-height: 1.5; }

.manage-btn { box-shadow: none; background: linear-gradient(135deg, var(--violet), #5b3fe0); color: #fff; }

/* lista de gerenciamento no modal */
.meds-modal { max-width: 400px; max-height: 88vh; overflow-y: auto; }
.meds-manage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.meds-manage-list:empty { display: none; }
.manage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(0,0,0,.2);
}
.manage-item .m-emoji { font-size: 20px; }
.manage-item .m-info { flex: 1; min-width: 0; }
.manage-item .m-name { font-size: 14px; font-weight: 700; }
.manage-item .m-periods { font-size: 11px; color: var(--muted); margin-top: 1px; }
.manage-item .m-btn {
  border: none;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.manage-item .m-btn:hover { background: rgba(255,255,255,.12); color: var(--text); }
.manage-item .m-btn.del:hover { color: var(--danger); }

.med-form {
  border-top: 1px solid var(--stroke);
  margin-top: 6px;
  padding-top: 14px;
}
.med-form h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 700; }
.med-form-row { display: flex; gap: 8px; margin-bottom: 12px; }
.med-form-row input {
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
}
.med-form-row input:focus { outline: none; border-color: var(--violet); }
.emoji-input { width: 58px; text-align: center; flex-shrink: 0; }
.med-form-row input:not(.emoji-input) { flex: 1; min-width: 0; }

.period-toggles { display: flex; gap: 8px; margin-bottom: 12px; }
.period-toggles label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 4px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.period-toggles label:has(input:checked) {
  background: rgba(124,92,255,.18);
  border-color: var(--violet);
}
.period-toggles input { accent-color: var(--violet); }
.med-form-msg { color: var(--danger); font-size: 12.5px; margin-bottom: 10px; }
.meds-close { width: 100%; margin-top: 14px; }

/* ---------- confete ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute;
  top: -12px;
  width: 9px; height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

/* ---------- seletor de perfil ---------- */
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 600px at 20% 0%, rgba(124,92,255,.28), transparent 60%),
    radial-gradient(900px 600px at 100% 20%, rgba(42,169,255,.24), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  animation: rise .25s ease;
}
.profile-picker { text-align: center; width: 100%; max-width: 420px; }
.pp-drop { font-size: 46px; filter: drop-shadow(0 6px 14px rgba(42,169,255,.5)); }
.profile-picker h2 { margin: 10px 0 4px; font-size: 24px; }
.pp-sub { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.profile-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-card {
  border: 1px solid var(--stroke);
  background: var(--card);
  border-radius: 22px;
  padding: 24px 12px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .2s;
}
.profile-card:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.25);
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(0,0,0,.35);
}
.profile-card:active { transform: scale(.97); }
.profile-card .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile-card span:last-child { font-size: 17px; font-weight: 700; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #141b34, #0e1428);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.field input {
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.25);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--aqua); }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .ghost, .modal-actions .add-main { flex: 1; }

[hidden] { display: none !important; }
