/* ============================================
   MIAU — Imunoterapie
   Mobile-first, warm cat theme
   ============================================ */

:root {
  --pink:       #4A9B8E;
  --pink-dark:  #357A6E;
  --pink-light: #DFF2EF;
  --purple:     #4A7FB5;
  --blue:       #5BA0C8;
  --blue-light: #D5E8F5;
  --bg:         #F0F8F6;
  --card:       #FFFFFF;
  --text:       #1E3230;
  --text-light: #6A8C88;
  --success:    #5BAA7A;
  --warning:    #E0A840;
  --danger:     #D06060;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --nav-height: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============ LOADING ============ */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
}
.loading .paw-icon { font-size: 48px; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

/* ============ HEADER ============ */
.app-header {
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(74,155,142,0.35);
}
.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.treatment-selector {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  max-width: 140px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.treatment-selector option { color: var(--text); background: white; }

/* ============ SCROLL AREA ============ */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px);
  -webkit-overflow-scrolling: touch;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  height: var(--nav-height);
  background: white;
  border-top: 1px solid #F0E0EA;
  display: flex;
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color 0.2s;
}
.nav-btn .nav-icon { font-size: 22px; }
.nav-btn.active { color: var(--pink-dark); }
.nav-btn.active .nav-icon { transform: scale(1.1); }

/* ============ CARDS ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.card-pink  { border-left: 4px solid var(--pink); }
.card-blue  { border-left: 4px solid var(--blue); }
.card-green { border-left: 4px solid var(--success); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--pink); color: white; }
.btn-secondary { background: var(--purple); color: white; }
.btn-blue      { background: var(--blue); color: white; }
.btn-success   { background: var(--success); color: white; }
.btn-outline   { background: transparent; border: 2px solid var(--pink); color: var(--pink-dark); }
.btn-danger    { background: var(--danger); color: white; }
.btn-small     { padding: 8px 14px; font-size: 13px; width: auto; }
.btn:disabled  { opacity: 0.4; pointer-events: none; }

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn-row .btn { flex: 1; }

/* ============ TIMER ============ */
.timer-display {
  text-align: center;
  padding: 20px;
}
.timer-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--pink-light);
  border: 6px solid var(--pink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.timer-circle.running { border-color: var(--pink-dark); animation: timer-pulse 2s infinite; }
.timer-circle.done    { background: #E8F8EE; border-color: var(--success); }
@keyframes timer-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(74,155,142,0.4)} 50%{box-shadow:0 0 0 12px rgba(74,155,142,0)} }

.timer-time {
  font-size: 32px;
  font-weight: 700;
  color: var(--pink-dark);
  font-variant-numeric: tabular-nums;
}
.timer-time.done { color: var(--success); }
.timer-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.timer-desc {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ============ PROTOCOL STEP ============ */
.protocol-today {
  text-align: center;
  padding: 8px 0 4px;
}
.protocol-day {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}
.protocol-dose {
  font-size: 28px;
  font-weight: 700;
  color: var(--pink-dark);
}
.protocol-dose span {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-light);
}
.protocol-phase {
  display: inline-block;
  background: var(--pink-light);
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 6px;
}
.protocol-phase.mentinere { background: var(--blue-light); color: var(--blue); }

/* ============ TREATMENT STEPS ============ */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pink-light);
  color: var(--pink-dark);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-number.done    { background: var(--success); color: white; }
.step-number.active  { background: var(--pink); color: white; }
.step-number.waiting { background: #EEE; color: #AAA; }
.step-info { flex: 1; }
.step-title { font-weight: 600; font-size: 14px; }
.step-sub   { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.step-action { flex-shrink: 0; }

/* ============ STOCKS ============ */
.stock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stock-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.stock-icon  { font-size: 24px; margin-bottom: 4px; }
.stock-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stock-label { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.stock-alert { color: var(--danger) !important; }
.stock-warn  { color: var(--warning) !important; }

/* ============ SYMPTOMS ============ */
.symptom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.symptom-chip {
  padding: 10px 8px;
  border: 2px solid #E8E0F0;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  background: white;
}
.symptom-chip.selected {
  border-color: var(--pink);
  background: var(--pink-light);
  color: var(--pink-dark);
}
.severity-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.sev-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid #EEE;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
}
.sev-btn.usor.sel   { border-color: #6DBF8E; background: #E8F8EE; color: #3A8A5A; }
.sev-btn.mediu.sel  { border-color: #F0C060; background: #FFF8E0; color: #A07020; }
.sev-btn.sever.sel  { border-color: #E07070; background: #FEE8E8; color: #A03030; }

/* ============ HISTORY ============ */
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.history-date { font-size: 12px; color: var(--text-light); width: 60px; flex-shrink: 0; text-align: center; }
.history-icon { font-size: 20px; flex-shrink: 0; }
.history-info { flex: 1; }
.history-title { font-weight: 600; font-size: 14px; }
.history-sub   { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 16px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #E8E0F0;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: white;
  appearance: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pink);
}
.hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 5px;
  line-height: 1.4;
}
.hint.important { color: var(--pink-dark); font-weight: 500; }

/* ============ PROTOCOL EDITOR ============ */
.protocol-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.protocol-row input { width: 60px; text-align: center; padding: 8px 4px; }
.protocol-row .sep { color: var(--text-light); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.protocol-row .del-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--danger);
  padding: 4px;
  flex-shrink: 0;
}

/* ============ ONBOARDING ============ */
.onboarding {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.onboarding-header {
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  padding: 20px 16px 16px;
  color: white;
  flex-shrink: 0;
}
.onboarding-header h2 { font-size: 20px; margin-bottom: 4px; }
.onboarding-header .step-indicator { font-size: 13px; opacity: 0.8; }
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.onboarding-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}
.onboarding-footer {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #F0E0EA;
  flex-shrink: 0;
}
.welcome-paw {
  text-align: center;
  padding: 30px 0;
}
.welcome-paw .big-paw { font-size: 72px; display: block; margin-bottom: 16px; }
.welcome-paw h2 { font-size: 26px; font-weight: 700; color: var(--pink-dark); margin-bottom: 8px; }

/* max-width for desktop */
#app { max-width: 480px; margin: 0 auto; position: relative; }
body { background: #E8F2F0; }
.welcome-paw p  { font-size: 15px; color: var(--text-light); line-height: 1.6; max-width: 280px; margin: 0 auto; }

/* ============ TOGGLE ============ */
.toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.toggle-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #E8E0F0;
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.15s;
}
.toggle-btn.selected {
  border-color: var(--pink);
  background: var(--pink-light);
  color: var(--pink-dark);
}
.toggle-btn.selected.blue {
  border-color: var(--blue);
  background: var(--blue-light);
  color: #3A7A9A;
}

/* ============ LINKS SECTION ============ */
.links-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.link-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.link-btn:active { background: var(--pink-light); }
.link-icon { font-size: 22px; flex-shrink: 0; }
.link-arrow { margin-left: auto; color: var(--text-light); }

/* ============ MODAL / OVERLAY ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}
.modal {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.close-btn {
  background: #F0F0F0;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ SETTINGS ============ */
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #F5EDF8;
  cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-left { display: flex; align-items: center; gap: 12px; }
.settings-icon { font-size: 20px; }
.settings-label { font-size: 15px; font-weight: 500; }
.settings-sub   { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.settings-arrow { color: var(--text-light); font-size: 18px; }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ============ BADGE ============ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pink  { background: var(--pink-light); color: var(--pink-dark); }
.badge-blue  { background: var(--blue-light); color: #3A7A9A; }
.badge-green { background: #E8F8EE; color: #3A8A5A; }
.badge-red   { background: #FEE8E8; color: #A03030; }

/* ============ NOTIFICATIONS ============ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #2D2D2D;
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  white-space: nowrap;
}
@keyframes toast-in  { from{opacity:0;transform:translateX(-50%) translateY(-10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
@keyframes toast-out { from{opacity:1} to{opacity:0} }

/* ============ DIVIDER ============ */
.divider { height: 1px; background: #F5EDF8; margin: 12px 0; }

/* ============ SAFE AREA ============ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  .scroll-area { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px); }
}
