/* ==========================================
   IMPORTS
========================================== */
@import url("https://fonts.googleapis.com/css2?family=Capriola&family=Poppins:wght@400;500;600;700&display=swap");

/* ==========================================
   CSS VARIABLES
========================================== */

:root {
  /* Base Neutrals */
  --neutral-white: hsl(0, 0%, 100%);
  --neutral-100: hsl(220, 25%, 97%);
  --neutral-200: hsl(220, 20%, 94%);
  --neutral-300: hsl(220, 15%, 90%);
  --neutral-400: hsl(220, 12%, 75%);
  --neutral-500: hsl(220, 10%, 60%);
  --neutral-600: hsl(220, 10%, 50%);
  --neutral-700: hsl(220, 12%, 35%);
  --neutral-800: hsl(220, 15%, 25%);
  --neutral-900: hsl(220, 20%, 15%);

  /* Blue Accent Colors */
  --blue-100: hsl(205, 90%, 90%);
  --blue-200: hsl(205, 80%, 80%);
  --blue-300: hsl(205, 75%, 70%);
  --blue-400: hsl(205, 68%, 60%);
  --blue-500: hsl(205, 65%, 55%);
  --blue-600: hsl(205, 60%, 50%);
  --blue-700: hsl(205, 60%, 45%);
  --blue-800: hsl(205, 55%, 35%);
  --blue-900: hsl(205, 50%, 25%);

  /* Status Colors */
  --status-success: hsl(145, 65%, 45%);
  --status-error: hsl(0, 70%, 55%);
  --status-warning: hsl(40, 90%, 60%);
  --status-info: hsl(195, 70%, 55%);

  /* Font Variables */
  --font-primary: "Poppins", sans-serif;
  --font-secondary: "Capriola", system-ui;

  /* Font Weight Variables */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Font Size Variables */
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;

  /* Z-Index Variables */
  --z-behind: -1;
  --z-normal: 1;
  --z-above: 10;
  --z-modal: 100;
  --z-sticky-header: 101;
  --z-top: 1000;

  /* Border Radius */
  --radius-small: 0.5rem;
  --radius-full: 50%;

  /* Semantic Colors - Light Theme */
  --color-bg-primary: var(--neutral-100);
  --color-bg-secondary: var(--neutral-200);
  --color-text-primary: var(--neutral-800);
  --color-text-secondary: var(--neutral-600);
  --color-text-heading: var(--neutral-900);
  --color-text-accent: var(--blue-600);
  --color-text-on-accent: var(--neutral-white);
  --color-accent-primary: var(--blue-500);
  --color-accent-secondary: var(--blue-300);
  --color-border: var(--neutral-300);
  --color-border-interactive: var(--blue-400);
  --color-link: var(--blue-600);
  --color-link-hover: var(--blue-700);
  --color-button-primary-bg: var(--blue-500);
  --color-button-primary-text: var(--neutral-white);
  --color-button-primary-hover-bg: var(--blue-600);
  --color-button-secondary-bg: var(--neutral-200);
  --color-button-secondary-text: var(--neutral-800);
  --color-button-secondary-hover-bg: var(--neutral-300);
  --color-interactive-hover-bg: var(--neutral-300);
}

/* Dark Theme */
.dark-theme {
  /* Semantic Colors - Dark Theme */
  --color-bg-primary: var(--neutral-900);
  --color-bg-secondary: var(--neutral-800);
  --color-surface: var(--neutral-800);
  --color-text-primary: var(--neutral-100);
  --color-text-secondary: var(--neutral-400);
  --color-text-heading: var(--neutral-white);
  --color-text-accent: var(--blue-300);
  --color-text-on-accent: var(--neutral-white);
  --color-accent-primary: var(--blue-400);
  --color-accent-secondary: var(--blue-600);
  --color-border: var(--neutral-700);
  --color-border-interactive: var(--blue-500);
  --color-link: var(--blue-300);
  --color-link-hover: var(--blue-200);
  --color-button-primary-bg: var(--blue-500);
  --color-button-primary-text: var(--neutral-white);
  --color-button-primary-hover-bg: var(--blue-400);
  --color-button-secondary-bg: var(--neutral-700);
  --color-button-secondary-text: var(--neutral-100);
  --color-button-secondary-hover-bg: var(--neutral-600);
  --color-interactive-hover-bg: var(--neutral-700);

  /* Status Colors for Dark Theme */
  --status-success: hsl(145, 60%, 65%);
  --status-error: hsl(0, 70%, 70%);
  --status-warning: hsl(40, 85%, 70%);
  --status-info: hsl(195, 65%, 70%);
}

/* ==========================================
   CSS RESET & BASE STYLES
========================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: all 0.25s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-primary);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  text-rendering: optimizeSpeed;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  border: none;
  outline: none;
  background: transparent;
}

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

ul {
  list-style: none;
}

button {
  cursor: pointer;
  color: inherit;
  background: inherit;
  border: none;
  outline: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-secondary);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--color-text-heading);
}

p {
  margin-bottom: 1rem;
}

strong {
  font-weight: var(--weight-semibold);
  color: var(--color-accent-primary);
}

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
}

section {
  padding: 4rem 0;
}

/* ==========================================
   LAYOUT
========================================== */

/* Default Mobile Layout */
header {
  width: 100%;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  z-index: var(--z-sticky-header);
}

main {
  flex-grow: 1;
  width: 100%;
}

/* Desktop Layout (Side-by-Side) */
@media (min-width: 992px) {
  html {
    scroll-padding-top: 0;
  }

  body {
    flex-direction: row;
  }

  header {
    width: 25%;
    max-width: 300px;
    height: 100vh;
    border-bottom: none;
    border-right: 1px solid var(--color-border);
    background-color: var(--color-bg-secondary);
    overflow-y: auto;
    flex-shrink: 0;
  }

  main {
    flex-grow: 1;
    overflow-y: auto;
  }
}

/* ==========================================
   HEADER STYLES
========================================== */

/* Base header styles - Mobile First */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

.nav-brand {
  font-family: var(--font-secondary);
  font-weight: var(--weight-bold);
  font-size: 1.5rem;
  color: var(--color-accent-primary);
}

/* Mobile navigation menu */
.nav-menu {
  position: fixed;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--color-bg-secondary);
  top: 0;
  right: -100%;
  width: 30%;
  height: 100%;
  padding: 4rem 2rem 0;
  z-index: var(--z-top);
}

.nav-list {
  display: flex;
  flex-direction: column;
  align-items: start;
  row-gap: 2rem;
  width: 100%;
}

.nav-list li {
  width: 100%;
  opacity: 0;
  transform: translateX(30px);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--color-accent-primary);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-full);
  margin-right: 0.9375rem;
}

.nav-link {
  position: relative;
  font-family: var(--font-secondary);
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  color: var(--color-text-primary);
}

.nav-link:hover {
  padding: 0.5rem;
  background-color: var(--color-interactive-hover-bg);
  border-radius: var(--radius-small);
  transform: translateY(-3px) scale(1.05);
  color: var(--color-link-hover);
}
.nav-link:hover .nav-icon {
  background-color: var(--color-accent-secondary);
}

/* Header actions container */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Toggle and close buttons */
.mobile-menu-toggle,
.nav-close {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-accent-primary);
  display: block;
}
.mobile-menu-toggle:hover,
.nav-close:hover {
  color: var(--color-link-hover);
}

.nav-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
}

/* Theme toggle button */
.theme-toggle {
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--color-accent-primary);
}
.theme-toggle:hover {
  transform: scale(1.1);
  color: var(--color-link-hover);
}

/* Login button styling */
.desktop-login-btn {
  display: none;
}

.mobile-login-btn {
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-secondary);
}

/* Show menu class */
.show-menu {
  right: 0;
}

/* Apply animations to nav items when menu is shown */
.show-menu .nav-list li {
  animation: slideInRight 0.4s forwards;
}

/* Staggered animation delays for each nav item */
.show-menu .nav-list li:nth-child(1) {
  animation-delay: 0.1s;
}
.show-menu .nav-list li:nth-child(2) {
  animation-delay: 0.2s;
}
.show-menu .nav-list li:nth-child(3) {
  animation-delay: 0.3s;
}
.show-menu .nav-list li:nth-child(4) {
  animation-delay: 0.4s;
}
.show-menu .nav-list li:nth-child(5) {
  animation-delay: 0.5s;
}
.show-menu .nav-list li:nth-child(6) {
  animation-delay: 0.6s;
}

/* Reset animations when menu is closed */
.nav-menu:not(.show-menu) .nav-list li {
  opacity: 0;
  transform: translateX(30px);
}

/* Overlay for mobile menu */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: hsla(0, 0%, 0%, 0.5);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Animations */
@keyframes slideInRight {
  0% {
    transform: translateX(30px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes rotate-icon {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.theme-toggle.animate {
  animation: rotate-icon 0.5s ease;
}


/* .nav-menu adjustments for small screens */
@media screen and (max-width: 768px) {
  .nav-menu {
    width: 40%;
  }
}

@media screen and (max-width: 580px) {
  .nav-menu {
    width: 60%;
  }
}

@media screen and (max-width: 380px) {
  .nav-menu {
    width: 80%;
  }
}

/* Desktop styles - applied from 992px and up */
@media screen and (min-width: 992px) {
  .nav {
    height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    gap: 2rem;
    align-items: flex-start;
  }

  .nav-menu {
    position: static;
    width: 100%;
    height: auto;
    padding: 0;
    background-color: transparent;
    flex-grow: 1;
    justify-content: center;
  }

  .nav-brand {
    margin-bottom: 1rem;
  }

  .nav-list {
    row-gap: 1.5rem;
  }

  .nav-list li {
    opacity: 1 !important;
    transform: translateX(0) !important;
    visibility: visible !important;
  }

  .mobile-menu-toggle,
  .nav-close {
    display: none;
  }

  .nav-icon {
    margin-right: 0.75rem;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: start;
    justify-content: space-between;
    margin-top: auto;
  }

  .nav-link {
    font-family: var(--font-secondary);
  }

  .desktop-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border-radius: var(--radius-small);
    border: 1px solid var(--color-button-primary-bg);
    width: 100%;
    justify-content: center;
    font-family: var(--font-secondary);
  }
  .desktop-login-btn:hover {
    background-color: var(--color-button-primary-hover-bg);
    color: var(--color-button-primary-text);
    border-color: var(--color-button-primary-hover-bg);
  }

  .mobile-login-btn {
    display: none;
  }

  .nav-overlay {
    display: none;
  }
}


/* ==========================================
   PRELOADER STYLES
========================================== */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--color-border);
  border-top-color: var(--color-accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Hide preloader when body is not loading */
body:not(.loading) .preloader {
  opacity: 0;
  visibility: hidden;
}

/* Hide main content when body is loading */
body.loading > header,
body.loading > main {
  visibility: hidden;
}