/* ==========================================================================
   MigrañaZero - OLED Dark Mode Design System
   Optimized for high contrast, zero glare, and photophobia comfort.
   ========================================================================== */

:root {
  --bg-oled: #0b1512;
  --bg-card: #17221e;
  --bg-card-hover: #212c28;
  --bg-surface: #2c3733;
  --border-subtle: #404943;
  --border-glow: rgba(147, 212, 178, 0.35);
  
  --primary-glow: #93d4b2;
  --primary-accent: #6faf8f;
  --primary-soft: #b3ccc2;
  --accent-amber: #b3ccc2;
  --accent-cyan: #97d2c8;
  --accent-rose: #ffb4ab;
  
  --text-main: #d9e5df;
  --text-muted: #bfc9c1;
  --text-dim: #89938c;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-oled);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.5;
}

.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: relative;
}

/* Header & Status Bar */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 12px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 12px var(--border-glow);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #d9e5df, #93d4b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover, .btn-icon:active {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--primary-glow);
}

.btn-lang-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--primary-glow);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 12px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-lang-toggle:hover, .btn-lang-toggle:active {
  background: var(--bg-surface);
  border-color: var(--primary-glow);
  box-shadow: 0 0 10px rgba(147, 212, 178, 0.25);
}

/* Banner Alert */
.alert-banner {
  background: linear-gradient(135deg, #131e1a, #212c28);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(147, 212, 178, 0.15);
  animation: slideDown 0.3s ease-out;
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-icon {
  font-size: 1.4rem;
}

.alert-text h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d9e5df;
}

.alert-text p {
  font-size: 0.8rem;
  color: #bfc9c1;
}

.btn-alert-action {
  background: var(--primary-accent);
  color: #003825;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

/* Section Main Panic Zone - Compact for 1-screen no scroll */
.panic-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0 16px;
  text-align: center;
}

.panic-button-wrapper {
  position: relative;
  width: 175px;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pulsing ambient concentric rings matching user image */
.panic-button-wrapper::before,
.panic-button-wrapper::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: rgba(88, 162, 130, 0.12);
  box-shadow: 0 0 0 14px rgba(88, 162, 130, 0.08);
  animation: pulseAmbient 3s infinite ease-in-out;
}

.panic-button-wrapper::after {
  inset: -20px;
  animation-delay: 1.5s;
}

.btn-panic {
  position: relative;
  z-index: 2;
  width: 155px;
  height: 155px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6bb393, #52987a);
  border: 4px solid #84c7a8;
  box-shadow: 
    0 0 30px rgba(88, 162, 130, 0.45),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -4px 8px rgba(0, 0, 0, 0.2);
  color: #071c14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
  padding: 10px;
  text-align: center;
}

.btn-panic:active {
  transform: scale(0.92);
  box-shadow: 0 0 20px rgba(132, 199, 168, 0.9);
  background: linear-gradient(145deg, #46876c, #39725a);
}

.panic-icon-container {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #071c14;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.panic-label {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.15;
  color: #071c14;
}

.panic-sublabel {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(7, 28, 20, 0.85);
  margin-top: 2px;
}

.panic-status-hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6faf8f;
  box-shadow: 0 0 8px #6faf8f;
}

.status-dot.offline {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  gap: 2px;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  white-space: nowrap;
  min-width: max-content;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: #d9e5df;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
}

/* Weather Widget Compact */
#currentWeatherCard {
  padding: 12px 14px;
  margin-bottom: 0;
}

#currentWeatherCard .card-title {
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.weather-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.weather-metric-box {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
}

.weather-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.weather-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #d9e5df;
  margin-top: 2px;
}

.weather-sub {
  font-size: 0.68rem;
  color: var(--accent-cyan);
}

/* Calendar View Styles */
.calendar-card {
  padding: 16px 12px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-month-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: capitalize;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: 100%;
}

.calendar-day-cell {
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
  background: var(--bg-surface);
  border: 1px solid transparent;
  color: var(--text-muted);
  user-select: none;
  padding: 0;
}

.calendar-day-cell.empty {
  background: transparent;
  border: none;
  cursor: default;
}

/* Clean day (Día Limpio) - Sage Green Solid Fill */
.calendar-day-cell.day-clean {
  background: rgba(111, 175, 143, 0.25);
  border-color: rgba(111, 175, 143, 0.6);
  color: #93d4b2;
}

.calendar-day-cell.day-clean:hover {
  background: rgba(111, 175, 143, 0.4);
  border-color: #6faf8f;
}

/* Migraine day (Con crisis) - Rose/Red Solid Fill */
.calendar-day-cell.day-migraine {
  background: rgba(255, 180, 171, 0.35);
  border-color: rgba(255, 180, 171, 0.7);
  color: #ffffff;
}

.calendar-day-cell.day-migraine:hover {
  background: rgba(255, 180, 171, 0.5);
  border-color: #ff8577;
}

/* Selected calendar day highlight */
.calendar-day-cell.day-selected {
  outline: 2px solid var(--primary-glow);
  outline-offset: -1px;
}

/* Today indicator ring */
.calendar-day-cell.day-today {
  box-shadow: 0 0 0 2px var(--primary-glow);
  font-weight: 800;
}

/* Future day */
.calendar-day-cell.day-future {
  opacity: 0.25;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
}

.calendar-day-badge {
  font-size: 0.6rem;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

.day-clean .calendar-day-badge {
  background: rgba(111, 175, 143, 0.25);
  color: #93d4b2;
}

.day-migraine .calendar-day-badge {
  background: rgba(255, 180, 171, 0.35);
  color: #ffffff;
  font-weight: 700;
}

/* Legend */
.calendar-legend {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-clean {
  background-color: #6faf8f;
  box-shadow: 0 0 6px rgba(111, 175, 143, 0.6);
}

.dot-migraine {
  background-color: #ffb4ab;
  box-shadow: 0 0 6px rgba(255, 180, 171, 0.6);
}

.dot-today {
  border: 2px solid var(--primary-glow);
  background-color: transparent;
}

/* Tab Views */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

/* Cards & Widgets */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Weather Barometer Widget */
.weather-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.weather-metric-box {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
}

.weather-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.weather-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #d9e5df;
  margin-top: 4px;
}

.weather-sub {
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

/* History Feed */
.crisis-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crisis-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-fast);
  position: relative;
}

.crisis-item:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
}

.crisis-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crisis-date {
  font-size: 0.95rem;
  font-weight: 600;
  color: #d9e5df;
}

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

.crisis-details-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.tag-intensity {
  background: rgba(158, 107, 107, 0.2);
  color: #ffb4ab;
  border-color: rgba(158, 107, 107, 0.4);
  font-weight: 700;
}

.tag-weather {
  background: rgba(151, 210, 200, 0.15);
  color: #97d2c8;
  border-color: rgba(151, 210, 200, 0.3);
}

.btn-item-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--primary-soft);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  margin-top: 4px;
}

.btn-item-action:hover {
  background: var(--primary-glow);
  color: #003825;
}

/* Modal Drawer for Editing Crisis Details */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 16, 13, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-container {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: #0b1512;
  border-top: 1px solid var(--primary-glow);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(147, 212, 178, 0.2);
}

.drawer-overlay.open .drawer-container {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #d9e5df;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.slider-intensity-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.intensity-slider {
  flex: 1;
  accent-color: var(--accent-rose);
  height: 6px;
  border-radius: 4px;
}

.intensity-badge {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-rose);
  min-width: 40px;
  text-align: center;
}

.symptoms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.checkbox-chip input {
  accent-color: var(--primary-accent);
}

.checkbox-chip:has(input:checked) {
  background: rgba(147, 212, 178, 0.15);
  border-color: var(--primary-accent);
  color: #d9e5df;
}

.form-input, .form-textarea, select.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #d9e5df;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
}

select.form-input option {
  background: #131e1a;
  color: #d9e5df;
}

.form-input:focus, .form-textarea:focus, select.form-input:focus {
  outline: none;
  border-color: var(--primary-accent);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-glow), var(--primary-accent));
  color: #003825;
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(147, 212, 178, 0.25);
  transition: var(--transition-fast);
  margin-top: 10px;
}

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

/* Animations */
@keyframes pulseAmbient {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
