* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px 16px;
  padding-bottom: 100px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Add Task Section */
.add-task-section {
  margin-bottom: 32px;
}

.add-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.add-btn:hover {
  background: var(--primary-dark);
}

.add-btn:active {
  transform: scale(0.98);
}

/* Task Form */
.task-form {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 16px;
}

.task-form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.task-form input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* Schedule Section */
.schedule-section {
  margin-bottom: 16px;
}

.schedule-row {
  margin-bottom: 12px;
}

.schedule-row .label {
  display: block;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 0.85rem;
}

/* Dial Selectors */
.dial {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dial-option {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
  text-align: center;
}

.dial-option:hover {
  background: var(--bg-hover);
}

.dial-option.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.number-dial .dial-option {
  min-width: 40px;
}

.unit-dial .dial-option {
  min-width: 70px;
}

/* Date Picker */
.date-section {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.date-row {
  margin-bottom: 12px;
}

.date-row:last-child {
  margin-bottom: 0;
}

.date-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.year-dial .dial-option {
  min-width: 60px;
}

.month-dial {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.month-dial .dial-option {
  padding: 8px 4px;
  font-size: 0.8rem;
  min-width: unset;
}

/* Calendar Grid */
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.calendar-header span {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-days .dial-option {
  padding: 8px 4px;
  font-size: 0.8rem;
  min-width: unset;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-days .dial-option.empty {
  visibility: hidden;
}

.calendar-days .dial-option.today {
  border-color: var(--warning);
}

/* Recurrence Type */
.recurrence-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.type-option {
  padding: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.type-option:hover {
  border-color: var(--text-muted);
}

.type-option.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.type-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.type-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.type-example {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Task Sections */
.task-section {
  margin-bottom: 28px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 0.95rem;
}

/* Task Item */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.task-item:hover {
  background: var(--bg-hover);
}

.task-item:active {
  transform: scale(0.99);
}

.task-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.task-item.due .task-check {
  background: var(--success);
  color: white;
}

.task-item.due .task-check::after {
  content: '✓';
  font-size: 14px;
  font-weight: bold;
}

.task-item.waiting .task-check {
  border-color: var(--text-muted);
  opacity: 0.5;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.task-schedule {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-type-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
}

.task-due-info {
  font-size: 0.75rem;
  color: var(--warning);
}

.task-item.overdue .task-due-info {
  color: var(--danger);
}

.task-edit-btn {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 1.1rem;
}

.task-edit-btn:hover {
  background: var(--bg);
  color: var(--text);
}

/* Waiting Section */
.waiting-section {
  opacity: 0.7;
}

.waiting-section .task-item {
  background: transparent;
  border: 1px solid var(--border);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.modal-content input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 16px;
}

.modal-content input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-content .form-actions {
  margin-top: 20px;
}

.modal-content .btn-danger {
  margin-right: auto;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 400px) {
  .recurrence-type {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-wrap: wrap;
  }
  
  .form-actions button {
    flex: 1;
    min-width: 80px;
  }
}
