/* ========================================================
   CONSULTANT SURVIVAL — POMODORO FLOW DESIGN SYSTEM
   Unione tra Luxury Cyber Dark UI e Timer Esperienziale
   ======================================================== */

:root {
  /* Dynamic Mode Colors */
  --pomo-sprint: #f59e0b;
  --pomo-sprint-glow: rgba(245, 158, 11, 0.4);
  --pomo-sprint-grad: linear-gradient(135deg, #f59e0b, #ef4444);

  --pomo-focus: #ef4444;
  --pomo-focus-glow: rgba(239, 68, 68, 0.4);
  --pomo-focus-grad: linear-gradient(135deg, #ef4444, #f97316);

  --pomo-break: #10b981;
  --pomo-break-glow: rgba(16, 185, 129, 0.4);
  --pomo-break-grad: linear-gradient(135deg, #10b981, #06b6d4);

  --pomo-long: #8b5cf6;
  --pomo-long-glow: rgba(139, 92, 246, 0.4);
  --pomo-long-grad: linear-gradient(135deg, #8b5cf6, #ec4899);

  /* Default Active Mode Accent (Pomodoro Focus) */
  --accent-pomo: var(--pomo-focus);
  --accent-pomo-glow: var(--pomo-focus-glow);
  --accent-pomo-grad: var(--pomo-focus-grad);
}

body.mode-sprint {
  --accent-pomo: var(--pomo-sprint);
  --accent-pomo-glow: var(--pomo-sprint-glow);
  --accent-pomo-grad: var(--pomo-sprint-grad);
}

body.mode-focus, body.mode-pomodoro {
  --accent-pomo: var(--pomo-focus);
  --accent-pomo-glow: var(--pomo-focus-glow);
  --accent-pomo-grad: var(--pomo-focus-grad);
}

body.mode-short, body.mode-short-break {
  --accent-pomo: var(--pomo-break);
  --accent-pomo-glow: var(--pomo-break-glow);
  --accent-pomo-grad: var(--pomo-break-grad);
}

body.mode-long, body.mode-long-break {
  --accent-pomo: var(--pomo-long);
  --accent-pomo-glow: var(--pomo-long-glow);
  --accent-pomo-grad: var(--pomo-long-grad);
}

/* Canvas Sfondo Dinamico Particelle */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  transition: opacity 0.5s ease;
}

/* Action buttons nell'header */
.pomo-header-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.1rem;
}

.pomo-header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pomo-header-btn svg {
  width: 20px;
  height: 20px;
}

.pomo-header-btn .btn-tooltip {
  position: absolute;
  top: 115%;
  background: #141a29;
  color: #ffffff;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 100;
}

.pomo-header-btn:hover .btn-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Hero Section Pomodoro */
.pomo-main-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  margin: 1.5rem auto 2.5rem auto;
  max-width: 680px;
  position: relative;
  z-index: 2;
}

/* Modalità Selector Tabs */
.mode-selector {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 0.35rem;
  gap: 0.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  max-width: 100%;
  overflow-x: auto;
}

.mode-tab {
  display: flex;
  align-items: center;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

.mode-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.mode-tab .tab-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-pomo);
  margin-right: 0.45rem;
  box-shadow: 0 0 10px var(--accent-pomo);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Task Intention Card */
.task-intent-card {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  gap: 0.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.task-intent-card:focus-within {
  border-color: var(--accent-pomo);
  box-shadow: 0 0 20px var(--accent-pomo-glow);
}

.intent-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.intent-icon svg {
  width: 18px;
  height: 18px;
}

#intent-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #ffffff;
}

#intent-input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  display: none;
}

.clear-btn:hover {
  color: #ffffff;
}

/* Circular Timer Section */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  width: 100%;
}

.circular-timer-container {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 10;
}

.ring-progress {
  fill: none;
  stroke: var(--accent-pomo);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 879.64; /* 2 * PI * 140 */
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 14px var(--accent-pomo-glow));
  transition: stroke-dashoffset 0.5s ease-in-out, stroke 0.3s ease;
}

/* Pulsing effect when running */
body.timer-running .ring-progress {
  animation: pomoSubtlePulse 3.5s ease-in-out infinite alternate;
}

@keyframes pomoSubtlePulse {
  0% {
    filter: drop-shadow(0 0 10px var(--accent-pomo-glow));
  }
  100% {
    filter: drop-shadow(0 0 24px var(--accent-pomo-glow));
  }
}

.timer-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.status-badge {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-pomo);
  margin-bottom: 0.25rem;
  transition: color 0.3s ease;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 4px 25px rgba(0, 0, 0, 0.7);
  user-select: none;
}

.session-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Controls Bar */
.timer-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn {
  padding: 0.95rem 2.2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-full);
  background: var(--accent-pomo-grad);
  color: #ffffff;
  box-shadow: 0 8px 25px var(--accent-pomo-glow), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px var(--accent-pomo-glow);
}

.primary-btn:active {
  transform: translateY(0) scale(0.98);
}

.primary-btn svg {
  width: 18px;
  height: 18px;
}

.secondary-btn {
  padding: 0.75rem 1.3rem;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.secondary-btn:hover {
  background: rgba(31, 41, 55, 0.9);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.secondary-btn svg {
  width: 16px;
  height: 16px;
}

/* Quick Adjust Chips */
.quick-adjust-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: -0.25rem;
}

.chip-label {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Gamification & XP Bar in Pomodoro */
.pomo-level-box {
  width: 100%;
  max-width: 520px;
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.pomo-quote-bar {
  text-align: center;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 520px;
  padding: 0 1rem;
}

.shortcuts-legend {
  display: flex;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.5rem;
}

.shortcuts-legend kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #ffffff;
}

/* ========================================================
   ZEN / FULLSCREEN MODE
   ======================================================== */
body.zen-active {
  overflow: hidden;
}

body.zen-active .header,
body.zen-active .site-nav,
body.zen-active .pomo-intro,
body.zen-active .mode-selector,
body.zen-active .task-intent-card,
body.zen-active .quick-adjust-chips,
body.zen-active .pomo-level-box,
body.zen-active .pomo-quote-bar,
body.zen-active .shortcuts-legend,
body.zen-active .wellness-card,
body.zen-active .pomo-content,
body.zen-active .footer {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: none !important;
}

body.zen-active .container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

body.zen-active .circular-timer-container {
  transform: scale(1.35);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.zen-exit-hint {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  z-index: 99999;
  pointer-events: none;
  animation: pomoFadeInOut 3.5s forwards;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

@keyframes pomoFadeInOut {
  0% { opacity: 0; transform: translate(-50%, -15px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -15px); }
}

/* ========================================================
   MODALS (NATIVE DIALOG WITH BACKDROP)
   ======================================================== */
dialog:not([open]) {
  display: none !important;
}

.custom-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 480px;
  width: 90%;
  margin: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  z-index: 10000;
}

.custom-modal::backdrop {
  background: rgba(5, 7, 12, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Sound Grid */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.sound-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  gap: 0.35rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.sound-card:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateY(-2px);
}

.sound-card.active {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.12);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

.s-icon {
  font-size: 1.4rem;
}

.s-name {
  font-size: 0.75rem;
  text-align: center;
  font-weight: 500;
}

/* Sliders & Forms in Modals */
.sound-slider-group,
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.styled-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.styled-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.styled-input:focus {
  border-color: var(--primary);
}

.test-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.test-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.test-btn.danger {
  color: #f87171;
  margin-top: 0.5rem;
  align-self: center;
  border-color: rgba(248, 113, 113, 0.3);
}

.test-btn.danger:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.full-width {
  width: 100%;
  margin-top: 0.5rem;
}

/* Stats Modal Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  text-align: center;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-desc {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 0.2rem;
}

.recent-tasks-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-tasks-section h4 {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.completed-tasks-list {
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.completed-tasks-list li {
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.completed-tasks-list li.empty-state {
  color: var(--text-subtle);
  text-align: center;
  display: block;
  font-style: italic;
  padding: 1rem 0;
}

/* Floating Toast Notification */
.pomo-floating-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(17, 24, 39, 0.95);
  color: #ffffff;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary-glow);
  border: 1px solid var(--primary);
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999999;
}

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

/* Responsive */
@media (max-width: 640px) {
  .circular-timer-container {
    width: 270px;
    height: 270px;
  }

  .timer-display {
    font-size: 3.5rem;
  }

  .timer-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .shortcuts-legend {
    display: none;
  }
}
