/* ============================
   Baby Movement Tracker Styles
   Pink/Coral Theme - Mobile First
   ============================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #ff6b9d;
  --primary-dark: #e85a8a;
  --primary-light: #ffa0c4;
  --secondary: #6b5ce7;
  --success: #4ade80;
  --warning: #fbbf24;
  --bg-gradient: linear-gradient(135deg, #fff5f8 0%, #fce4ec 50%, #f8bbd9 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --text-primary: #2d2d2d;
  --text-secondary: #666;
  --shadow: 0 4px 20px rgba(255, 107, 157, 0.2);
  --shadow-lg: 0 8px 40px rgba(255, 107, 157, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

/* Header */
.header {
  text-align: center;
  padding: 24px 0;
}

.header-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.header h1 {
  font-size: 1.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--card-bg);
  padding: 6px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

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

/* Counter Card */
.counter-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
}

.date-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.time-display {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 107, 157, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--primary-dark);
  margin-bottom: 24px;
}

.status-badge .status-icon {
  flex-shrink: 0;
}

.status-badge.completed {
  background: rgba(74, 222, 128, 0.15);
  color: #22c55e;
}

.status-badge.completed .status-icon {
  stroke: #22c55e;
}

/* Counter Circle */
.counter-circle {
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, #fff 0%, #fce4ec 100%);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 -4px 10px rgba(255, 107, 157, 0.2),
    0 8px 24px rgba(255, 107, 157, 0.3);
  position: relative;
}

.counter-circle::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  z-index: -1;
  opacity: 0.5;
}

.counter-number {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.counter-label {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Kick Button */
.kick-button-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.kick-button {
  width: 100%;
  max-width: 280px;
  padding: 20px 40px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kick-button:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.kick-button.disabled {
  background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
  cursor: not-allowed;
  box-shadow: none;
}

.kick-button.pulse {
  animation: pulse 0.4s ease;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

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

.kick-icon {
  display: flex;
  align-items: center;
}

/* Completion Info */
.completion-info {
  margin-top: 24px;
  padding: 20px;
  background: rgba(74, 222, 128, 0.1);
  border-radius: 16px;
  animation: celebrate 0.5s ease;
}

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

  50% {
    transform: scale(1.05);
  }

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

.completion-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.completion-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #22c55e;
}

.completion-time {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Kicks Log */
.kicks-log {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.kicks-log h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.kicks-log ul {
  list-style: none;
}

.kicks-log li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.kicks-log li:last-child {
  border-bottom: none;
}

.kick-badge {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.kick-time {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Dashboard */
.dashboard-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.dashboard-card h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-card h2 svg {
  stroke: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-item {
  text-align: center;
  padding: 16px 8px;
  background: rgba(255, 107, 157, 0.08);
  border-radius: 16px;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Calendar */
.calendar-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

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

.calendar-header h3 {
  font-size: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.calendar-header h3 svg {
  stroke: var(--primary);
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
  background: var(--primary);
  color: white;
}

.calendar-nav-btn:hover svg {
  stroke: white;
}

.calendar-nav-btn svg {
  stroke: var(--text-secondary);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-day.completed {
  background: linear-gradient(135deg, var(--success) 0%, #22c55e 100%);
  color: white;
}

.calendar-day.in-progress {
  background: linear-gradient(135deg, var(--warning) 0%, #f59e0b 100%);
  color: white;
}

.calendar-day.today {
  box-shadow: 0 0 0 2px var(--primary);
}

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

.calendar-day.future {
  opacity: 0.4;
  cursor: default;
}

.calendar-day:not(.empty):not(.future):hover {
  transform: scale(1.1);
}

.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
}

.dot.completed {
  background: var(--success);
}

.dot.in-progress {
  background: var(--warning);
}

/* History */
#history-view h2 {
  margin-bottom: 16px;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

#history-view h2 svg {
  stroke: var(--primary);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item-wrapper {
  width: 100%;
}

.history-item {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.2s ease;
}

.history-item:hover {
  box-shadow: var(--shadow-lg);
}

.history-item-main {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.history-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expand-icon {
  transition: transform 0.3s ease;
  stroke: var(--text-secondary);
}

.history-item.expanded .expand-icon {
  transform: rotate(180deg);
}

.history-date {
  font-weight: 600;
  color: var(--text-primary);
}

.history-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.history-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.history-status.completed {
  background: rgba(74, 222, 128, 0.15);
  color: #22c55e;
}

.history-status.incomplete {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
}

/* History Details (Expandable) */
.history-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: rgba(0, 0, 0, 0.02);
}

.history-item.expanded .history-details {
  max-height: 500px;
  padding: 0 20px 16px;
}

.kicks-detail-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.kick-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card-bg);
  border-radius: 8px;
  font-size: 0.85rem;
}

.kick-detail-number {
  font-weight: 700;
  color: var(--primary);
}

.kick-detail-time {
  color: var(--text-secondary);
}

.loading-spinner {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.no-kicks,
.error {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-icon svg {
  stroke: var(--text-secondary);
  width: 48px;
  height: 48px;
}

/* Responsive */
@media (max-width: 380px) {
  .app {
    padding: 12px;
  }

  .counter-circle {
    width: 140px;
    height: 140px;
  }

  .counter-number {
    font-size: 3rem;
  }

  .kick-button {
    padding: 16px 32px;
    font-size: 1.25rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --card-bg: rgba(30, 30, 50, 0.9);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  }

  .counter-circle {
    background: linear-gradient(135deg, #2a2a4a 0%, #1a1a2e 100%);
  }

  .stat-item {
    background: rgba(255, 107, 157, 0.15);
  }

  .calendar-day {
    background: rgba(255, 255, 255, 0.05);
  }
}