/* ============================================================
   DOPPEL-DENKER – Shared Design System
   Liquid Glass • Dark Green • Mobile-first
   ============================================================ */

/* ── Icon Font ── */
@import url('https://cdn.jsdelivr.net/npm/remixicon@4.5.0/fonts/remixicon.css');
/* ── Google Font ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  /* Colors */
  --green-900: #1B4332;
  --green-800: #2D6A4F;
  --green-700: #40916C;
  --green-600: #52B788;
  --green-400: #74C69D;
  --green-200: #B7E4C7;
  --green-100: #D8F3DC;
  --green-50: #F0FAF3;

  --accent: #52B788;
  --accent-light: #74C69D;
  --accent-dark: #2D6A4F;

  --bg: #F0FAF3;
  --bg-card: rgba(255, 255, 255, 0.58);
  --bg-glass: rgba(255, 255, 255, 0.42);
  --bg-glass-strong: rgba(255, 255, 255, 0.72);

  --text-primary: #1B3626;
  --text-secondary: #3D6B53;
  --text-muted: #7DA98A;
  --text-white: #FFFFFF;

  --border: rgba(45, 106, 79, 0.15);
  --border-glass: rgba(255, 255, 255, 0.6);

  --shadow-sm: 0 2px 8px rgba(27, 67, 50, 0.08);
  --shadow-md: 0 8px 24px rgba(27, 67, 50, 0.12);
  --shadow-lg: 0 20px 48px rgba(27, 67, 50, 0.16);
  --shadow-glass: 0 8px 32px rgba(27, 67, 50, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-btn: 0 4px 16px rgba(45, 106, 79, 0.35);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Spacing */
  --nav-height: 80px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Transitions */
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background gradient blobs */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(116, 198, 157, 0.25) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: 10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(82, 183, 136, 0.2) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--green-200);
  border-radius: 2px;
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.glass-card-sm {
  background: var(--bg-glass);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.glass-card-strong {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-800));
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--green-800), var(--green-900));
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.45);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 4px 16px rgba(82, 183, 136, 0.4);
}

.btn-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.65);
}

.btn-danger {
  background: linear-gradient(135deg, #e55353, #c0392b);
  color: #fff;
  box-shadow: 0 4px 16px rgba(192, 57, 43, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, #27ae60, #219653);
  color: #fff;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.35);
}

.btn-lg {
  padding: 18px 32px;
  font-size: 1.1rem;
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Input ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.input-field {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.18), var(--shadow-sm);
  background: rgba(255, 255, 255, 0.85);
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: rgba(240, 250, 243, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(27, 67, 50, 0.08);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  transition: all var(--transition);
  flex: 1;
  max-width: 80px;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  transform: scale(0.93);
}

.nav-item .nav-icon {
  font-size: 1.5rem;
  transition: all var(--transition);
  line-height: 1;
}

.nav-item .nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-item.active {
  color: var(--green-800);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

/* Active indicator pill */
.nav-item.active::before {
  /* done in each page's CSS for precise control */
  display: none;
}

/* ── Page Header ── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 54px 20px 16px;
  background: rgba(240, 250, 243, 0.80);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* ── Page Content (padding for nav) ── */
.page-content {
  padding: 20px 16px calc(var(--nav-height) + var(--safe-bottom) + 16px);
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

/* ── Typography ── */
h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

p {
  line-height: 1.6;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-green {
  background: var(--green-100);
  color: var(--green-800);
}

.badge-accent {
  background: rgba(82, 183, 136, 0.15);
  color: var(--accent-dark);
}

.badge-muted {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

.badge-warn {
  background: rgba(255, 180, 0, 0.12);
  color: #946200;
}

/* ── Loader / Spinner ── */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--green-200);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 250, 243, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 40px);
  max-width: 390px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: all;
  animation: toastIn 0.3s var(--spring) forwards;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
}

.toast.success {
  border-left: 4px solid var(--green-600);
}

.toast.error {
  border-left: 4px solid #e55353;
}

.toast.info {
  border-left: 4px solid var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3.5rem;
}

.empty-state h3 {
  color: var(--text-secondary);
}

/* ── Avatar ── */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-700), var(--green-400));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

/* ── Stat Card ── */
.stat-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--green-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-700), var(--accent-light));
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Overlay / Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 54, 38, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

.overlay-sheet {
  width: 100%;
  max-width: 430px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--spring);
  background: rgba(240, 250, 243, 0.96);
  backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  max-height: 90dvh;
  overflow-y: auto;
}

.overlay.show .overlay-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  background: var(--green-200);
  border-radius: var(--radius-full);
  margin: 0 auto 20px;
}

/* ── Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.35s var(--spring) both;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  60% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.bounce-in {
  animation: bounceIn 0.4s var(--spring) both;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}

/* ── Ripple effect ── */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  width: 100%;
  padding-top: 100%;
  top: calc(var(--ripple-y, 50%) - 50%);
  left: calc(var(--ripple-x, 50%) - 50%);
  animation: ripple 0.5s ease-out;
}

@keyframes ripple {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ── Responsive (desktop fallback) ── */
@media (min-width: 431px) {

  body::before,
  body::after {
    display: none;
  }
}

/* ── Utilities ── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mb-4 {
  margin-bottom: 16px;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-bold {
  font-weight: 700;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}