@import "auth.css";

:root {
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --primary: #6366F1;
  --eat: #10B981;
  --fast: #F59E0B;
  --water: #0284C7;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  --danger: #EF4444;
  --bio-bg: rgba(0, 0, 0, 0.05);
  --hero-eat-bg: #F0FDF4;
  --hero-fast-bg: #FFFBEB;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --card-bg: #1E293B;
  --primary: #818CF8;
  --eat: #34D399;
  --fast: #FBBF24;
  --water: #38BDF8;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #334155;
  --bio-bg: #1e1b4b;
  --hero-eat-bg: #064e3b;
  --hero-fast-bg: #451a03;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  margin: 0;
  padding: 80px 40px 40px;
  /* Top padding for fixed navbar */
  transition: 0.3s;
  overflow-x: hidden;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.navbar {
  padding: 0 40px;
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  backdrop-filter: blur(16px);
  box-sizing: border-box;
}

.brand-title {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-main);
  letter-spacing: 1.5px;
  text-decoration: none;
}

.settings-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-banner {
  padding: 15px 20px;
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 80px 20px 20px;
  }

  .navbar {
    padding: 0 20px;
    height: 64px;
  }

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

  .hide-mobile {
    display: none !important;
  }
}

.hide-mobile {
  display: inline-flex;
}

.main-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 30px;
}

@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.card {
  background: var(--card-bg);
  border-radius: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.4s ease;
  position: relative;
  min-height: 200px;
}

.module-padding {
  padding: 35px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .module-padding {
    padding: 25px;
  }

  .main-grid {
    gap: 20px;
  }
}

.module-header {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-main-stat {
  font-size: 3.5rem;
  font-weight: 800;
  margin: 15px 0 0;
  letter-spacing: -2px;
  line-height: 1;
}

.hero-eat {
  background-color: var(--hero-eat-bg) !important;
  border-top: 8px solid var(--eat);
}

.hero-fast {
  background-color: var(--hero-fast-bg) !important;
  border-top: 8px solid var(--fast);
}

.bar-container {
  height: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  margin: 20px 0;
  overflow: hidden;
  display: flex;
  gap: 1px;
}

.segment {
  flex: 1;
  height: 100%;
  transition: 0.3s;
}

.segment-filled {
  background: var(--accent);
}

.segment-empty {
  background: #CBD5E1;
  opacity: 0.2;
}

.segment-active-highlight {
  background: var(--accent);
  filter: brightness(1.3);
  opacity: 1;
}

.bio-box {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 18px;
  background: var(--bio-bg);
  border-radius: 20px;
  border-left: 6px solid var(--primary);
  margin-top: 15px;
  color: var(--text-main);
  line-height: 1.5;
}

.bio-title {
  display: block;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stats-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg);
  padding: 15px 10px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80px;
}

.stat-value {
  font-weight: 800;
  font-size: 1.1rem;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 800;
  margin-top: 6px;
}

.btn-utility {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.2s;
  text-transform: uppercase;
}

.btn-utility:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.2s;
}

.btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.theme-icon-sun,
.theme-icon-moon,
.icon-card,
.card-icon {
  width: 20px;
  height: 20px;
}


.btn-cta-mini {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0;
}

.btn-cta-mini .card-icon {
  width: 14px;
  height: 14px;
}

.btn-cta-mini:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-cta-mini:active {
  transform: translateY(0);
}

.btn-card-action {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
}

.btn-card-action:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

.hidden {
  display: none !important;
}

[data-collapsible-active-value="true"] .chevron-icon {
  transform: rotate(180deg);
}

.chevron-icon {
  transition: transform 0.3s ease;
}

[data-theme="dark"] .btn-card-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Handle Rails button_to wrappers inside card actions */
.btn-card-action form {
  display: flex;
  margin: 0;
  width: 100%;
  height: 100%;
}

.btn-card-action button {
  background: none !important;
  border: none !important;
  color: inherit !important;
  cursor: pointer;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html:not([data-theme="dark"]) .theme-icon-sun {
  display: none;
}

html:not([data-theme="dark"]) .theme-icon-moon {
  display: block;
}

.prog-btn {
  border: none;
  padding: 18px;
  border-radius: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
  color: white;
  font-size: 1rem;
  margin-top: auto;
}

.prog-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-container {
  background: var(--card-bg);
  padding: 35px;
  border-radius: 40px;
  width: fit-content;
  min-width: min(400px, 90vw);
  max-width: min(1200px, 95vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.history-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding: 5px;
}

.history-col {
  background: var(--bg);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
}

.history-col h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.modal-field {
  width: 100%;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-main);
  font-weight: 600;
  box-sizing: border-box;
  font-family: inherit;
}

.modal-field-group {
  margin-bottom: 5px;
}

.modal-field-group .stat-label {
  text-align: left;
  margin-bottom: 5px;
  display: block;
}

.edit-btn-pill {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  margin-top: 8px;
  display: inline-block;
}

.tag {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  color: white;
  text-transform: uppercase;
  float: right;
}

.forecast-row {
  padding: 15px;
  border-radius: 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 5px solid transparent;
}

.forecast-eat {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: var(--eat);
}

.forecast-fast {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--fast);
}