/* ==========================================================================
   HABITFLOW — COMPONENTS (App Shell, Landing, Cards, Calendar, Analytics)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. APP SHELL LAYOUT (Sidebar + Main Content)
   -------------------------------------------------------------------------- */

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

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

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 2px 5px rgba(79, 70, 229, 0.3);
}

.sidebar-content {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-section-title {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  width: 100%;
}

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

.nav-link svg {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-link:hover {
  background-color: var(--surface-muted);
  color: var(--text);
}

.nav-link:hover svg {
  color: var(--text);
}

.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-link.active svg {
  color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.725rem;
  background-color: var(--primary-subtle);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.user-profile-widget:hover {
  background-color: var(--surface-muted);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
}

.topbar-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Notifications Dropdown */
.notification-bell-wrap {
  position: relative;
}

.bell-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.bell-btn:hover {
  background-color: var(--surface-muted);
  color: var(--text);
}

.bell-indicator {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 120;
}

.notifications-dropdown.active {
  display: block;
}

.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-list {
  max-height: 280px;
  overflow-y: auto;
  list-style: none;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.825rem;
}

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

/* Page Body */
.app-content {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   2. HABIT CARDS & LIST (Today's Checklist & Management)
   -------------------------------------------------------------------------- */

.habit-checklist-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  margin-bottom: 12px;
}

.habit-checklist-card:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-sm);
}

.habit-checklist-card.is-completed {
  background-color: #F8FAFC;
  opacity: 0.88;
}

.habit-checklist-card.is-completed .habit-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.habit-check-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.habit-icon-pill {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.habit-meta {
  flex: 1;
  min-width: 0;
}

.habit-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.habit-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-details-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.habit-streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #EA580C;
  font-size: 0.775rem;
}

.habit-check-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Habit Management Grid Card */
.habit-grid-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
  position: relative;
}

.habit-grid-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
  transform: translateY(-2px);
}

.habit-grid-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.habit-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.habit-grid-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  font-size: 0.825rem;
}

.habit-grid-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Category Filter Pills */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  background-color: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-pill:hover {
  background-color: var(--surface-muted);
  color: var(--text);
}

.filter-pill.active {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   3. CALENDAR MATRIX
   -------------------------------------------------------------------------- */

.calendar-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}

.calendar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.calendar-month-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

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

.cal-weekday {
  text-align: center;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
}

.cal-day-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.cal-day-cell:hover:not(.empty) {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.cal-day-cell.empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.cal-day-cell.is-today {
  border: 2px solid var(--primary);
}

.cal-day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.cal-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
}

.status-complete { background: var(--success-light); color: var(--success-dark); }
.status-partial { background: var(--warning-light); color: var(--warning-dark); }
.status-missed { background: #F1F5F9; color: var(--text-muted); }
.status-future { background: transparent; color: var(--text-subtle); }

/* --------------------------------------------------------------------------
   4. ACHIEVEMENTS & BADGES
   -------------------------------------------------------------------------- */

.badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all var(--transition-fast);
  position: relative;
}

.badge-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.badge-card.is-locked {
  background: #FAFAFA;
  opacity: 0.75;
}

.badge-icon-frame {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

.badge-card.is-locked .badge-icon-frame {
  background: #E2E8F0;
  color: #94A3B8;
  box-shadow: none;
}

.badge-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.badge-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  min-height: 38px;
}

.badge-status-tag {
  margin-top: auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   5. PUBLIC LANDING PAGE STYLES
   -------------------------------------------------------------------------- */

.landing-nav {
  height: 72px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.landing-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.landing-nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
}

.landing-nav-links a:hover {
  color: var(--text);
}

.hero-section {
  padding: 80px 24px 60px;
  text-align: center;
  max-width: 1080px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}

.hero-headline {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: #0F172A;
  margin-bottom: 20px;
}

.hero-subhead {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #475569;
  max-width: 720px;
  margin: 0 auto 36px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 50px;
  flex-wrap: wrap;
}

.hero-preview-container {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
  padding: 16px;
  overflow: hidden;
  max-width: 1040px;
  margin: 0 auto;
}

.features-section {
  padding: 80px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-tag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 8px;
  text-align: center;
}

.section-heading {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.025em;
}

.section-subhead {
  font-size: 1.05rem;
  text-align: center;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 48px;
}

.feature-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  transition: all var(--transition-fast);
}

.feature-box:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.feature-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

/* Auth split screen */
.auth-split-wrapper {
  display: flex;
  min-height: 100vh;
}

.auth-split-left {
  flex: 1;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
  color: #FFFFFF;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-split-right {
  width: 520px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
}

@media (max-width: 900px) {
  .auth-split-left { display: none; }
  .auth-split-right { width: 100%; max-width: 520px; margin: 0 auto; }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-block;
  }
  .hero-headline {
    font-size: 2.25rem;
  }
  .app-content {
    padding: 20px 16px;
  }
}
