/* 
 * ZenPulse Styling System
 * Modern Glassmorphic Dark UI Theme
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #121420;
  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-rgb: 99, 102, 241;
  --accent-secondary: #a855f7; /* Purple */
  --accent-secondary-rgb: 168, 85, 247;
  --accent-success: #10b981; /* Emerald/Mint */
  --accent-success-rgb: 16, 185, 129;
  --accent-warning: #f59e0b; /* Amber */
  --accent-danger: #ef4444; /* Rose */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --glass-bg: rgba(20, 22, 38, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  --glow-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --sidebar-width: 260px;
  --transition-speed: 0.3s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Sidebar Layout */
aside {
  width: var(--sidebar-width);
  background-color: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 100;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.05));
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.3);
  color: #fff;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform var(--transition-speed) ease;
}

.nav-item:hover svg {
  transform: translateX(3px);
}

.nav-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 1.5rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-success);
}

.status-dot.offline {
  background-color: var(--accent-warning);
  box-shadow: 0 0 8px var(--accent-warning);
}

/* Main Workspace */
main {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 2.5rem;
  max-width: calc(100vw - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1.5rem;
}

h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

/* Glassmorphic Grid Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background-color: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--glass-shadow);
  transition: transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title svg {
  color: var(--text-secondary);
}

/* Interactive Components */
button {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
  filter: brightness(1.1);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--glass-border);
  color: var(--text-primary);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

button.danger {
  background: linear-gradient(135deg, var(--accent-danger), #b91c1c);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

button.danger:hover {
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

/* Inputs & Form controls */
input, textarea, select {
  width: 100%;
  background-color: rgba(10, 11, 16, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

/* Tab contents routing views */
.view-container {
  display: none;
}

.view-container.active {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn var(--transition-speed) ease-out;
}

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

/* Habit Tracker UI Components */
.habit-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.habit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  transition: all var(--transition-speed) ease;
}

.habit-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

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

.habit-name {
  font-weight: 600;
  color: var(--text-primary);
}

.habit-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent-warning);
  font-weight: 600;
}

.check-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: none;
}

.check-button:hover {
  border-color: var(--accent-success);
  color: rgba(16, 185, 129, 0.4);
  transform: scale(1.05);
  box-shadow: none;
}

.check-button.completed {
  background: linear-gradient(135deg, var(--accent-success), #059669);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

/* Mental Health Mood Tracking UI */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.slider-val {
  font-weight: 700;
  color: var(--accent-primary);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  outline: none;
  padding: 0;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Web Audio ambient controller */
.ambient-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.25rem;
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

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

.ambient-title {
  font-weight: 600;
}

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

.volume-slider {
  width: 80px;
}

/* Breathing Visualizer circle container */
.breathing-visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
  gap: 2rem;
  position: relative;
}

.breath-circle-outer {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.05) 70%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.5s ease-in-out;
}

.breath-circle-inner {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 1s ease-in-out, background 1s ease-in-out;
  transform: scale(1);
}

.breath-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timer-display {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Breathing circle action statuses */
.breath-circle-outer::after {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(168, 85, 247, 0.3);
  animation: rotate 30s linear infinite;
}

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

/* Bluetooth / Biometrics connection widget */
.biometrics-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .biometrics-grid {
    grid-template-columns: 1fr;
  }
}

.device-connector {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.device-status-card {
  padding: 1.25rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.device-avatar {
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  border: 1px solid var(--glass-border);
}

.device-avatar.connected {
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-metrics-strip {
  display: flex;
  justify-content: space-around;
  background-color: rgba(10, 11, 16, 0.3);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid var(--glass-border);
}

.metric-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-value.heart-rate {
  color: var(--accent-danger);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Charts and Visualization SVG style */
.chart-container {
  width: 100%;
  height: 220px;
  margin-top: 1rem;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4));
}

.chart-area {
  fill: url(#chart-gradient);
  opacity: 0.15;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.chart-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-body);
}

.chart-dot {
  fill: var(--accent-primary);
  stroke: var(--bg-secondary);
  stroke-width: 2;
  r: 4;
  transition: r 0.2s ease;
}

.chart-dot:hover {
  r: 7;
  fill: var(--accent-secondary);
  cursor: pointer;
}

/* Local AI recommendation system widget */
.ai-recommendation-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ai-icon {
  font-size: 2rem;
  display: flex;
  align-items: flex-start;
}

.ai-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-badge {
  background-color: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.ai-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Burnout widget details */
.burnout-dial-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 0.5rem;
}

.burnout-dial {
  width: 140px;
  height: 140px;
  position: relative;
}

.burnout-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
}

.burnout-status {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

/* Modal styles for adding habit / editing */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

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

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 90%;
  max-width: 460px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  transform: translateY(20px);
  transition: transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.modal-close:hover {
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  aside {
    width: 70px;
    padding: 2rem 0.5rem;
    align-items: center;
  }

  .logo-text, .nav-item span, .nav-footer span, .status-label {
    display: none;
  }

  .logo-container {
    margin-bottom: 2rem;
    justify-content: center;
  }

  .nav-item {
    justify-content: center;
    padding: 0.85rem;
  }

  .nav-item svg {
    margin: 0;
  }

  .nav-item:hover svg {
    transform: none;
  }

  main {
    margin-left: 70px;
    padding: 1.5rem;
    max-width: calc(100vw - 70px);
  }

  h1 {
    font-size: 1.75rem;
  }
}
