/* ============================================
   MICROPPAS - Design System Neuro-Inclusif
   ============================================ */

/* Variables de design */
:root {
  /* Couleurs principales */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.1);
  
  /* Couleurs secondaires */
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.1);
  
  /* Couleurs d'alerte */
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  
  /* Neutres */
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --panel: #ffffff;
  --panel-hover: #f8fafc;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.4);
  
  /* Effets */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Espacement */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* Thème sombre */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --panel: #1e293b;
  --panel-hover: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.1);
  --border-strong: rgba(148, 163, 184, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Reset et base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal);
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 24px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.app-header h1 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.app-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

.install-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.install-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.install-btn:active {
  transform: translateY(0);
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.view-outlet {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px 140px;
  animation: fadeIn var(--transition-slow);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stack {
  display: grid;
  gap: 24px;
}

/* ============================================
   CARTES
   ============================================ */

.card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
  animation: slideUp var(--transition-slow);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  border-radius: 2px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 16px;
  line-height: 1.5;
}

/* ============================================
   BOUTONS
   ============================================ */

button,
.button-link {
  appearance: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

button::after,
.button-link::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::after,
.button-link:active::after {
  width: 300px;
  height: 300px;
}

button {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: var(--primary-soft);
  color: var(--primary);
}

button.secondary:hover {
  background: var(--primary);
  color: white;
}

button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

button.danger:hover {
  background: var(--danger);
  color: white;
}

button.active {
  background: var(--accent);
  color: white;
}

.button-link {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.button-link:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.button-link.secondary {
  background: var(--primary-soft);
  color: var(--primary);
}

.button-link.secondary:hover {
  background: var(--primary);
  color: white;
}

.button-link.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button-link.danger:hover {
  background: var(--danger);
  color: white;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

/* ============================================
   FORMULAIRES
   ============================================ */

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
  transition: all var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

form {
  display: grid;
  gap: 16px;
}

/* ============================================
   NAVIGATION (TAB BAR)
   ============================================ */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}

.tab-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  position: relative;
}

.tab-link span[aria-hidden="true"] {
  font-size: 1.4rem;
  transition: transform var(--transition-fast);
}

.tab-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.tab-link:hover span[aria-hidden="true"] {
  transform: translateY(-2px);
}

.tab-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.tab-link.active::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ============================================
   ENERGY PICKER
   ============================================ */

energy-picker .button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

energy-picker button {
  padding: 16px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
}

/* ============================================
   TASK LIST
   ============================================ */

.task-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  transition: all var(--transition-normal);
  animation: slideUp var(--transition-slow);
}

.task-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.task-card.done {
  opacity: 0.6;
  background: var(--bg-alt);
}

.task-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.task-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card ol {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.task-card li {
  margin: 6px 0;
  font-size: 0.9rem;
}

/* ============================================
   FOCUS TIMER
   ============================================ */

.focus-task {
  text-align: center;
  padding: 20px 0;
}

.focus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  text-align: left;
}

.focus-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.focus-task h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 16px 0;
  color: var(--text);
}

.timer {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  margin: 24px 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px var(--primary-soft);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.focus-task .button-row {
  justify-content: center;
}

/* ============================================
   MODE FOCUS ABSOLU
   ============================================ */

body.absolute-focus-mode .app-header,
body.absolute-focus-mode .tab-bar,
body.absolute-focus-mode focus-timer > .card > h2,
body.absolute-focus-mode .focus-header {
  display: none !important;
}

body.absolute-focus-mode {
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--bg-alt);
}

body.absolute-focus-mode focus-timer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2rem !important;
  margin: 0 !important;
}

body.absolute-focus-mode focus-timer > .card {
  max-width: 600px !important;
  width: 100% !important;
  box-shadow: var(--shadow-xl) !important;
  border: 2px solid var(--primary) !important;
}

body.absolute-focus-mode focus-timer .timer {
  font-size: 6rem !important;
}

/* ============================================
   BOÎTE À PENSÉES
   ============================================ */

.thought-form {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

#thought-input {
  min-height: 100px;
  resize: vertical;
}

.thought-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.thoughts-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.thought-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  transition: all var(--transition-fast);
}

.thought-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.thought-card[data-category="todo"] {
  border-left: 4px solid var(--accent);
}

.thought-card[data-category="explore"] {
  border-left: 4px solid var(--warning);
}

.thought-card[data-category="release"] {
  border-left: 4px solid var(--text-muted);
}

.thought-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.thought-category {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.thought-text {
  margin: 8px 0;
  line-height: 1.5;
  color: var(--text);
}

.thought-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   SONS D'AMBIANCE
   ============================================ */

.ambient-sounds {
  padding: 24px;
  background: var(--panel);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.sound-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.sound-btn {
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-align: center;
  color: var(--text);
}

.sound-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
}

.sound-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.sound-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.volume-slider {
  flex: 1;
  height: 8px;
  appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

#volume-label {
  min-width: 50px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================
   SOS PANEL
   ============================================ */

.sos {
  border-color: var(--danger-soft);
  background: linear-gradient(135deg, var(--panel), var(--danger-soft));
}

.sos-content {
  margin-top: 20px;
}

.sos-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.sos-content li {
  margin: 10px 0;
  color: var(--text-secondary);
}

/* ============================================
   SETTINGS
   ============================================ */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-of-type {
  border-bottom: none;
}

.settings-row label {
  font-weight: 600;
  color: var(--text);
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ============================================
   UTILITAIRES
   ============================================ */

.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;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .app-header {
    margin-top: 16px;
  }

  .app-header h1 {
    font-size: 1.5rem;
  }

  .view-outlet {
    padding: 0 16px 120px;
  }

  .card {
    padding: 20px;
  }

  .timer {
    font-size: 3rem;
  }

  body.absolute-focus-mode focus-timer .timer {
    font-size: 4rem !important;
  }

  .sound-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   ANIMATIONS D'ENTRÉE
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.task-card,
.thought-card {
  animation: fadeInUp 0.5s ease-out;
}

/* Délais pour les animations en cascade */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   BOUTON D'INSTALLATION
   ============================================ */

.install-btn {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.install-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.install-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.install-btn:active {
  transform: translateY(0) scale(0.98);
}

.install-icon {
  font-size: 1.3rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(-3px);
  }
}

.install-text {
  position: relative;
  z-index: 1;
}

/* Animation d'apparition */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bouton d'installation flottant (alternative) */
.install-btn-floating {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 99;
  padding: 16px 28px;
  font-size: 1.1rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

/* Notification d'installation */
.install-notification {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  z-index: 200;
  max-width: 320px;
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.install-notification h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.install-notification p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.install-notification .button-row {
  margin-top: 12px;
}

