/* ==========================================================================
   FocusFlow Core Stylesheet & Design System (css/main.css)
   ========================================================================== */

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

:root {
  /* --- HSL Color System --- */
  /* Neutral Palette (Slate/Indigo inspired) */
  --neutral-50: 220 14% 96%;
  --neutral-100: 220 13% 91%;
  --neutral-200: 220 13% 85%;
  --neutral-300: 220 12% 75%;
  --neutral-400: 220 11% 65%;
  --neutral-500: 220 10% 45%;
  --neutral-600: 220 9% 35%;
  --neutral-700: 220 9% 25%;
  --neutral-800: 220 9% 15%;
  --neutral-900: 220 9% 9%;

  /* Brand Accents default */
  --brand-primary: 245 80% 62%;     /* Indigo */
  --brand-primary-hover: 245 80% 55%;
  --brand-secondary: 263 70% 50%;   /* Purple */
  --brand-primary-hsl: 245, 80%, 62%;
  
  /* Priority Badges HSL values */
  --priority-urgent: 0 84% 60%;      /* Red */
  --priority-high: 27 96% 61%;       /* Orange */
  --priority-medium: 43 96% 56%;     /* Gold */
  --priority-low: 142 71% 45%;       /* Green */

  /* Semantic feedback states */
  --success: 142 71% 45%;
  --warning: 38 92% 50%;
  --danger: 0 84% 60%;
  --info: 199 89% 48%;

  /* --- Light Theme Tokens --- */
  --bg-app: hsl(var(--neutral-50));
  --bg-surface: rgba(255, 255, 255, 0.75);
  --bg-surface-hover: rgba(0, 0, 0, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.45);
  --border-color: rgba(0, 0, 0, 0.06);
  --border-color-focus: hsl(var(--brand-primary));
  --text-primary: hsl(var(--neutral-900));
  --text-secondary: hsl(var(--neutral-500));
  --text-muted: hsl(var(--neutral-400));
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);

  /* --- Dimensions & Spacing --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dynamic Pomo-State Accent Themes --- */
[data-timer-mode="focus"] {
  --brand-primary: 245 80% 62%;
  --brand-primary-hover: 245 80% 55%;
  --brand-secondary: 263 70% 50%;
  --brand-primary-hsl: 245, 80%, 62%;
}
[data-timer-mode="shortBreak"] {
  --brand-primary: 162 70% 45%;
  --brand-primary-hover: 162 70% 38%;
  --brand-secondary: 174 75% 40%;
  --brand-primary-hsl: 162, 70%, 45%;
}
[data-timer-mode="longBreak"] {
  --brand-primary: 330 80% 60%;
  --brand-primary-hover: 330 80% 52%;
  --brand-secondary: 345 75% 55%;
  --brand-primary-hsl: 330, 80%, 60%;
}

/* --- Dark Theme Overrides --- */
[data-theme="dark"] {
  --bg-app: hsl(var(--neutral-900));
  --bg-surface: rgba(22, 25, 35, 0.7);
  --bg-surface-hover: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(15, 17, 23, 0.45);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-focus: hsl(var(--brand-primary));
  --text-primary: hsl(var(--neutral-50));
  --text-secondary: hsl(var(--neutral-300));
  --text-muted: hsl(var(--neutral-500));
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Resets & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Layout Shell (Grid-based App Dashboard)
   ========================================================================== */
.app-container {
  display: grid;
  grid-template-rows: 64px 1fr;
  grid-template-columns: 240px 1fr;
  grid-template-areas: 
    "sidebar header"
    "sidebar main";
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 100%;
    grid-template-areas: 
      "header"
      "main";
  }
  .sidebar {
    display: none !important;
  }
}

/* --- Header Styles --- */
.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, hsl(var(--brand-primary)), hsl(var(--brand-secondary)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title svg {
  stroke: hsl(var(--brand-primary));
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Sidebar Styles --- */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  justify-content: space-between;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-left: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item:hover, .nav-item.active {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  border-left: 3px solid hsl(var(--brand-primary));
  padding-left: 9px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
}

/* --- Main Area Styles --- */
.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background-color: var(--bg-app);
}

/* ==========================================================================
   Generic Components & Helpers
   ========================================================================== */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

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

.btn-primary {
  background-color: hsl(var(--brand-primary));
  color: #fff;
  border-color: transparent;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* Dynamic priority tagging */
.badge-urgent {
  background-color: hsl(var(--priority-urgent) / 0.12);
  color: hsl(var(--priority-urgent));
}
.badge-high {
  background-color: hsl(var(--priority-high) / 0.12);
  color: hsl(var(--priority-high));
}
.badge-medium {
  background-color: hsl(var(--priority-medium) / 0.12);
  color: hsl(var(--priority-medium));
}
.badge-low {
  background-color: hsl(var(--priority-low) / 0.12);
  color: hsl(var(--priority-low));
}
