/* Azul HQ — App Styles */

:root {
  --nav-bg: #0D1B2A;
  --main-bg: #0F1E2E;
  --card-bg: #162534;
  --accent: #2E86C1;
  --accent2: #1B4F8A;
  --text: #F0F4F8;
  --muted: #8BA7C7;
  --border: rgba(46,134,193,0.18);
  --sidebar-width: 240px;
  --danger: #E74C3C;
  --success: #27AE60;
  --warning: #F39C12;
}

/* Personal HQ amber theme */
body.theme-personal {
  --nav-bg: #1C1008;
  --main-bg: #171009;
  --card-bg: #231608;
  --accent: #C47A2B;
  --accent2: #8B5210;
  --text: #F5EFE6;
  --muted: #C4A882;
  --border: rgba(196,122,43,0.18);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--main-bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, .word-of-day {
  font-family: 'DM Serif Display', Georgia, serif;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* Context toggle */
.context-toggle {
  display: flex;
  gap: 2px;
  margin-top: 0.75rem;
  background: var(--main-bg);
  border-radius: 6px;
  padding: 2px;
}

.context-btn {
  flex: 1;
  padding: 0.35rem 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.context-btn.active {
  background: var(--accent);
  color: white;
}

.context-btn:hover:not(.active) {
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(46,134,193,0.08);
}

body.theme-personal .nav-item:hover {
  background: rgba(196,122,43,0.08);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(46,134,193,0.12);
  border-left-color: var(--accent);
}

body.theme-personal .nav-item.active {
  background: rgba(196,122,43,0.12);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

/* Mobile top bar */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.page-container {
  padding: 2rem;
  max-width: 1200px;
}

/* Page Header */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.page-header .page-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

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

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
}

.card-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(46,134,193,0.15);
  color: var(--accent);
}

body.theme-personal .card-badge {
  background: rgba(196,122,43,0.15);
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

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

/* Stat displays */
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.stat-row {
  display: flex;
  gap: 2rem;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Lists */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.list-content {
  flex: 1;
}

.list-primary {
  color: var(--text);
  font-size: 0.875rem;
}

.list-secondary {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* File icon */
.file-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.file-link:hover .list-primary {
  color: var(--accent);
}

/* Points */
.points {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* Task checkbox */
.task-check {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 3px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.task-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

/* Section headers */
.section-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 600;
  padding: 0.75rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.empty-state-text {
  font-size: 0.85rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 0.75rem 0;
  padding-left: 1rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 1rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card-bg);
  margin-left: -4px;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.timeline-title {
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 2px;
}

.timeline-source {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Source colors */
.source-outlook { color: #2AA198; }
.source-google { color: var(--accent); }
.source-icloud { color: #9B59B6; }

.dot-outlook { background: #2AA198; }
.dot-google { background: var(--accent); }
.dot-icloud { background: #9B59B6; }

/* Daily win */
.win-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.win-indicator {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.win-indicator.yes {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.win-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Kanban */
.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
}

.kanban-column {
  flex: 1;
  min-width: 200px;
}

.kanban-column-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 0.75rem;
}

.kanban-card {
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Word of the day */
.word-of-day {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: capitalize;
}

/* Note compose inputs */
.note-input, .note-textarea {
  width: 100%;
  background: var(--main-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 0.5rem;
}

.note-input:focus, .note-textarea:focus {
  border-color: var(--accent);
}

.note-input::placeholder, .note-textarea::placeholder {
  color: var(--muted);
}

.note-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Small filter button */
.btn {
  background: var(--card-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn:hover:not(.active) {
  color: var(--text);
  border-color: var(--muted);
}

/* Primary button */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Action toast notification */
.action-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.625rem 1.25rem;
  font-size: 0.85rem;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.action-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding-top: 48px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .stat-row {
    flex-wrap: wrap;
  }

  .kanban {
    flex-direction: column;
  }

  .kanban-column {
    min-width: auto;
  }

  .page-container {
    padding: 1rem;
  }

  /* Ensure touch targets */
  .nav-item {
    min-height: 44px;
  }

  .task-check {
    width: 20px;
    height: 20px;
  }

  .win-indicator {
    width: 24px;
    height: 24px;
  }

  .btn-primary {
    min-height: 44px;
    padding: 0.625rem 1.5rem;
  }
}

/* --- Login Screen --- */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--main-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-card .g_id_signin {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* Logout button in mobile topbar */
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
}
.logout-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Sidebar sign-out link */
.sidebar-logout {
  color: var(--muted);
  text-decoration: none;
  margin-left: 0.75rem;
  opacity: 0.7;
}
.sidebar-logout:hover {
  color: var(--text);
  opacity: 1;
}
