/* =========================
   GLOBAL THEME

   Shared colors, fonts, and
   page basics for the whole app.
   ========================= */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap");

:root {
  --bg-deep: #0b1020;
  --bg-mid: #141a33;
  --text: #f4f1ff;
  --muted: #c5bddb;
  --accent: #7ee0c8;
  --accent-2: #8b7cff;
  --card: rgba(22, 28, 54, 0.62);
  --stroke: rgba(255, 255, 255, 0.16);
  --danger: #ff8aa0;
  --radius: 24px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --glass-bg: rgba(18, 24, 48, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --sidebar-width: 240px;
  --right-sidebar-width: 300px;
  --feed-width: 680px;
  --transition: 0.25s ease;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

/* =========================
   FLASH MESSAGES
   ========================= */

.flash-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 24px));
}

.flash {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: flash-in 0.3s ease;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-error {
  background: #5a2433;
  color: #ffd5dd;
}

.flash-success {
  background: #1d4a3c;
  color: #c8ffe8;
}

/* =========================
   GLASS PANEL
   ========================= */

.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* =========================
   APP SHELL LAYOUT
   ========================= */

.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
}

/* =========================
   SIDEBAR
   ========================= */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  animation: page-enter 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 16px;
}

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

.brand-text {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--glass-highlight);
  color: var(--text);
  text-decoration: none;
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(126, 224, 200, 0.15), rgba(139, 124, 255, 0.15));
  border-color: rgba(126, 224, 200, 0.3);
  color: var(--accent);
}

.nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-text {
  white-space: nowrap;
}

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

.logout-form {
  margin: 0;
}

.logout-btn {
  color: var(--danger);
}

.logout-btn:hover {
  background: rgba(255, 138, 160, 0.1);
  color: var(--danger);
}

/* =========================
   MAIN CONTENT
   ========================= */

.main-content {
  flex: 1;
  min-width: 0;
  animation: page-enter 0.3s ease;
}

/* =========================
   PAGE ENTER ANIMATION
   ========================= */

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    overflow-x: auto;
  }

  .sidebar-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding: 0 12px 0 0;
    flex-shrink: 0;
  }

  .brand-text {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
  }

  .nav-item {
    padding: 8px 10px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .nav-item:hover {
    transform: none;
  }

  .nav-text {
    font-size: 0.8rem;
  }

  .sidebar-footer {
    border-top: none;
    padding-top: 0;
    flex-shrink: 0;
  }

  .logout-btn {
    padding: 8px 10px;
  }
}

@media (max-width: 600px) {
  .nav-text {
    display: none;
  }

  .nav-item {
    padding: 8px;
    justify-content: center;
  }

  .nav-icon {
    font-size: 1.3rem;
  }
}