/* =============================================
   LoveBug — main.css
   Global variables, reset, utilities
   ============================================= */

:root {
  /* Brand Colors */
  --primary: #E94057;
  --primary-dark: #c73347;
  --primary-light: #ff6b85;
  --accent: #f5a623;
  --success: #00c853;
  --danger: #ff5252;
  --info: #448AFF;

  /* Backgrounds */
  --bg-screen: #f8f9fa;
  --bg-card: #ffffff;
  --bg-top-bar: #ffffff;
  --bg-overlay: rgba(0,0,0,0.5);

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #757575;
  --text-muted: #aaaaaa;
  --text-white: #ffffff;

  /* Borders & Dividers */
  --divider: #eeeeee;
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-xl: 24px;
  --border-radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
  --shadow-card: 0 8px 32px rgba(233,64,87,0.12);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Fonts */
  --font-display: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* Nav */
  --nav-height: 64px;
  --sidebar-width: 72px;
}

/* Dark Mode — controlled entirely by dark-mode.js via .dark-mode class on <html>
   DO NOT use @media (prefers-color-scheme: dark) here — it would fight the user's
   manual toggle, re-applying dark mode even when user explicitly chose light mode. */
.dark-mode {
  --bg-screen:       #121212;
  --bg-card:         #1e1e1e;
  --bg-top-bar:      #1a1a1a;
  --divider:         #333333;
  --text-primary:    #ffffff;
  --text-secondary:  #aaaaaa;
  --text-muted:      #666666;
}


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

html {
  scroll-behavior: smooth;
  overscroll-behavior: none; /* prevent URL bar hide/show bounce */
}

body {
  font-family: var(--font-body);
  background: var(--bg-screen);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior: none; /* prevent URL bar hide/show bounce */
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---- Buttons ---- */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 4px 20px rgba(233,64,87,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(233,64,87,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; pointer-events: none; }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--divider);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-secondary:hover { background: #ddd; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { transform: scale(1.08); }
.btn-icon:active { transform: scale(0.96); }

/* ---- Loader ---- */
.btn-loader { animation: pulse 1s infinite; }
.hidden { display: none !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: var(--bg-card);
  padding: 12px 24px;
  border-radius: var(--border-radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ---- Input ---- */
.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-screen);
  border: 1.5px solid var(--divider);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--text-muted); }

/* ---- Chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid var(--divider);
  border-radius: var(--border-radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  user-select: none;
}
.chip.selected, .chip:hover {
  border-color: var(--primary);
  background: rgba(233,64,87,0.08);
  color: var(--primary);
}

/* ---- Loading Overlay ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8888;
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-top-bar);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  gap: 4px;
}

.sidebar .logo-small {
  width: 36px; height: 36px;
  object-fit: contain;
  margin-bottom: 16px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 56px;
  padding: 10px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; transition: stroke var(--transition); }
.nav-item.active, .nav-item:hover { background: rgba(233,64,87,0.1); color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); }

.nav-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  max-width: 960px;
  margin-right: auto;
}

/* ---- Page Sections ---- */
.page-section {
  display: none;
  min-height: 100vh;
  padding: 24px;
}
.page-section.active { display: block; }

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
.animate-in { animation: fadeInUp 0.4s ease forwards; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 3px; }

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text-primary);
  font-weight: 700;
}
.section-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--border-radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  animation: fadeInUp 0.3s ease;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.modal-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-top: 1px solid var(--divider);
    padding: 0 8px;
    z-index: 9000;  /* above everything including feed */
  }
  .sidebar .logo-small { display: none; }
  .main-content {
    margin-left: 0;
    padding-bottom: 60px; /* space for fixed bottom nav so last content isn't hidden */
  }
  .nav-item { width: auto; padding: 8px 16px; font-size: 11px; }
}
