/* =====================================================
   喝水记 · 水润生活
   Organic Minimalism Aesthetic
   ===================================================== */

/* CSS Variables */
:root {
  /* Colors - Organic Palette */
  --color-bg: #faf9f7;
  --color-surface: #ffffff;
  --color-primary: #0d7377;
  --color-primary-light: #14a3a8;
  --color-accent: #e07a5f;
  --color-accent-light: #f4a485;
  --color-text: #2d3a3a;
  --color-text-muted: #6b7b7b;
  --color-border: rgba(45, 58, 58, 0.1);
  --color-success: #4a9d7c;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: var(--color-primary);
  color: white;
}

/* =====================================================
   App Container
   ===================================================== */
.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Decorative Water Blobs */
.decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.water-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, var(--color-accent-light), var(--color-accent));
  bottom: 20%;
  left: -80px;
  animation-delay: -7s;
}

.blob-3 {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, #a8d5e5, var(--color-primary-light));
  top: 50%;
  right: 10%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -30px) scale(1.05);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

/* =====================================================
   Main Content
   ===================================================== */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl);
  padding-bottom: var(--space-2xl);
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* =====================================================
   Header
   ===================================================== */
.header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.app-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}

.app-tagline {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
}

/* =====================================================
   Counter Section
   ===================================================== */
.counter-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-xl);
  width: 100%;
}

/* Progress Ring */
.progress-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin-bottom: var(--space-lg);
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 8;
}

.progress-ring-progress {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 0.6s var(--ease-smooth);
}

.counter-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.counter-value {
  display: block;
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.counter-unit {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.counter-ml {
  display: block;
  font-size: 0.875rem;
  color: var(--color-primary);
  margin-top: var(--space-xs);
  font-weight: 500;
}

/* Goal Status */
.goal-status {
  min-height: 2rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-success);
  text-align: center;
  margin-bottom: var(--space-md);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.3s var(--ease-smooth);
}

.btn svg {
  width: 20px;
  height: 20px;
}

.btn-remove,
.btn-reset {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-remove:hover:not(:disabled),
.btn-reset:hover:not(:disabled) {
  color: var(--color-accent);
  transform: scale(1.05);
}

.btn-remove:disabled,
.btn-reset:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-add {
  height: 56px;
  padding: 0 var(--space-xl);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(13, 115, 119, 0.3);
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(13, 115, 119, 0.4);
}

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

/* Daily Goal Info */
.daily-goal-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.goal-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.goal-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* =====================================================
   Tabs Navigation
   ===================================================== */
.tabs-nav {
  display: flex;
  background: var(--color-surface);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: var(--space-lg);
  width: 100%;
  max-width: 320px;
}

.tab-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.tab-nav-btn svg {
  width: 18px;
  height: 18px;
}

.tab-nav-btn.active {
  background: var(--color-primary);
  color: white;
}

.tab-nav-btn:not(.active):hover {
  color: var(--color-text);
}

/* =====================================================
   Tabs Content
   ===================================================== */
.tabs-content {
  width: 100%;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s var(--ease-smooth);
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

/* =====================================================
   History Records
   ===================================================== */
.records-list {
  background: var(--color-surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.record-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.record-item:last-child {
  border-bottom: none;
}

.record-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-icon.add {
  background: rgba(13, 115, 119, 0.1);
  color: var(--color-primary);
}

.record-icon.remove {
  background: rgba(224, 122, 95, 0.1);
  color: var(--color-accent);
}

.record-icon.reset {
  background: rgba(107, 123, 123, 0.1);
  color: var(--color-text-muted);
}

.record-icon svg {
  width: 18px;
  height: 18px;
}

.record-info {
  flex: 1;
}

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

.record-action {
  font-size: 0.9375rem;
  color: var(--color-text);
}

.record-total {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9375rem;
}

/* =====================================================
   Statistics
   ===================================================== */
.chart-container {
  background: var(--color-surface);
  border-radius: 16px;
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.stat-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: var(--space-md);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* =====================================================
   Settings
   ===================================================== */
.setting-group {
  background: var(--color-surface);
  border-radius: 16px;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.setting-group label {
  display: block;
  margin-bottom: var(--space-md);
}

.setting-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.setting-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.setting-input {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.setting-input input {
  flex: 1;
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.3s var(--ease-smooth);
}

.setting-input input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.input-unit {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.btn-setting {
  width: 100%;
  padding: var(--space-md);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.btn-setting:hover {
  background: var(--color-primary-light);
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-xl);
}

.footer p {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 480px) {
  .main {
    padding: var(--space-lg);
  }

  .app-title {
    font-size: 2rem;
  }

  .progress-ring-container {
    width: 180px;
    height: 180px;
  }

  .counter-value {
    font-size: 2.75rem;
  }

  .btn-add {
    height: 52px;
    padding: 0 var(--space-lg);
    font-size: 0.9375rem;
  }

  .tabs-nav {
    max-width: 100%;
  }

  .tab-nav-btn span {
    display: none;
  }

  .stats-summary {
    grid-template-columns: 1fr;
  }
}

/* Print */
@media print {
  .decoration,
  .tabs-nav {
    display: none;
  }

  .water-blob {
    display: none;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .water-blob {
    animation: none;
  }

  .progress-ring-progress {
    transition: none;
  }
}
