/* ==============================================
   Pomodoro Timer - Neobrutalism Design
   ============================================== */

/* Global box-sizing */
.pomodoro-container,
.pomodoro-container *,
.pomodoro-container *::before,
.pomodoro-container *::after {
  box-sizing: border-box;
}

/* ==============================================
   CSS Variables - Light Mode (Default)
   ============================================== */
.pomodoro-container {
  /* Background colors */
  --bg-primary: #f5f5f0;
  --bg-secondary: #fff;
  --bg-section: #fff;
  
  /* Borders */
  --border-color: #333;
  
  /* Text colors */
  --text-primary: #222;
  --text-secondary: #555;
  --text-light: #666;
  
  /* Brand colors */
  --color-accent: #3498db;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-purple: #9b59b6;
  --color-teal: #1abc9c;
  
  /* Shadows (neobrutalism) */
  --shadow-sm: 2px 2px 0 rgba(0,0,0,0.1);
  --shadow-md: 4px 4px 0 rgba(0,0,0,0.15);
  --shadow-lg: 8px 8px 0 rgba(0,0,0,0.15);
  
  /* Border radius */
  --radius-container: 8px;
  --radius-section: 6px;
  --radius-button: 4px;
  --radius-input: 4px;
  
  /* Input focus */
  --input-focus-bg: #fffacd;
  
  /* Header title */
  --title-color: #2c3e50;
  --title-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  
  /* Button hover */
  --btn-hover-overlay: rgba(0,0,0,0.1);
  
  /* Timer specific */
  --timer-work-color: #e74c3c;
  --timer-break-color: #3498db;
  --timer-bg: #f8f9fa;
}

/* ==============================================
   Dark Mode - Manual Toggle
   ============================================== */
.pomodoro-container.dark {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-section: #2d2d2d;
  --border-color: #e0e0e0;
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-light: #909090;
  --color-accent: #5dade2;
  --color-success: #52c77a;
  --color-warning: #f5b041;
  --color-danger: #ec7063;
  --color-purple: #af7ac5;
  --color-teal: #48d1cc;
  --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
  --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
  --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
  --input-focus-bg: #3a3a3a;
  --title-color: #7fb3d5;
  --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  --btn-hover-overlay: rgba(255,255,255,0.1);
  --timer-work-color: #ec7063;
  --timer-break-color: #5dade2;
  --timer-bg: #3a3a3a;
}

/* ==============================================
   Dark Mode - System Auto Detection
   ============================================== */
@media (prefers-color-scheme: dark) {
  .pomodoro-container:not(.dark):not(.light) {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-section: #2d2d2d;
    --border-color: #e0e0e0;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-light: #909090;
    --color-accent: #5dade2;
    --color-success: #52c77a;
    --color-warning: #f5b041;
    --color-danger: #ec7063;
    --color-purple: #af7ac5;
    --color-teal: #48d1cc;
    --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
    --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
    --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
    --input-focus-bg: #3a3a3a;
    --title-color: #7fb3d5;
    --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    --btn-hover-overlay: rgba(255,255,255,0.1);
    --timer-work-color: #ec7063;
    --timer-break-color: #5dade2;
    --timer-bg: #3a3a3a;
  }
}

/* ==============================================
   Main Container
   ============================================== */
.pomodoro-container {
  position: relative;
  max-width: 900px;
  width: 100%;
  margin: 8px auto;
  padding: 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-container);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}

/* ==============================================
   Dark Mode Toggle Button
   ============================================== */
.dark-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
  font-size: 17.5px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10;
}

.dark-mode-toggle:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
}

.dark-mode-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ==============================================
   Title & Description
   ============================================== */
.pomodoro-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--title-color);
  text-shadow: var(--title-shadow);
}

.pomodoro-desc {
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

/* ==============================================
   2-Column Grid Layout
   ============================================== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

/* ==============================================
   Section Styles
   ============================================== */
.input-section,
.result-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.section-header svg {
  color: var(--color-accent);
}

/* ==============================================
   Mode Toggle Buttons
   ============================================== */
.mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.mode-btn {
  flex: 1;
  padding: 10px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.mode-btn:hover {
  background: var(--btn-hover-overlay);
}

.mode-btn.active {
  background: var(--timer-work-color);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.mode-btn:last-child.active {
  background: var(--timer-break-color);
}

/* ==============================================
   Timer Display
   ============================================== */
.timer-display {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.timer-circle {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--timer-bg);
  border-radius: 50%;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.timer-progress {
  position: absolute;
  top: -1px;
  left: -1px;
  transform: rotate(-90deg);
}

.timer-progress-bg {
  stroke: var(--bg-primary);
}

.timer-progress-ring {
  stroke: var(--timer-work-color);
  transition: stroke-dashoffset 0.3s ease;
}

.timer-circle.break-mode .timer-progress-ring {
  stroke: var(--timer-break-color);
}

.timer-time {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  z-index: 1;
}

.timer-session {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
  z-index: 1;
}

/* ==============================================
   Timer Controls
   ============================================== */
.timer-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.control-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: var(--radius-button);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  transition: all 0.15s;
  box-shadow: var(--shadow-md);
}

.control-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-sm);
}

.control-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.start-btn {
  background: var(--color-success);
}

.pause-btn {
  background: var(--color-warning);
  display: none;
}

.reset-btn {
  background: var(--color-danger);
}

.timer-controls.running .start-btn {
  display: none;
}

.timer-controls.running .pause-btn {
  display: flex;
}

/* ==============================================
   Achievement Box
   ============================================== */
.achievement-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 10px;
}

.achievement-title {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.achievement-stats {
  display: flex;
  justify-content: space-between;
  text-align: center;
}

.achievement-item {
  flex: 1;
}

.achievement-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.2;
}

.achievement-label {
  font-size: 13px;
  color: var(--text-light);
}

/* ==============================================
   Settings Section
   ============================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.setting-group {
  margin-bottom: 0;
}

.setting-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

.setting-control input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  outline: none;
}

.setting-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.setting-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.setting-value {
  min-width: 42px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  text-align: right;
}

/* ==============================================
   Checkbox Grid
   ============================================== */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
}

.setting-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.setting-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: var(--bg-secondary);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.setting-check input[type="checkbox"]:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.setting-check input[type="checkbox"]:checked::before {
  content: '✓';
  position: absolute;
  color: #fff;
  font-size: 12px;
  top: -1px;
  left: 2px;
}

/* ==============================================
   Sound Settings
   ============================================== */
.sound-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sound-settings select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.sound-settings select:focus {
  outline: none;
  background: var(--input-focus-bg);
}

/* ==============================================
   Help Section
   ============================================== */
.help-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.help-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 10px 0;
}

.help-tips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.help-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  font-size: 13px;
  color: var(--text-secondary);
}

.tip-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ==============================================
   Toast Notification
   ============================================== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: var(--radius-section);
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  white-space: nowrap;
}

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

.toast.success {
  background: var(--color-success);
  color: #fff;
}

.toast.warning {
  background: var(--color-warning);
  color: #fff;
}

.toast.error {
  background: var(--color-danger);
  color: #fff;
}

/* ==============================================
   Responsive - Tablet (768px)
   ============================================== */
@media screen and (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .help-tips {
    grid-template-columns: 1fr;
  }
  
  .timer-circle {
    width: 180px;
    height: 180px;
  }
  
  .timer-progress {
    width: 182px;
    height: 182px;
  }
  
  .timer-time {
    font-size: 36px;
  }
}

/* ==============================================
   Responsive - Mobile (480px)
   ============================================== */
@media screen and (max-width: 480px) {
  .pomodoro-container {
    padding: 6px;
    margin: 4px;
  }
  
  .pomodoro-title {
    font-size: 20px;
  }
  
  .pomodoro-desc {
    font-size: 14px;
  }
  
  .input-section,
  .result-section,
  .help-section {
    padding: 10px;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
  
  .sound-settings {
    grid-template-columns: 1fr;
  }
  
  .timer-controls {
    flex-direction: column;
  }
  
  .control-btn {
    width: 100%;
  }
  
  .timer-circle {
    width: 160px;
    height: 160px;
  }
  
  .timer-progress {
    width: 162px;
    height: 162px;
  }
  
  .timer-time {
    font-size: 32px;
  }
  
  .achievement-stats {
    flex-direction: column;
    gap: 8px;
  }
  
  .achievement-value {
    font-size: 22px;
  }
}