/* ============================================================
   MAIN.CSS
   Design system tokens, base reset, app shell, header.
   This file is the foundation — all other CSS builds on top.
   ============================================================ */


/* ——————————————————————————————————————————————————————————
   DESIGN SYSTEM — CSS Custom Properties
   Single source of truth for all colors, spacing, and type.
   To retheme the dashboard, change values here only.
   —————————————————————————————————————————————————————————— */
:root {
  /* Background palette */
  --bg-main:    #f9f3f3;   /* page canvas */
  --bg-card:    #ffffff;   /* card surfaces */
  --bg-panel:   #f6efea;   /* soft panel sections */
  --bg-sidebar: #faf5f5;   /* sidebar background */

  /* Accent palette — from pretty-ugc-dashboard-spec.md */
  --blush:    #e7cfcf;
  --rose:     #d9b4b4;
  --peach:    #edd8cc;
  --beige:    #ece6de;
  --sage:     #dfe6da;
  --lavender: #e7deee;

  /* Text scale */
  --text-primary:   #1f1f1f;
  --text-secondary: #7e7a76;
  --text-muted:     #9c9793;

  /* Elevation */
  --shadow-card:  0 2px 14px rgba(0,0,0,0.055);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.09);

  /* Structural */
  --sidebar-w:   224px;
  --pad:         28px;      /* main content horizontal padding */
  --radius-card: 16px;
  --radius-sm:   10px;

  /* Typography */
  --serif: 'Playfair Display', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}


/* ——————————————————————————————————————————————————————————
   RESET & BASE
   —————————————————————————————————————————————————————————— */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a      { color: inherit; text-decoration: none; }
ul     { list-style: none; }
button { font-family: var(--sans); border: none; background: none; cursor: pointer; }


/* ——————————————————————————————————————————————————————————
   APP SHELL — Outer flex wrapper
   Sidebar sits left; .main fills the remaining width.
   —————————————————————————————————————————————————————————— */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}


/* ——————————————————————————————————————————————————————————
   MAIN AREA — Scrollable content column
   —————————————————————————————————————————————————————————— */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;   /* prevents flex blowout on narrow screens */
}


/* ——————————————————————————————————————————————————————————
   HEADER — Persistent across all pages
   —————————————————————————————————————————————————————————— */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px var(--pad) 24px;
  background: var(--bg-main);
  flex-shrink: 0;
}

.header-greeting {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.header-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 300;
  margin-top: 4px;
}

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

.header-tagline {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.16s ease;
}
.header-profile:hover { background: rgba(231,207,207,0.28); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blush), var(--rose));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 14px;
  color: #fff;
  font-weight: 500;
  flex-shrink: 0;
}

.chevron {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}


/* ——————————————————————————————————————————————————————————
   CONTENT AREA — Dynamic page injection target
   Pages from /pages/ are fetched and rendered here.
   —————————————————————————————————————————————————————————— */
#content-area {
  padding: 0 var(--pad) var(--pad);
  flex: 1;
}

/* Soft fade during page transitions */
#content-area.loading {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}


/* ——————————————————————————————————————————————————————————
   CONDITIONAL HEADER VISIBILITY
   Greeting + subline only appear on the Dashboard page.
   navigation.js sets data-page on .main after each load.
   —————————————————————————————————————————————————————————— */
.main:not([data-page="dashboard"]) .header {
  padding-top: 18px;
  padding-bottom: 14px;
}


/* ——————————————————————————————————————————————————————————
   PROFILE DROPDOWN
   —————————————————————————————————————————————————————————— */
.header-profile {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid rgba(231,207,207,0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
  z-index: 200;
  overflow: hidden;
}

.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pd-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
}

.pd-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  font-size: 13px;
}

.pd-name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-divider {
  height: 1px;
  background: rgba(231,207,207,0.28);
}

.pd-items {
  padding: 4px 6px;
}

.pd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  user-select: none;
}

.pd-item:hover {
  background: rgba(231,207,207,0.25);
  color: var(--text-primary);
}

.pd-item svg {
  flex-shrink: 0;
  opacity: 0.65;
}

.pd-logout-item { color: #b05050; }

.pd-logout-item:hover {
  background: rgba(217,80,80,0.08);
  color: #c06060;
}
