/* ========================================
   TIMER.CSS — Pomodoro / Tomato Timer
   ======================================== */

/* ── Two-column layout ── */
.timer-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}

.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 360px;
  flex-shrink: 0;
}

.timer-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 860px) {
  .timer-layout {
    grid-template-columns: 1fr;
  }
  .timer-card {
    width: 100%;
  }
}

/* ── Timer Phase Tabs ── */
.timer-phases {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  padding: 4px;
  border: 1px solid var(--border-color);
}

.timer-phase-btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-phase-btn:hover {
  color: var(--text-primary);
}

.timer-phase-btn.active {
  background: rgba(var(--accent-primary-rgb), 0.2);
  color: var(--accent-secondary);
}

.timer-phase-btn.active.break {
  background: rgba(var(--accent-green-rgb), 0.2);
  color: var(--accent-green);
}

/* ── Circular Timer ── */
.timer-circle-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
}

.timer-circle-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 6;
}

.timer-circle-progress {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 8px rgba(var(--accent-primary-rgb), 0.4));
}

.timer-circle-progress.break {
  stroke: var(--accent-green);
  filter: drop-shadow(0 0 8px rgba(var(--accent-green-rgb), 0.4));
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-time {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.timer-phase-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
}

/* ── Timer Controls ── */
.timer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-btn:active {
  transform: scale(0.93);
}

.timer-btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 20px rgba(var(--accent-primary-rgb), 0.35);
}

.timer-btn-primary:hover {
  box-shadow: 0 6px 28px rgba(var(--accent-primary-rgb), 0.5);
  filter: brightness(1.1);
}

.timer-btn-primary.break {
  background: var(--gradient-green);
  box-shadow: 0 4px 20px rgba(var(--accent-green-rgb), 0.35);
}

.timer-btn-secondary {
  width: 44px;
  height: 44px;
  background: var(--glass-bg-strong);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 1rem;
}

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

/* ── Timer Task Info ── */
.timer-task-info {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.timer-task-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-primary-rgb), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.timer-task-details {
  flex: 1;
  min-width: 0;
}

.timer-task-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timer-task-project {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.timer-task-tomatoes {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.timer-tomato {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(var(--accent-red-rgb), 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  transition: all var(--transition-fast);
}

.timer-tomato.filled {
  background: rgba(var(--accent-red-rgb), 0.25);
  color: var(--accent-red);
}

/* ── Timer Settings ── */
.timer-settings {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
}

.timer-settings-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.timer-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.timer-setting-row:last-child {
  border-bottom: none;
}

.timer-setting-label {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.timer-setting-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-setting-input {
  width: 60px;
  padding: 6px 10px;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.timer-setting-input:focus {
  border-color: var(--accent-primary);
}

.timer-setting-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Sessions History ── */
.timer-sessions {
  width: 100%;
}

.timer-session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.timer-session-item:last-child {
  border-bottom: none;
}

.timer-session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
}

.timer-session-dot.break {
  background: var(--accent-green);
}

.timer-session-text {
  flex: 1;
  font-size: 0.82rem;
}

.timer-session-time {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* ── Session Round Dots ── */
.timer-session-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timer-session-dot-item {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all var(--transition-fast);
}

.timer-session-dot-item.filled {
  background: var(--accent-primary);
  box-shadow: 0 0 6px rgba(var(--accent-primary-rgb), 0.5);
}

/* ── Pulsing animation when running ── */
.timer-running .timer-circle-progress {
  animation: timerGlow 2s ease-in-out infinite;
}

@keyframes timerGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(var(--accent-primary-rgb), 0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(var(--accent-primary-rgb), 0.7)); }
}

.timer-running.break .timer-circle-progress {
  animation: timerGlowGreen 2s ease-in-out infinite;
}

@keyframes timerGlowGreen {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(var(--accent-green-rgb), 0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(var(--accent-green-rgb), 0.7)); }
}

/* ══════════════════════════════════════════
   FLOATING POMODORO WIDGET
   ══════════════════════════════════════════ */

#pomo-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 288px;
  background: var(--bg-elevated, #1a1a2e);
  border: 1px solid var(--border-light, rgba(255,255,255,0.12));
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 9000;
  overflow: hidden;
  backdrop-filter: blur(24px);
  animation: pomoFloatIn 0.35s cubic-bezier(.34,1.56,.64,1) both;
}

#pomo-float.pomo-hidden { display: none; }

@keyframes pomoFloatIn {
  from { opacity: 0; transform: translateY(32px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.pomo-float-bar {
  height: 3px;
  background: var(--pomo-bar-color, var(--accent-primary));
  transition: background 0.6s ease;
}

.pomo-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 0;
  gap: 8px;
}

.pomo-float-task {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pomo-float-close {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  font-size: 0.8rem;
}

.pomo-float-close:hover {
  background: rgba(var(--accent-red-rgb), 0.18);
  color: var(--accent-red);
}

.pomo-float-open-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  font-size: 0.7rem;
}

.pomo-float-open-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.15);
  color: var(--accent-primary);
}

.pomo-float-body {
  padding: 10px 18px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.pomo-mini-ring {
  position: relative;
  width: 72px; height: 72px;
  flex-shrink: 0;
}

.pomo-mini-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.pomo-mini-ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 5;
}

.pomo-mini-ring-prog {
  fill: none;
  stroke: var(--pomo-bar-color, var(--accent-primary));
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.6s ease;
}

.pomo-mini-time {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.pomo-float-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pomo-float-phase {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pomo-bar-color, var(--accent-primary));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.6s ease;
}

.pomo-float-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pomo-float-btn {
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.pomo-float-btn:active { transform: scale(0.9); }

.pomo-float-btn-main {
  width: 40px; height: 40px;
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 3px 14px rgba(var(--accent-primary-rgb), 0.4);
  font-size: 0.95rem;
}

.pomo-float-btn-main.break-mode {
  background: var(--gradient-green);
  box-shadow: 0 3px 14px rgba(var(--accent-green-rgb), 0.4);
}

.pomo-float-btn-main:hover { filter: brightness(1.12); }

.pomo-float-btn-sm {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-size: 0.78rem;
  border: 1px solid var(--border-color);
}

.pomo-float-btn-sm:hover {
  background: rgba(255,255,255,0.13);
  color: var(--text-primary);
}

.pomo-float-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pomo-float-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all var(--transition-fast);
}

.pomo-float-dot.filled {
  background: var(--accent-primary);
  box-shadow: 0 0 5px rgba(var(--accent-primary-rgb), 0.5);
}

#pomo-float.pomo-running .pomo-mini-ring-prog {
  animation: pomoRingPulse 2s ease-in-out infinite;
}

@keyframes pomoRingPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(var(--accent-primary-rgb), 0.5)); }
  50%       { filter: drop-shadow(0 0 10px rgba(var(--accent-primary-rgb), 0.9)); }
}

/* ── Drag icon in header ── */
.pomo-float-drag-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
  opacity: 0.45;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: -1px;
  margin-right: 2px;
}

/* ── 8-direction resize handles ── */
.pf-resize {
  position: absolute;
  z-index: 10;
}

/* Edge handles */
.pf-resize-n  { top: -4px;  left: 12px;  right: 12px; height: 8px; cursor: n-resize;  }
.pf-resize-s  { bottom: -4px; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
.pf-resize-e  { right: -4px; top: 12px;  bottom: 12px; width: 8px; cursor: e-resize;  }
.pf-resize-w  { left: -4px;  top: 12px;  bottom: 12px; width: 8px; cursor: w-resize;  }

/* Corner handles */
.pf-resize-ne { top: -4px;    right: -4px;   width: 14px; height: 14px; cursor: ne-resize; }
.pf-resize-nw { top: -4px;    left: -4px;    width: 14px; height: 14px; cursor: nw-resize; }
.pf-resize-se { bottom: -4px; right: -4px;   width: 14px; height: 14px; cursor: se-resize; }
.pf-resize-sw { bottom: -4px; left: -4px;    width: 14px; height: 14px; cursor: sw-resize; }

/* Visible corner grip indicator (SE only) */
.pf-resize-se::after {
  content: '';
  position: absolute;
  bottom: 4px; right: 4px;
  width: 6px;  height: 6px;
  border-right: 2px solid rgba(255,255,255,0.2);
  border-bottom: 2px solid rgba(255,255,255,0.2);
  border-radius: 1px;
}

/* ── Widget footer: complete task button ── */
.pomo-float-footer {
  padding: 0 14px 12px;
}

.pomo-float-done-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(var(--accent-green-rgb), 0.35);
  border-radius: var(--radius-md);
  background: rgba(var(--accent-green-rgb), 0.08);
  color: var(--accent-green);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pomo-float-done-btn:hover {
  background: rgba(var(--accent-green-rgb), 0.18);
  border-color: var(--accent-green);
}
