/* ============================================================
   Cat Care Dashboard — Design System
   Dark glassmorphism with warm amber/violet cat-themed palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-deep: #020617;
  --bg-surface: rgba(15, 23, 42, 0.7);
  --bg-card: rgba(30, 41, 59, 0.55);
  --bg-card-hover: rgba(30, 41, 59, 0.75);
  --bg-input: rgba(15, 23, 42, 0.6);

  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-amber-glow: rgba(245, 158, 11, 0.35);
  --accent-violet: #a78bfa;
  --accent-violet-dim: rgba(167, 139, 250, 0.15);
  --accent-rose: #fb7185;
  --accent-emerald: #34d399;
  --accent-sky: #38bdf8;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(148, 163, 184, 0.1);
  --border-focus: rgba(245, 158, 11, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.12);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.45);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms 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; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 10%, rgba(245, 158, 11, 0.06), transparent),
    radial-gradient(ellipse 600px 500px at 80% 80%, rgba(167, 139, 250, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

/* --- Layout --- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 24px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.app-logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app-logo .subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: -2px;
}

/* --- Tab Navigation --- */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(167, 139, 250, 0.15));
  color: var(--accent-amber);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

.tab-btn .icon {
  font-size: 1rem;
}

/* --- Tab Content --- */
.tab-content {
  display: none;
  animation: fadeSlideUp 0.35s ease;
}

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

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

/* --- Glass Cards --- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-card);
}

.glass-card:hover {
  border-color: rgba(245, 158, 11, 0.15);
  box-shadow: var(--shadow-card-hover);
}

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

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1rem;
}

/* --- Stat Cards Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card.amber::before { background: linear-gradient(90deg, var(--accent-amber), transparent); }
.stat-card.violet::before { background: linear-gradient(90deg, var(--accent-violet), transparent); }
.stat-card.rose::before { background: linear-gradient(90deg, var(--accent-rose), transparent); }
.stat-card.emerald::before { background: linear-gradient(90deg, var(--accent-emerald), transparent); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card.amber .stat-value { color: var(--accent-amber); }
.stat-card.violet .stat-value { color: var(--accent-violet); }
.stat-card.rose .stat-value { color: var(--accent-rose); }
.stat-card.emerald .stat-value { color: var(--accent-emerald); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 500;
}

/* --- Activity Buttons --- */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.activity-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.activity-btn .emoji {
  font-size: 1.6rem;
  transition: transform var(--transition-spring);
}

.activity-btn:hover {
  border-color: var(--accent-amber-glow);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.activity-btn:hover .emoji {
  transform: scale(1.2);
}

.activity-btn:active {
  transform: scale(0.96);
}

/* Paw ripple animation */
.activity-btn .paw-ripple {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-amber-dim);
  animation: pawRipple 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes pawRipple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

/* --- Expense Form --- */
.expense-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.expense-form .full-width {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.form-input, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

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

.form-select option {
  background: #1e293b;
  color: var(--text-primary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-amber), #d97706);
  color: #000;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* --- Activity Log --- */
.activity-log {
  margin-top: 12px;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

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

.log-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}

.log-entry .emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.log-entry .text {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.log-entry .time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.log-entry .delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
  opacity: 0;
}

.log-entry:hover .delete-btn {
  opacity: 1;
}

.log-entry .delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* --- Expense List --- */
.expense-list {
  margin-top: 8px;
}

.expense-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.expense-entry:last-child {
  border-bottom: none;
}

.expense-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}

.expense-category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.expense-category-dot.dry-food { background: var(--accent-amber); }
.expense-category-dot.wet-food { background: var(--accent-violet); }
.expense-category-dot.cat-litter { background: var(--accent-emerald); }
.expense-category-dot.misc { background: var(--accent-sky); }

.expense-entry .details {
  flex: 1;
}

.expense-entry .category-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.expense-entry .note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.expense-entry .amount {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-amber);
  white-space: nowrap;
}

.expense-entry .date {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.expense-entry .delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
  opacity: 0;
}

.expense-entry:hover .delete-btn {
  opacity: 1;
}

.expense-entry .delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* --- Category Breakdown Bar --- */
.breakdown-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  margin: 12px 0;
}

.breakdown-segment {
  transition: width var(--transition-base);
  min-width: 2px;
}

.breakdown-segment.dry-food { background: var(--accent-amber); }
.breakdown-segment.wet-food { background: var(--accent-violet); }
.breakdown-segment.cat-litter { background: var(--accent-emerald); }
.breakdown-segment.misc { background: var(--accent-sky); }

.breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

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

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

.legend-dot.dry-food { background: var(--accent-amber); }
.legend-dot.wet-food { background: var(--accent-violet); }
.legend-dot.cat-litter { background: var(--accent-emerald); }
.legend-dot.misc { background: var(--accent-sky); }

.legend-amount {
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Calendar --- */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-month {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.calendar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 12px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  padding: 8px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  gap: 3px;
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.calendar-day.today {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  font-weight: 700;
  border: 1px solid var(--accent-amber-glow);
}

.calendar-day.selected {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(167, 139, 250, 0.2));
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--accent-amber-glow);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.3;
}

.calendar-day.has-activity {
  color: var(--text-primary);
}

.day-emojis {
  display: flex;
  gap: 1px;
  position: absolute;
  bottom: 3px;
  font-size: 0.55rem;
  line-height: 1;
  pointer-events: none;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  overflow: hidden;
}

/* --- Day Detail Panel --- */
.day-detail {
  display: none;
  animation: fadeSlideUp 0.3s ease;
}

.day-detail.active {
  display: block;
}

.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.day-detail-date {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-amber);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state .emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: block;
}

.empty-state .text {
  font-size: 0.82rem;
}

/* --- Section Divider --- */
.section-gap {
  margin-top: 16px;
}

/* --- Summary row --- */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.82rem;
}

.summary-row .label {
  color: var(--text-secondary);
}

.summary-row .value {
  font-weight: 700;
  color: var(--accent-amber);
}

/* --- Month selector --- */
.month-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-filter select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
}

/* --- Toast/notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent-amber-glow);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 0.82rem;
  color: var(--text-primary);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.25);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .expense-form {
    grid-template-columns: 1fr;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .app-shell {
    padding: 12px 12px 100px;
  }
}

/* --- 7-day summary bar mini chart --- */
.week-summary {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 48px;
  margin-top: 12px;
}

.week-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--accent-amber-dim);
  position: relative;
  transition: height var(--transition-base);
  min-height: 4px;
}

.week-bar.has-activity {
  background: linear-gradient(to top, var(--accent-amber), var(--accent-violet));
}

.week-bar-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.week-labels {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.week-labels span {
  flex: 1;
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-muted);
}
