/* =====================================================
   Mindful Commitments - Main Stylesheet
   Minimalist Design with Emotional Wealth
   ===================================================== */

/* CSS Custom Properties - Muted, Sophisticated Palette */
:root {
  /* Colors - Carefully curated muted palette */
  --color-paper: #F8F6F3;          /* Warm off-white, like premium paper */
  --color-ink: #2C2925;            /* Rich dark brown, not harsh black */
  --color-charcoal: #6B6760;       /* Muted gray for secondary text */
  --color-sage: #8B9A8C;           /* Muted sage green for accents */
  --color-dust: #E8E5E0;           /* Subtle divider color */
  --color-whisper: #F2F0ED;        /* Lightest background variant */
  
  /* Interactive States */
  --color-focus: #A8B5A9;          /* Slightly deeper sage for focus */
  --color-success: #7A8B7C;        /* Muted success green */
  --color-warning: #B8A082;        /* Warm muted orange */
  
  /* Typography Scale - Modular scale based on golden ratio */
  --font-serif: 'Crimson Text', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  
  /* Spacing System - Consistent rhythm */
  --space-1: 0.25rem;     /* 4px */
  --space-2: 0.5rem;      /* 8px */
  --space-3: 0.75rem;     /* 12px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-8: 2rem;        /* 32px */
  --space-10: 2.5rem;     /* 40px */
  --space-12: 3rem;       /* 48px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */
  
  /* Layout & Animation */
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --shadow-subtle: 0 1px 3px rgba(44, 41, 37, 0.08);
  --shadow-soft: 0 4px 12px rgba(44, 41, 37, 0.1);
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-gentle: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   Global Reset & Base Styles
   ===================================================== */

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

*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-ink);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* High-quality typography with perfect spacing */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  color: var(--color-charcoal);
}

/* =====================================================
   Utility Classes
   ===================================================== */

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================================
   Loading Screen - Elegant entrance
   ===================================================== */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  color: var(--color-ink);
  margin-bottom: var(--space-6);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-dust);
  border-top: 2px solid var(--color-sage);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* =====================================================
   Authentication Views - Welcoming & Refined
   ===================================================== */

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background-color: var(--color-paper);
}

.auth-container {
  width: 100%;
  max-width: 400px;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  font-weight: 400;
  color: var(--color-ink);
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: var(--text-lg);
  color: var(--color-charcoal);
  font-weight: 300;
  letter-spacing: 0.01em;
  margin-bottom: 0;
}

.auth-form {
  background: white;
  padding: var(--space-10);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-dust);
}

/* =====================================================
   Form Components - Clean & Functional
   ===================================================== */

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-ink);
  background-color: var(--color-whisper);
  border: 1px solid var(--color-dust);
  border-radius: var(--border-radius);
  transition: var(--transition-smooth);
  outline: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--color-sage);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(139, 154, 140, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* =====================================================
   Button Components - Deliberate & Refined
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-sans);
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-smooth);
  letter-spacing: 0.01em;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  box-shadow: 0 0 0 3px rgba(139, 154, 140, 0.2);
}

.btn-primary {
  background-color: var(--color-sage);
  color: white;
  margin-bottom: var(--space-4);
  width: 100%;
}

.btn-primary:hover {
  background-color: var(--color-focus);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background-color: white;
  color: var(--color-sage);
  border: 1px solid var(--color-sage);
}

.btn-secondary:hover {
  background-color: var(--color-sage);
  color: white;
  transform: translateY(-1px);
}

.btn-text {
  background: none;
  color: var(--color-charcoal);
  padding: var(--space-3) 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: transparent;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-text:hover {
  color: var(--color-sage);
  text-decoration-color: var(--color-sage);
}

/* =====================================================
   Main Application Layout
   ===================================================== */

.app-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-paper);
}

.main-nav {
  background: white;
  border-bottom: 1px solid var(--color-dust);
  padding: var(--space-6) var(--space-6) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-subtle);
}

.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.nav-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-ink);
  margin-bottom: 0;
}

.user-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-sage);
  color: white;
  border: none;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}

.user-menu-btn:hover {
  background-color: var(--color-focus);
  transform: scale(1.05);
}

/* Checklist Navigation */
.checklist-nav {
  display: flex;
  gap: var(--space-2);
  margin-bottom: -1px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.checklist-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-charcoal);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  letter-spacing: 0.01em;
}

.nav-btn:hover {
  color: var(--color-ink);
  background-color: var(--color-whisper);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.nav-btn.active {
  color: var(--color-sage);
  border-bottom-color: var(--color-sage);
  background-color: var(--color-whisper);
}

/* User Menu Dropdown */
.user-menu {
  position: absolute;
  top: 100%;
  right: var(--space-6);
  background: white;
  border: 1px solid var(--color-dust);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-soft);
  min-width: 160px;
  z-index: 200;
  animation: fadeInDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item {
  display: block;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-ink);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.menu-item:hover {
  background-color: var(--color-whisper);
  color: var(--color-sage);
}

.menu-item:first-child {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.menu-item:last-child {
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Content Area - Generous Whitespace
   ===================================================== */

.content-area {
  flex: 1;
  padding: var(--space-8) var(--space-6);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.checklist-view {
  display: none;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.checklist-view.active {
  display: block;
}

.view-header {
  text-align: center;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-dust);
}

.view-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--color-ink);
  margin-bottom: var(--space-3);
}

.view-subtitle {
  font-size: var(--text-lg);
  color: var(--color-charcoal);
  font-weight: 300;
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.progress-overview {
  margin-bottom: var(--space-12);
}

.progress-card {
  background: white;
  padding: var(--space-8);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-dust);
  text-align: center;
  box-shadow: var(--shadow-subtle);
}

.progress-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-charcoal);
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--color-dust);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.progress-fill {
  height: 100%;
  background-color: var(--color-sage);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.progress-text {
  font-size: var(--text-sm);
  color: var(--color-charcoal);
  font-weight: 500;
}

/* =====================================================
   Checklist Container - Clean Structure
   ===================================================== */

.checklist-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.checklist-item {
  background: white;
  border: 1px solid var(--color-dust);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  transition: var(--transition-gentle);
  position: relative;
  overflow: hidden;
}

.checklist-item:hover {
  border-color: var(--color-sage);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.item-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.item-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-dust);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
}

.item-checkbox:hover {
  border-color: var(--color-sage);
}

.item-checkbox.checked {
  background-color: var(--color-sage);
  border-color: var(--color-sage);
}

.item-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.item-content {
  flex: 1;
}

.item-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.item-description {
  font-size: var(--text-sm);
  color: var(--color-charcoal);
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

.item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-charcoal);
}

.item-actions {
  display: flex;
  gap: var(--space-2);
  opacity: 0;
  transition: var(--transition-smooth);
}

.checklist-item:hover .item-actions {
  opacity: 1;
}

.action-btn {
  padding: var(--space-2);
  background: none;
  border: none;
  color: var(--color-charcoal);
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: var(--transition-smooth);
}

.action-btn:hover {
  background-color: var(--color-whisper);
  color: var(--color-sage);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-charcoal);
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  color: var(--color-ink);
}

.empty-state p {
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}