:root {
  --bg-color: #060913;
  --panel-bg: rgba(13, 20, 38, 0.45);
  --panel-border: rgba(255, 255, 255, 0.07);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  /* Core Palette */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  /* Slider specific colors */
  --slider-track: #1e293b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow backdrops */
.glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.4;
  pointer-events: none;
  animation: floatGlow 15s infinite alternate ease-in-out;
}

.glow-1 {
  background-color: var(--primary);
  top: -10%;
  left: -10%;
}

.glow-2 {
  background-color: var(--accent-cyan);
  bottom: 10%;
  right: -10%;
  animation-delay: -5s;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.15); }
}

/* Container & Header */
.app-container {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 1;
  position: relative;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.6rem;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Glassmorphism Card styling */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  position: relative;
  overflow: hidden;
}

/* Typography & General View Layout */
.view-section {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.view-section.active {
  display: flex;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Task Input & Voice Mic */
.task-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#task-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 50px 16px 18px;
  font-size: 1rem;
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
}

#task-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.mic-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-btn:hover {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
}

.mic-btn.recording {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.15);
  animation: pulseMic 1.5s infinite ease-in-out;
}

.mic-status {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  height: 12px;
  margin-top: -4px;
}

@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Slider Customization */
#focus-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--slider-track);
  outline: none;
  margin: 15px 0;
  cursor: pointer;
}

#focus-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), 0 0 10px var(--primary);
  transition: transform 0.1s ease;
}

#focus-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.focus-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

/* Dynamic Focus Badge Colors */
.focus-badge.level-1, .focus-badge.level-2 { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.focus-badge.level-3, .focus-badge.level-4 { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.focus-badge.level-5, .focus-badge.level-6 { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.focus-badge.level-7, .focus-badge.level-8 { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.focus-badge.level-9, .focus-badge.level-10 { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); box-shadow: 0 0 10px rgba(6, 182, 212, 0.2); }

/* Mood Selection Grid */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mood-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.mood-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.mood-btn.selected {
  background: rgba(99, 102, 241, 0.12);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
  transform: scale(1.02);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-top: 10px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Dashboard Summary Cards */
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.card-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
}

.card-info {
  display: flex;
  flex-direction: column;
}

.card-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}

/* Dashboard Layout Grid */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
  border-left: 3px solid var(--accent-cyan);
  padding-left: 8px;
}

/* Productive Hours (Hourly Bar Chart) */
.hourly-chart-container {
  height: 180px;
  display: flex;
  align-items: flex-end;
  padding-top: 10px;
}

.hourly-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  height: 100%;
  gap: 4px;
}

.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(to top, rgba(99, 102, 241, 0.2), var(--accent-cyan));
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 2px;
  position: relative;
}

.chart-bar:hover {
  background: linear-gradient(to top, var(--primary), var(--accent-cyan));
  filter: drop-shadow(0 0 6px var(--accent-cyan));
}

.chart-bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.chart-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 8px;
  border-top: 1.5px dashed var(--panel-border);
  padding-top: 8px;
}

/* Side Stats Lists */
.side-stats-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mood-stats-list, .distraction-trends-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.stat-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-score-bg {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  width: 70px;
  height: 6px;
  overflow: hidden;
}

.stat-score-fill {
  background: var(--accent-cyan);
  height: 100%;
}

/* 14-day Heatmap Grid */
.heatmap-panel {
  display: flex;
  flex-direction: column;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 8px;
}

.heatmap-box {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.25s ease;
  position: relative;
}

.heatmap-box:hover::after {
  content: attr(data-date);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* Heatmap box strengths */
.heatmap-box.lvl-0 { background: rgba(255, 255, 255, 0.02); }
.heatmap-box.lvl-1 { background: rgba(99, 102, 241, 0.2); border-color: rgba(99, 102, 241, 0.4); color: #fff; }
.heatmap-box.lvl-2 { background: rgba(99, 102, 241, 0.4); border-color: rgba(99, 102, 241, 0.6); color: #fff; }
.heatmap-box.lvl-3 { background: rgba(99, 102, 241, 0.65); border-color: rgba(99, 102, 241, 0.8); color: #fff; box-shadow: 0 0 8px rgba(99, 102, 241, 0.3); }
.heatmap-box.lvl-4 { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 12px rgba(99, 102, 241, 0.5); }

/* Recent Logs Table */
.logs-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.logs-table th, .logs-table td {
  padding: 14px 18px;
}

.logs-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--panel-border);
}

.logs-table td {
  border-bottom: 1px solid var(--panel-border);
  color: #fff;
}

.logs-table tr:last-child td {
  border-bottom: none;
}

.no-data {
  text-align: center;
  color: var(--text-secondary);
  padding: 24px;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  
  .dashboard-summary {
    grid-template-columns: 1fr;
  }
  
  .summary-card {
    padding: 16px;
  }
  
  .heatmap-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .logo-text {
    font-size: 1.2rem;
  }
}

/* Modal overlay with blur and smooth fade */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 5, 11, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: rgba(13, 20, 38, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1.5px solid var(--panel-border);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--accent-red);
}

.input-helper {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  border-top: 1.5px dashed var(--panel-border);
  padding-top: 20px;
}

.settings-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.action-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.action-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
}

.cyan-btn {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.cyan-btn:hover {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.purple-btn {
  background: rgba(168, 85, 247, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.purple-btn:hover {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* Modal Inputs */
.modal-body input[type="text"] {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
}

.modal-body input[type="text"]:focus {
  border-color: var(--primary);
}

.modal-footer {
  margin-top: 24px;
}

/* Delete Entry Row Buttons */
.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.delete-btn:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.12);
  transform: scale(1.1);
}
