/* CSS Custom Properties for Light Theme */
:root {
  /* Colors */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #059669;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Border Colors */
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  
  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
  /* Colors */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #94a3b8;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  
  /* Background Colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  /* Border Colors */
  --border-color: #334155;
  --border-hover: #475569;
  
  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.year-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.year-select:hover {
  border-color: var(--border-hover);
}

.theme-toggle, .github-button {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.theme-toggle:hover, .github-button:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-secondary);
}

.theme-icon, .github-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-icon {
  font-size: 1.25rem;
}

/* Main Content */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Goal Creation Section */
.goal-creation {
  margin-bottom: 2rem;
}

.goal-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

.modal .goal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

/* Goals Section */
.goals-section h2 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}



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

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Goal Cards */
.goal-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}



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

.goal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.goal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 0.375rem;
  transition: width 0.3s ease;
  width: 0%;
}

/* Time Controls */
.time-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.time-btn, .custom-time-btn {
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-btn:hover, .custom-time-btn:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Custom Time Input */
.custom-time-input {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.custom-minutes {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* Responsive Design */
/* Responsive layout for cards with 4 columns */
@media (max-width: 1400px) and (min-width: 1200px) {
  .time-controls {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }
  
  .time-btn, .custom-time-btn {
    font-size: 0.7rem;
    padding: 0.4rem 0.3rem;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }
  
  .header-content {
    padding: 1rem;
  }
  
  .goal-form {
    grid-template-columns: 1fr;
  }
  

  
  .goal-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .time-controls {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }
  
  .time-btn, .custom-time-btn {
    font-size: 0.65rem;
    padding: 0.4rem 0.2rem;
  }
  
  .custom-time-input {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .year-progress-container {
    min-width: 150px;
    gap: 0.5rem;
  }
  
  .year-progress-text {
    min-width: 2rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .app-title {
    font-size: 1.5rem;
  }
  
  .header-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .year-progress-container {
    min-width: 120px;
    gap: 0.375rem;
  }
  
  .year-display {
    font-size: 0.875rem;
  }
  
  .year-progress-text {
    font-size: 0.625rem;
    min-width: 1.5rem;
  }
  
  .time-controls {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.2rem;
  }
  
  .time-btn, .custom-time-btn {
    font-size: 0.6rem;
    padding: 0.3rem 0.1rem;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.manage-modal {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.manage-modal .modal-goals-list {
  max-height: none;
  overflow-y: visible;
}

.delete-modal {
  max-width: 400px;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* Modal sections */
.modal-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.modal-section h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Modal goals list */
.modal-goals-list {
  max-height: 300px;
  overflow-y: auto;
}

.modal-goal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;
}

.modal-goal-item:hover {
  background-color: var(--bg-tertiary);
}

.modal-goal-info {
  flex: 1;
}

.modal-goal-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.modal-goal-progress {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.modal-goal-delete {
  padding: 0.5rem 1rem;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.modal-goal-delete:hover {
  background-color: var(--warning-color);
}

.modal-goal-delete.confirm-stage {
  background-color: var(--warning-color);
  animation: pulse-warning 0.3s ease;
}

.modal-goal-delete.confirm-stage:hover {
  background-color: #b45309;
}

@keyframes pulse-warning {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}



/* Floating Menu */
.floating-menu {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
}

.floating-menu.hidden {
  display: none;
}

.menu-toggle {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 102;
}

.menu-icon {
  transition: transform 0.3s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.floating-menu:hover .menu-toggle,
.menu-items:hover ~ .menu-toggle {
  transform: rotate(45deg);
}

.floating-menu:hover .menu-icon,
.menu-items:hover ~ .menu-toggle .menu-icon {
  transform: rotate(-45deg);
  animation: none;
}

.menu-items {
  position: absolute;
  bottom: 3.8rem;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  padding-bottom: 1rem;
}

.floating-menu:hover .menu-items,
.menu-items:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}

/* Add invisible bridge between main button and menu items */
.menu-items:before {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 0;
  right: 0;
  height: 1rem;
  background: transparent;
}

.menu-item {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  position: relative;
}

.menu-item:hover {
  background-color: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

.menu-item:before {
  content: attr(data-tooltip);
  position: absolute;
  right: 3.5rem;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 103;
}

.menu-item:hover:before {
  opacity: 1;
  visibility: visible;
}

/* Header year display and progress */
.year-progress-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
}

.year-display {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.year-progress-bar {
  flex: 1;
  height: 0.375rem;
  background-color: var(--border-color);
  border-radius: 0.1875rem;
  overflow: hidden;
  position: relative;
}

.year-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 0.1875rem;
  transition: width 0.3s ease;
  width: 0%;
}

.year-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  min-width: 2.5rem;
  text-align: right;
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
