/* UNCHAIN Calm-Inspired Design System */
/* Emotion: Hopeful, Peaceful, Trustworthy */
/* Inspiration: Calm, Headspace, Stoic minimalism */

/* ============================================
   COLOR VARIABLES - Light & Dark Mode
   ============================================ */

:root {
  /* New Calm Premium Palette - Design Tokens */
  --app-background: #D4ECDD;       /* Soft mint background */
  --app-surface: #345B63;          /* Teal-blue surface for cards/buttons */
  --app-surface-dark: #152D35;     /* Deep teal for headers/nav */
  --app-text-dark: #112031;        /* Deep navy for text */
  --app-accent: #4E7CA7;           /* Blue accent for progress/highlights */
  --app-accent-light: #5C89B5;     /* Lighter blue for hovers */
  
  /* Derived colors for light backgrounds */
  --app-surface-subtle: rgba(52, 91, 99, 0.08);    /* 8% surface for subtle backgrounds */
  --app-surface-hover: rgba(52, 91, 99, 0.12);     /* 12% surface for hover states */
  --app-accent-subtle: rgba(78, 124, 167, 0.08);   /* 8% accent for subtle highlights */
  --app-accent-hover: rgba(78, 124, 167, 0.12);    /* 12% accent for hover states */
  
  /* Border colors */
  --app-border: rgba(52, 91, 99, 0.2);             /* 20% surface for borders */
  --app-border-light: rgba(52, 91, 99, 0.1);       /* 10% surface for light borders */
  
  /* Gradients */
  --gradient-button: linear-gradient(135deg, var(--app-surface) 0%, var(--app-surface-dark) 100%);
  --gradient-button-hover: linear-gradient(135deg, var(--app-surface-dark) 0%, #0f2229 100%);
  --gradient-bg: var(--app-background);
  --gradient-bg-beige: var(--app-background);
  --gradient-card: linear-gradient(135deg, var(--app-surface-subtle) 0%, var(--app-accent-subtle) 100%);
  
  /* Light Mode Colors */
  --bg: var(--app-background);
  --bg-secondary: #CCDDD5;         /* Slightly darker mint */
  --card-bg: #FFFFFF;
  --text-main: var(--app-text-dark);       /* Headers */
  --text-secondary: #3A4A52;                /* Body text - muted teal-gray */
  --text-muted: #6B7B83;                    /* Muted text */
  --border: var(--app-border);
  --border-light: var(--app-border-light);
  
  /* Semantic Colors - Using new palette */
  --success: var(--app-surface);           /* Teal for success */
  --success-bg: var(--app-surface-subtle);
  --success-border: var(--app-surface);
  
  --error: #C75B5B;                        /* Softer red that complements palette */
  --error-bg: rgba(199, 91, 91, 0.08);
  --error-border: rgba(199, 91, 91, 0.2);
  
  --warning: #D4A45C;                      /* Warm gold that fits palette */
  --warning-bg: rgba(212, 164, 92, 0.08);
  --warning-border: rgba(212, 164, 92, 0.2);
  
  --info: var(--app-accent);               /* Blue accent for info */
  --info-bg: var(--app-accent-subtle);
  --info-border: var(--app-accent);
  
  /* Spacing & Layout */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* Shadows - Softer, more subtle */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.1);
  
  /* Icon container */
  --icon-bg: #FFFFFF;
  --icon-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Dark Mode - Class-based toggle for user control */
.dark {
  --bg: var(--app-text-dark);           /* Deep navy for dark mode background */
  --bg-secondary: #1A2836;               /* Slightly lighter navy */
  --card-bg: #1E2A38;                    /* Card background in dark mode */
  --text-main: #E8EAF0;
  --text-secondary: #A8ACB8;
  --text-muted: #6B7280;
  --border: rgba(78, 124, 167, 0.2);     /* Accent-based border for dark */
  --border-light: rgba(78, 124, 167, 0.1);
  
  /* Gradients for dark mode */
  --gradient-bg: var(--app-text-dark);
  --gradient-bg-beige: var(--app-text-dark);
  --gradient-card: linear-gradient(135deg, var(--app-surface-hover) 0%, var(--app-accent-hover) 100%);
  
  /* Adjust semantic colors for dark mode - derived from new palette */
  --success-bg: rgba(52, 91, 99, 0.15);        /* Surface-based success */
  --success-border: rgba(52, 91, 99, 0.3);
  --error-bg: rgba(199, 91, 91, 0.15);
  --error-border: rgba(199, 91, 91, 0.3);
  --warning-bg: rgba(212, 164, 92, 0.15);
  --warning-border: rgba(212, 164, 92, 0.3);
  --info-bg: rgba(78, 124, 167, 0.15);         /* Accent-based info */
  --info-border: rgba(78, 124, 167, 0.3);
  
  /* Adjust shadows for dark mode */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.5);
  
  --icon-bg: #252C38;
  --icon-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   GLOBAL RESET & BASE STYLES
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
  background: var(--gradient-bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { font-size: 32px; margin-bottom: var(--spacing-md); font-weight: 700; }
h2 { font-size: 24px; margin-bottom: var(--spacing-sm); }
h3 { font-size: 20px; margin-bottom: var(--spacing-sm); }
h4 { font-size: 18px; margin-bottom: var(--spacing-xs); }

p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
}

/* ============================================
   BUTTONS - Calm Gradient Style
   ============================================ */

/* Primary Button - Gradient */
.btn-primary {
  background: var(--gradient-button);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-button-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Secondary Button - Surface Outline */
.btn-secondary {
  background-color: transparent;
  color: var(--app-surface);
  border: 1.5px solid var(--app-surface);
  border-radius: var(--radius);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  text-decoration: none;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--app-surface-subtle);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tertiary Button - Soft */
.btn-tertiary {
  background-color: var(--app-accent-subtle);
  color: var(--text-main);
  border: none;
  border-radius: var(--radius);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  text-decoration: none;
}

.btn-tertiary:hover:not(:disabled) {
  background-color: var(--info-bg);
  transform: translateY(-1px);
}

/* Full Width Button */
.btn-full {
  width: 100%;
}

/* Small Button */
.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 13px;
}

/* ============================================
   FORM INPUTS - Calm Style
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card-bg);
  color: var(--text-main);
  font-size: 15px;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px var(--app-accent-subtle);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Form Labels */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: var(--spacing-xs);
}

/* ============================================
   CARDS - Calm Style with Subtle Gradients
   ============================================ */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.card-gradient {
  background: var(--gradient-card);
  backdrop-filter: blur(10px);
}

.card-lg {
  padding: var(--spacing-xl);
  border-radius: var(--radius-xl);
}

.card-hover {
  transition: all 0.3s ease;
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--app-accent-subtle);
}

/* Icon Container - For minimalist icons */
.icon-container {
  background: var(--icon-bg);
  border-radius: var(--radius);
  padding: var(--spacing-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--icon-shadow);
}

.icon-container-lg {
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
}

/* ============================================
   ALERTS & FLASH MESSAGES - Calm Style
   ============================================ */

.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
  font-size: 14px;
  border-left: 3px solid;
  backdrop-filter: blur(10px);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--app-surface);
  border-color: var(--success);
}

.alert-error {
  background-color: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
}

.alert-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning);
}

.alert-info {
  background-color: var(--info-bg);
  color: var(--app-accent);
  border-color: var(--info);
}

/* ============================================
   LINKS - High Contrast for Accessibility
   ============================================ */

a {
  color: var(--app-accent);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

a:hover {
  color: var(--app-accent-light);
  text-decoration: underline;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-surface {
  background: var(--app-surface-subtle);
  color: var(--app-surface);
}

.badge-accent {
  background: var(--app-accent-subtle);
  color: var(--app-accent);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* Spacing */
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Border radius */
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

/* Transitions */
.transition-all { transition: all 0.3s ease; }
.transition-fast { transition: all 0.2s ease; }
.transition-slow { transition: all 0.4s ease; }

/* ============================================
   ANIMATIONS - Calm & Peaceful
   ============================================ */

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

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

/* ============================================
   ICON SYSTEM - Minimalist Containers
   ============================================ */

/* 
 * PRODUCTION TODO: Current PNG icons (~5.8MB total) need optimization:
 * - Option 1: Convert to optimized SVGs for scalability
 * - Option 2: Compress PNGs to <100KB each using imagemin/optipng
 * - Option 3: Serve via CDN with lazy loading
 * Current implementation works but should be optimized before production deployment
 */

/* Icon sizes */
:root {
  --icon-size-xs: 32px;
  --icon-size-sm: 40px;
  --icon-size-md: 48px;
  --icon-size-lg: 56px;
  --icon-size-xl: 64px;
}

/* Icon chip container - white surface with subtle shadow */
.icon-chip {
  background: var(--icon-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--icon-shadow);
  transition: all 0.3s ease;
}

.icon-chip img {
  width: var(--icon-size-md);
  height: var(--icon-size-md);
  object-fit: contain;
}

/* Icon chip sizes */
.icon-chip-xs { padding: 6px; }
.icon-chip-xs img { width: var(--icon-size-xs); height: var(--icon-size-xs); }

.icon-chip-sm { padding: var(--spacing-xs); }
.icon-chip-sm img { width: var(--icon-size-sm); height: var(--icon-size-sm); }

.icon-chip-md { padding: var(--spacing-sm); }
.icon-chip-md img { width: var(--icon-size-md); height: var(--icon-size-md); }

.icon-chip-lg { padding: var(--spacing-md); }
.icon-chip-lg img { width: var(--icon-size-lg); height: var(--icon-size-lg); }

.icon-chip-xl { padding: var(--spacing-lg); }
.icon-chip-xl img { width: var(--icon-size-xl); height: var(--icon-size-xl); }

/* Icon chip hover effect */
.icon-chip-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Icon grid layout for activity cards */
.icon-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

@media (max-width: 640px) {
  .icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-sm);
  }
}

/* Dark mode adjustments for icons */
.dark .icon-chip img {
  filter: brightness(1.05);
}
