/* ==========================================================
   GCRAJAN — Global Design System
   Theme: Warm Minimalism + Playful Geometry
   ========================================================== */

/* --- Design Tokens --- */
:root {
  /* Backgrounds */
  --bg-primary: #FEFAF6;
  --bg-secondary: #FFF5EE;
  --bg-card: #FFFFFF;
  --bg-footer: #1A1A2E;

  /* Accents */
  --accent-coral: #FF6B6B;
  --accent-coral-hover: #E85D5D;
  --accent-lavender: #A78BFA;
  --accent-sage: #6BCB77;
  --accent-amber: #FBBF24;
  --accent-sky: #38BDF8;

  /* Text */
  --text-heading: #1A1A2E;
  --text-body: #4A4A68;
  --text-muted: #9CA3AF;
  --text-inverse: #FEFAF6;

  /* Borders & Shadows */
  --border-light: rgba(26, 26, 46, 0.08);
  --border-medium: rgba(26, 26, 46, 0.12);
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 4px 20px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 8px 40px rgba(26, 26, 46, 0.12);
  --shadow-coral: 0 8px 30px rgba(255, 107, 107, 0.25);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 100px;
  --radius-round: 50%;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.2s;
  --duration-normal: 0.35s;
  --duration-slow: 0.5s;

  /* Status */
  --success-color: #10b981;
  --error-color: #ef4444;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "DM Sans", "Inter", system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-body);
  overflow-x: hidden;
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol {
  list-style: none;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-coral);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-coral-hover);
}

/* --- Skip to Content (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-coral);
  color: #fff;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-pill);
  font-weight: 600;
  z-index: 10000;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-md);
}

/* ==========================================================
   PAGE LOADER
   ========================================================== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  display: flex;
  gap: 8px;
  align-items: center;
}

.loader-dot {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-round);
  animation: loaderBounce 0.6s var(--ease-bounce) infinite alternate;
}

.loader-dot:nth-child(1) {
  background: var(--accent-coral);
  animation-delay: 0s;
}

.loader-dot:nth-child(2) {
  background: var(--accent-lavender);
  animation-delay: 0.15s;
}

.loader-dot:nth-child(3) {
  background: var(--accent-sage);
  animation-delay: 0.3s;
}

@keyframes loaderBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-18px) scale(1.15); }
}

/* ==========================================================
   HEADER
   ========================================================== */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 0 var(--space-xl);
  height: 68px; /* Strict height limit to prevent layout shifts */
  display: flex;
  align-items: center;
  background: rgba(254, 250, 246, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow var(--duration-normal) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}

.main-header.scrolled {
  box-shadow: var(--shadow-sm);
  background: rgba(254, 250, 246, 0.95);
}

.header-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Logo --- */
.logo a {
  text-decoration: none;
  color: var(--text-heading);
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.logo a:hover {
  transform: scale(1.03);
}

.logo img {
  height: 32px;
  width: auto;
  transition: transform var(--duration-normal) var(--ease-bounce);
}

.logo a:hover img {
  transform: rotate(-12deg) scale(1.1);
}

/* ==========================================================
   NAVIGATION
   ========================================================== */

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: .85rem;
    font-family: "DM Sans", sans-serif;
    font-weight: 500;
    font-size: .95rem;
    color: var(--text-body);
    padding: .4rem .85rem;
    border-radius: var(--radius-pill);
    transition: color var(--duration-fast),
                background var(--duration-normal) var(--ease-out);
}

.nav-links a:hover {
    color: var(--text-heading);
    background: rgba(255,107,107,.08);
}

.nav-links a.active {
    color: var(--accent-coral);
    background: rgba(255,107,107,.10);
    font-weight: 600;
}

.nav-mobile-icon {
    display: none;
    width: 20px;
    text-align: center;
}

/* ==========================================================
   AUTH LINKS
   ========================================================== */

.auth-links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.auth-links .login-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-body);
    font-weight: 500;
    font-size: .95rem;
    transition: color var(--duration-fast);
}

.auth-links .login-link:hover {
    color: var(--accent-coral);
}

.auth-links .register-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.2rem;
    background: var(--accent-coral);
    color: #fff;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: .9rem;
    transition: all var(--duration-normal) var(--ease-out);
}

.auth-links .register-btn:hover {
    background: var(--accent-coral-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-coral);
}

/* ==========================================================
   DESKTOP PROFILE DROPDOWN
   ========================================================== */

.profile-dropdown-wrapper {
    position: relative;
}

.profile-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .3rem .75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-pill);
    transition: background var(--duration-fast);
}

.profile-dropdown-trigger:hover {
    background: rgba(26,26,46,.04);
}

.profile-dropdown-trigger img {
    width: 32px;
    height: 32px;
    object-fit: fill;
    border-radius: 50%;
    border: 2px solid var(--accent-coral);
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-fast);
}

.profile-dropdown-trigger:hover img {
    transform: scale(1.05);
}

.profile-username {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-heading);
    font-size: .9rem;
    font-weight: 600;
}

.profile-arrow {
    font-size: .75rem;
    color: var(--text-muted);
    transition: transform var(--duration-fast);
}

.profile-dropdown-trigger[aria-expanded="true"] .profile-arrow {
    transform: rotate(180deg);
    color: var(--accent-coral);
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: rgba(255,255,255);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: .6rem 0;
    z-index: 1010;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);

    transition: all var(--duration-normal) var(--ease-out);
}

.profile-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-header {
    padding: .6rem 1.2rem;
}

.dropdown-user-name {
    font-family: "Outfit", sans-serif;
    /* font-weight: 700; */
    color: var(--text-heading);
}

.dropdown-user-email {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-word;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: .4rem 0;
}

.dropdown-item,
.logout-link-dropdown {
        display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem 1.2rem;
    text-decoration: none;
    transition: all .25s ease;
    font-family: "DM Sans", sans-serif;
    font-weight: 500;
    font-size: .95rem;
}

.dropdown-item {
    color: var(--text-body);
}

.dropdown-item i,
.logout-link-dropdown i {
    width: 16px;
    text-align: center;
}

.dropdown-item i {
    color: var(--text-muted);
}

.dropdown-item:hover {
  background: rgba(255,107,107,.06);
    /* color: var(--accent-coral); */
    padding-left: 1.4rem;

    color: var(--text-heading);
    /* background: rgba(255,107,107,.08); */
}

.dropdown-item:hover i {
    color: var(--accent-coral);
}

.logout-link-dropdown {
    color: var(--error-color);
}

.logout-link-dropdown i {
    color: var(--error-color);
}

.logout-link-dropdown:hover {
    background: rgba(239,68,68,.06);
    padding-left: 1.4rem;
}

/* ==========================================================
   PROFILE VISIBILITY
   ========================================================== */

.desktop-profile {
    display: inline-block;
}

.mobile-profile-panel {
    display: none;
}

/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 820px) {

    .desktop-profile {
        display: none;
    }

    .nav-mobile-icon {
        display: inline-flex;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
    }

    .nav-links a {
        width: 100%;
        padding: 0.5rem 0.75rem;
        border-radius: var(--radius-md);
        font-size: 1.05rem;
    }

    .mobile-profile-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        /* border-top: 1px solid var(--border-light); */
        padding-top: var(--space-sm);
        margin-top: auto; /* pushes panel to bottom */
        gap: .35rem;
    }

    .mobile-profile-panel a {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-decoration: none;
        color: var(--text-body);
        font-weight: 500;
        border-radius: var(--radius-md);
        transition: background .2s ease;
        font-size: 1.15rem;
        padding: 0.5rem 0.75rem;
        width: 100%;
    }

    .mobile-profile-panel a:hover {
        background: rgba(255,107,107,.06);
    }

    .mobile-profile-panel a i {
        width: 20px;
        text-align: center;
    }

    .mobile-logout {
        color: var(--error-color) !important;
    }

    .mobile-profile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: absolute;
        padding: var(--space-md);
        bottom: 0rem;
        left: 0rem;
        width: 100%;
        border-top: 1px solid var(--border-light);
    }

    .mobile-profile-header img {
        width: 48px;
        height: 48px;
        object-fit: cover;
        border-radius: 50%;
        border: 2px solid var(--accent-coral);
    }

    .mobile-profile-header strong {
        display: block;
        color: var(--text-heading);
        font-size: .95rem;
    }

    .mobile-profile-header span {
        display: block;
        color: var(--text-muted);
        font-size: .8rem;
        word-break: break-word;
    }
}

/* --- Hamburger --- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  position: relative;
}

.hamburger-bar {
  display: block;
  width: 24px;
  height: 2.5px;
  background-color: var(--text-heading);
  border-radius: 2px;
  transition: all var(--duration-normal) var(--ease-bounce);
}

.hamburger-bar:not(:last-child) {
  margin-bottom: 5px;
}

/* Hamburger → X animation */
.menu-toggle.is-active .hamburger-bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.menu-toggle.is-active .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle.is-active .hamburger-bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* ==========================================================
   FOOTER
   ========================================================== */
.main-footer {
  background: var(--bg-footer);
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: hidden;
}

.footer-wave {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: -2px;
}

.footer-body {
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-xl) var(--space-xl);
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-3xl);
}

.footer-brand p {
  margin-top: var(--space-md);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 280px;
}

.footer-brand .logo a {
  color: var(--text-inverse);
  font-size: 1.2rem;
}

.footer-nav-title {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  margin-bottom: var(--space-lg);
  letter-spacing: 0.02em;
}

.footer-nav-list {
  display: flex;
  align-items: center;
  gap: 4rem;
}

.footer-nav-list li {
  margin-bottom: var(--space-sm);
}

.footer-nav-list a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  transition: color var(--duration-fast), padding-left var(--duration-fast);
}

.footer-nav-list a:hover {
  color: var(--accent-coral);
  padding-left: 4px;
}

.footer-social-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.footer-social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  transition: all var(--duration-normal) var(--ease-out);
}

.footer-social-link:hover {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  color: #fff;
  transform: translateY(-3px);
}

.footer-bottom {
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.footer-bottom-left {
  color: rgba(255, 255, 255, 0.5);
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  transition: color var(--duration-fast);
}

.back-to-top:hover {
  color: var(--accent-coral);
}

/* ==========================================================
   SCROLL REVEAL ANIMATION
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ==========================================================
   UTILITY CLASSES
   ========================================================== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

.text-center { text-align: center; }
.text-coral { color: var(--accent-coral); }
.text-lavender { color: var(--accent-lavender); }
.text-sage { color: var(--accent-sage); }

/* ==========================================================
   TOAST NOTIFICATIONS (kept from existing)
   ========================================================== */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-coral);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  color: var(--text-heading);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s var(--ease-bounce);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--error-color); }
.toast.info { border-left-color: var(--accent-sky); }

.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--error-color); }
.toast.info i { color: var(--accent-sky); }

/* ==========================================================
   RESPONSIVE — MOBILE FIRST
   ========================================================== */

/* Tablet & below — Mobile nav */
@media (max-width: 820px) {
  .main-header {
    padding: var(--space-md);
  }

  .main-nav {
    display: none;
    position: fixed;
    top: 0;
    right: 0%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    /* height: 100dvh; */
    background: var(--bg-primary);
    flex-direction: column;
    align-items: flex-start;
    /* justify-content: center; */
    padding: var(--space-3xl) var(--space-xl);
    gap: var(--space-lg);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
    transition: right var(--duration-slow) var(--ease-out);
    z-index: 999;
  }

  .main-nav.active {
    /* right: 0; */
    display: flex;
  }

  .auth-links {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    width: 100%;
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-sm);
    gap: .35rem;
  }

  .auth-links > img {
    width: 48px !important;
    height: 48px !important;
  }

  .login-link {
    display: flex !important;
    gap: .85rem !important;
    font-family: "DM Sans", sans-serif;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 1.05rem !important;
  }

  .menu-toggle {
    display: block;
  }

  /* Overlay when mobile nav is open */
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.3);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--duration-normal);
  }

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

  /* Responsive dropdown styling inside mobile drawer */
  .profile-dropdown-wrapper {
    width: 100%;
  }

  .profile-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(26, 26, 46, 0.03);
    border: 1px solid var(--border-light);
  }

  .profile-dropdown-menu {
    position: static;
    width: 100%;
    min-width: unset;
    box-shadow: none;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border-medium);
    padding: 0.2rem 0;
    margin-top: 0.4rem;
    transform: none;
    opacity: 1;
    display: none;
    visibility: visible;
    pointer-events: auto;
  }

  .profile-dropdown-menu.active {
    display: block;
  }

  .dropdown-item, .logout-link-dropdown {
    padding: 0.5rem 1.2rem;
  }

  .dropdown-header {
    padding: 0.4rem 1.2rem;
  }
}

/* Footer responsive */
@media (max-width: 768px) {
  .footer-body {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    padding: var(--space-2xl) var(--space-lg) var(--space-lg);
  }

  .footer-brand p {
    max-width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
    padding: var(--space-md) var(--space-lg);
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .container {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }
}