/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@600&display=swap');

/* CSS Custom Properties - Reduced to essentials */
:root {
  --primary-bg: #0a0a0f;
  --secondary-bg: #16161d;
  --card-bg: rgba(26, 27, 38, 0.8);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --accent-primary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset and Base Styles */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--primary-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Simplified Background Animation */
.background-particles {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: 
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  animation: particleFloat 20s ease-in-out infinite;
}

@keyframes particleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Main Dashboard Container */
.dashboard {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

/* Main Card Container */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-gradient);
  opacity: 0.6;
}

.pomodoro-card {
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
  position: relative;
  animation: slideUp 0.6s ease-out;
}

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

/* Header Section */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: var(--shadow-glow);
  transition: var(--transition);
}

.logo:hover {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.back-btn {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateX(-2px);
}

/* Section Styling */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Task Management Section */
.task-section {
  margin-bottom: 2rem;
}

.task-input-container {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.task-input {
  flex: 1;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.875rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.task-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.task-input::placeholder {
  color: var(--text-muted);
}

.add-task-btn {
  background: var(--accent-gradient);
  border: none;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.add-task-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-list li {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.task-list li:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

/* Timer Section */
.timer-section {
  margin-bottom: 2rem;
}

.timer-card {
  text-align: center;
  padding: 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-lg);
}

.session-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.timer-display-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  width: 200px;
  height: 200px;
}

.time-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.progress-ring {
  position: absolute;
  inset: 0;
}

.progress-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}

.progress-ring-circle-bg,
.progress-ring-circle {
  cx: 50%;
  cy: 50%;
  r: calc(50% - 12px);
  stroke-width: 8;
  fill: transparent;
}

.progress-ring-circle-bg {
  opacity: 0.2;
  stroke: #e2e8f0;
}

.progress-ring-circle {
  stroke: url(#gradient);
  stroke-dasharray: calc(2 * 3.14159 * (50% - 12px));
  stroke-dashoffset: calc(2 * 3.14159 * (50% - 12px));
  transition: stroke-dashoffset 1s ease-in-out;
  stroke-linecap: round;
}

/* Control Buttons */
.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.control-btn {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  min-width: 100px;
  justify-content: center;
}

.control-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

/* Button variants */
.start-btn:not(:disabled) {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.pause-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.reset-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Custom Timer Section */
.custom-time-section {
  margin-bottom: 2rem;
}

.custom-time-controls {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 120px;
}

.input-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-group input {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.set-time-btn {
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.set-time-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Statistics Section */
.history {
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  border-radius: var(--border-radius-sm);
  text-align: center;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Message Box */
.message-box {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background-color: #dcfce7;
  color: #065f46;
  font-weight: 600;
  border: 1px solid #22c55e;
  text-align: center;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive Design - Consolidated Media Queries */
@media (max-width: 768px) {
  .dashboard {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .pomodoro-card {
    padding: 2rem 1.5rem;
    max-width: 100%;
    width: 100%;
  }

  .header-top {
    flex-direction: column;
    gap: 0.5rem;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .timer-display-container {
    width: 160px;
    height: 160px;
  }

  .time-display {
    font-size: 2.5rem;
  }

  .progress-ring-circle-bg,
  .progress-ring-circle {
    r: calc(50% - 8px);
    stroke-width: 6;
  }

  .controls {
    gap: 0.75rem;
  }

  .control-btn {
    min-width: 90px;
    padding: 0.75rem 1.25rem;
    flex: 1;
    max-width: 120px;
  }

  .custom-time-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .set-time-btn {
    width: 100%;
  }

  .task-input-container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .add-task-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .dashboard {
    padding: 0.5rem;
    padding-top: 1rem;
  }

  .pomodoro-card {
    padding: 1.25rem 0.875rem;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .logo {
    width: 32px;
    height: 32px;
  }

  .timer-display-container {
    width: 130px;
    height: 130px;
    margin-bottom: 1.5rem;
  }

  .time-display {
    font-size: 1.9rem;
  }

  .progress-ring-circle-bg,
  .progress-ring-circle {
    r: calc(50% - 4px);
    stroke-width: 4;
  }

  .control-btn {
    min-width: 70px;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Hide button text on very small screens, keep icons only */
  .control-btn span:last-child {
    display: none;
  }

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

  .stat-number {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}