/* =========================================
   LIFEOS – GLOBAL STYLES  (Phase 8 Polish)
   style.css
   ========================================= */

/* ----- Google Fonts ----- */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

/* ----- CSS Reset & Variables ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Core palette */
  --bg-primary:    #0b0b10;
  --bg-secondary:  #13131e;
  --bg-card:       #1c1c2e;
  --bg-card-hover: #21213a;

  /* Accents */
  --accent-purple: #8b7cf8;
  --accent-blue:   #4f9cf9;
  --accent-green:  #3ecf8e;
  --accent-amber:  #f5a623;
  --accent-pink:   #e066a0;
  --accent-teal:   #38bdf8;

  /* Module colors */
  --school-color:       #3ecf8e;
  --productivity-color: #38bdf8;
  --notes-color:        #8b7cf8;
  --finance-color:      #f5a623;
  --creator-color:      #e066a0;

  /* Text */
  --text-primary: #eeeef7;
  --text-muted:   #7878a0;
  --border:       rgba(255,255,255,0.07);

  /* Layout */
  --sidebar-width: 234px;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ----- Base ----- */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;

  /* Subtle noise texture overlay */
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139,124,248,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(79,156,249,0.08) 0%, transparent 60%);
}

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

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,124,248,0.35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* Focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  /* Glass edge effect */
  box-shadow: 1px 0 0 0 rgba(255,255,255,0.04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 26px 20px 22px;
  border-bottom: 1px solid var(--border);
}

.brand-icon { font-size: 24px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  background: linear-gradient(100deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* Nav links */
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  transform: translateX(2px);
}

/* Active indicator pill */
.nav-item.active {
  background: rgba(139,124,248,0.15);
  color: var(--accent-purple);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent-purple);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--accent-purple);
}

.nav-icon { font-size: 17px; line-height: 1; }

.sidebar-footer {
  padding: 14px 20px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  letter-spacing: 0.3px;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================
   TOPBAR
   ========================================= */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,11,16,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.2px;
}

.topbar-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  line-height: 1;
}
.hamburger:hover { background: rgba(255,255,255,0.08); }

/* =========================================
   WELCOME BANNER
   ========================================= */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 28px 24px;
  gap: 16px;
}

.welcome-text h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  /* Entrance animation */
  animation: fadeUp 0.5s ease both;
}

.welcome-text p {
  font-size: 14px;
  color: var(--text-muted);
  animation: fadeUp 0.5s 0.08s ease both;
}

.welcome-time {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--accent-purple);
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  animation: fadeUp 0.5s 0.05s ease both;
  text-shadow: 0 0 40px rgba(139,124,248,0.4);
}

/* =========================================
   MODULE CARDS GRID
   ========================================= */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
  padding: 0 28px 26px;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);

  /* Staggered entrance */
  animation: fadeUp 0.5s ease both;
}

.module-card:nth-child(1) { animation-delay: 0.10s; }
.module-card:nth-child(2) { animation-delay: 0.16s; }
.module-card:nth-child(3) { animation-delay: 0.22s; }
.module-card:nth-child(4) { animation-delay: 0.28s; }
.module-card:nth-child(5) { animation-delay: 0.34s; }

/* Shimmer sweep on hover */
.module-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.04) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

.module-card:hover::after { transform: translateX(100%); }

/* Colored left accent bar */
.module-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.module-card.school::before       { background: var(--school-color); box-shadow: 2px 0 12px rgba(62,207,142,0.35); }
.module-card.productivity::before { background: var(--productivity-color); box-shadow: 2px 0 12px rgba(56,189,248,0.35); }
.module-card.notes::before        { background: var(--notes-color); box-shadow: 2px 0 12px rgba(139,124,248,0.35); }
.module-card.finance::before      { background: var(--finance-color); box-shadow: 2px 0 12px rgba(245,166,35,0.35); }
.module-card.creator::before      { background: var(--creator-color); box-shadow: 2px 0 12px rgba(224,102,160,0.35); }

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  background: var(--bg-card-hover);
}

.module-card.school:hover       { border-color: rgba(62,207,142,0.4); }
.module-card.productivity:hover { border-color: rgba(56,189,248,0.4); }
.module-card.notes:hover        { border-color: rgba(139,124,248,0.4); }
.module-card.finance:hover      { border-color: rgba(245,166,35,0.4); }
.module-card.creator:hover      { border-color: rgba(224,102,160,0.4); }

.card-icon {
  font-size: 30px;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.module-card:hover .card-icon { transform: scale(1.12) rotate(-4deg); }

.card-info { flex: 1; }

.card-info h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.1px;
}

.card-info p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
}

.module-card:hover .card-arrow {
  transform: translateX(5px);
  color: var(--text-primary);
}

/* =========================================
   QUICK STATS ROW
   ========================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 0 28px 48px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

.stat-card:nth-child(1) { animation-delay: 0.40s; }
.stat-card:nth-child(2) { animation-delay: 0.46s; }
.stat-card:nth-child(3) { animation-delay: 0.52s; }
.stat-card:nth-child(4) { animation-delay: 0.58s; }

/* Glow dot top-right */
.stat-card::after {
  content: '';
  position: absolute;
  top: 10px; right: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-purple);
  opacity: 0.5;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
  border-color: rgba(139,124,248,0.25);
}

.stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--accent-purple);
  letter-spacing: -1px;
  line-height: 1;
  text-shadow: 0 0 20px rgba(139,124,248,0.3);
}

/* =========================================
   OVERLAY (mobile sidebar backdrop)
   ========================================= */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition);
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 30px rgba(139,124,248,0.3); }
  50%       { text-shadow: 0 0 50px rgba(139,124,248,0.6); }
}

.welcome-time {
  animation: fadeUp 0.5s 0.05s ease both, pulse-glow 3s 1s ease-in-out infinite;
}

/* =========================================
   RESPONSIVE — TABLET  (≤ 900px)
   ========================================= */
@media (max-width: 900px) {
  .modules-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }
}

/* =========================================
   RESPONSIVE — MOBILE  (≤ 640px)
   ========================================= */
@media (max-width: 640px) {

  /* Sidebar slides in from left */
  .sidebar {
    transform: translateX(-100%);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }

  /* Main content takes full width */
  .main-content {
    margin-left: 0;
  }

  /* Show hamburger */
  .hamburger { display: flex; align-items: center; justify-content: center; }

  /* Topbar */
  .topbar { padding: 12px 16px; }
  .topbar-date { display: none; }    /* too cramped on small screens */

  /* Welcome banner stacks vertically */
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 16px 16px;
    gap: 8px;
  }

  .welcome-text h1 { font-size: 22px; }
  .welcome-time    { font-size: 32px; letter-spacing: -1.5px; }

  /* Cards single column */
  .modules-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 20px;
    gap: 12px;
  }

  /* Stats 2-column on mobile */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    padding: 0 16px 36px;
    gap: 10px;
  }

  .stat-value { font-size: 26px; }
}

/* =========================================
   RESPONSIVE — SMALL MOBILE  (≤ 380px)
   ========================================= */
@media (max-width: 380px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .welcome-text h1 { font-size: 19px; }
  .welcome-time    { font-size: 26px; }
}

/* =========================================
   MODULE PAGES — shared inner layout
   (used by school, productivity, notes, etc.)
   ========================================= */
.page-header {
  padding: 28px 28px 0;
  margin-bottom: 24px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.section-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin: 0 28px 20px;
  animation: fadeUp 0.4s ease both;
}

.section-panel h2 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* Inputs & buttons consistent across modules */
.lifeos-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.lifeos-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139,124,248,0.15);
}

.lifeos-input::placeholder { color: var(--text-muted); }

.lifeos-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.lifeos-btn:hover {
  background: #a093ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139,124,248,0.35);
}

.lifeos-btn:active { transform: translateY(0); }

.lifeos-btn.secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.lifeos-btn.secondary:hover {
  background: rgba(255,255,255,0.1);
  box-shadow: none;
}

.lifeos-btn.danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}

.lifeos-btn.danger:hover {
  background: rgba(239,68,68,0.25);
  box-shadow: none;
}

/* Tag/badge component */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.green  { background: rgba(62,207,142,0.15); color: var(--accent-green); }
.badge.blue   { background: rgba(79,156,249,0.15);  color: var(--accent-blue); }
.badge.purple { background: rgba(139,124,248,0.15); color: var(--accent-purple); }
.badge.amber  { background: rgba(245,166,35,0.15);  color: var(--accent-amber); }
.badge.pink   { background: rgba(224,102,160,0.15); color: var(--accent-pink); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .page-header { padding: 20px 16px 0; }
  .section-panel { margin: 0 16px 16px; padding: 18px; }
}
