/* ============================================
   Clear Haven — Global Styles & CSS Variables
   ============================================ */

:root {
  /* ========== Clear Haven Brand Colors ========== */
  --color-charcoal: #25282A;
  --color-green: #00FA30;
  --color-blue: #3671FC;
  --color-light-blue: #1BE8FD;
  --color-cream: #EEEADF;
  --color-white: #FFFFFF;
  --color-light-gray: #F5F5F5;

  /* Colors — Primary (mapped from brand) */
  --primary-50: rgba(0, 250, 48, 0.06);
  --primary-100: rgba(0, 250, 48, 0.12);
  --primary-200: rgba(0, 250, 48, 0.2);
  --primary-300: rgba(0, 250, 48, 0.35);
  --primary-400: rgba(0, 250, 48, 0.6);
  --primary-500: #00FA30;
  --primary-600: #00FA30;
  --primary-700: #00d628;
  --primary-800: #00b020;
  --primary-900: #008a19;

  /* Colors — Neutral (mapped from brand) */
  --gray-50: var(--color-cream);
  --gray-100: var(--color-light-gray);
  --gray-200: #E0DDD7;
  --gray-300: #D0CDC7;
  --gray-400: #888888;
  --gray-500: #6b6b6b;
  --gray-600: #4a4a4a;
  --gray-700: #3a3a3a;
  --gray-800: var(--color-charcoal);
  --gray-900: var(--color-charcoal);

  /* Colors — Status */
  --success-50: rgba(0, 250, 48, 0.08);
  --success-500: #00FA30;
  --success-600: #00d628;
  --success-700: #00b020;

  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  --info-50: rgba(54, 113, 252, 0.08);
  --info-500: var(--color-blue);
  --info-600: #2a5fd4;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Typography — Clear Haven: Arial Nova Light */
  --font-sans: 'Arial Nova Light', 'Arial Nova', Arial, Helvetica, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.95rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --leading-tight: 1.1;
  --leading-normal: 1.6;
  --leading-relaxed: 1.625;

  --font-normal: 300;
  --font-medium: 300;
  --font-semibold: 400;
  --font-bold: 400;

  /* Borders — Clear Haven: 12px cards, 100px pills */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --radius-2xl: 12px;
  --radius-full: 100px;

  --border-color: #E0DDD7;

  /* Shadows — Clear Haven: subtle depth */
  --shadow-sm: 0 1px 4px rgba(37, 40, 42, 0.04);
  --shadow-md: 0 2px 12px rgba(37, 40, 42, 0.06);
  --shadow-lg: 0 4px 20px rgba(37, 40, 42, 0.08);
  --shadow-xl: 0 8px 30px rgba(37, 40, 42, 0.1);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --max-content-width: 1200px;

  /* Transitions — Clear Haven: 0.2s ease */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-charcoal);
  background-color: var(--color-cream);
  min-height: 100vh;
  font-weight: 300;
  letter-spacing: -0.01em;
}

a {
  color: var(--color-blue);
  text-decoration: none;
}

a:hover {
  color: var(--color-blue);
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: 300;
  color: var(--color-charcoal);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* ============================================
   App Layout
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-charcoal);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: var(--space-6);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo {
  width: 40px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: var(--space-4);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  color: var(--gray-300);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  color: white;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--color-green);
  background: rgba(0, 250, 48, 0.1);
}

.sidebar-edit-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px;
  margin-left: auto;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.sidebar-link:hover .sidebar-edit-btn,
.sidebar-link.active .sidebar-edit-btn {
  opacity: 1;
}

.sidebar-edit-btn:hover {
  color: var(--color-white);
}

.sidebar-link i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* Sidebar user profile */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-green);
  color: var(--color-charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 400;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  color: var(--gray-200);
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-sub {
  color: var(--gray-500);
  font-size: 0.7rem;
  line-height: 1.2;
}

.sidebar-logout-btn {
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-header-left h1 {
  font-size: var(--text-2xl);
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: var(--space-1);
}

.breadcrumb a {
  color: var(--gray-500);
}

.breadcrumb a:hover {
  color: var(--color-blue);
}

.breadcrumb-separator {
  color: var(--gray-300);
}

.page-body {
  flex: 1;
  padding: var(--space-8);
}

/* ============================================
   Tabs
   ============================================ */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  gap: 0;
  background: var(--color-white);
  padding: 0 var(--space-8);
}

.tab-button {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.tab-button:hover {
  color: var(--gray-700);
}

.tab-button.active {
  color: var(--color-charcoal);
  border-bottom-color: var(--color-green);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   Utilities
   ============================================ */

.text-muted { color: var(--gray-500); }
.text-small { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gray-700);
  cursor: pointer;
  padding: var(--space-2);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
