@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --nav-transition-duration: 280ms;
  --nav-transition-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.layout-shell {
  position: fixed;
  background-color: rgba(19, 18, 18, 0.86);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transition:
    width var(--nav-transition-duration) var(--nav-transition-ease),
    height var(--nav-transition-duration) var(--nav-transition-ease),
    padding var(--nav-transition-duration) var(--nav-transition-ease),
    top var(--nav-transition-duration) var(--nav-transition-ease),
    right var(--nav-transition-duration) var(--nav-transition-ease),
    bottom var(--nav-transition-duration) var(--nav-transition-ease),
    left var(--nav-transition-duration) var(--nav-transition-ease),
    border-color var(--nav-transition-duration) var(--nav-transition-ease),
    background-color var(--nav-transition-duration) var(--nav-transition-ease),
    box-shadow var(--nav-transition-duration) var(--nav-transition-ease);
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.layout-shell.vertical-mode {
  width: var(--sidebar-width);
  height: 100vh;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1.5rem 0;
  border-bottom: none;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-main);
  letter-spacing: -0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    opacity 0.22s ease;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

/* Desktop top-bar only: nudge the logo left */
.layout-shell:not(.vertical-mode) .brand-logo {
  transform: translateX(-16px);
}

.brand-logo i {
  color: #fff;
  margin-right: 10px;
  font-size: 1.5rem;
  transition: color 0.3s ease, margin 0.3s ease;
}

.brand-logo:hover i {
  color: var(--primary-blue);
}

.layout-shell.vertical-mode .brand-logo {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  width: 60%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.layout-shell.vertical-mode .brand-logo span {
  display: none;
}

.layout-shell.vertical-mode .brand-logo i {
  margin-right: 0;
}

.nav-tabs {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: gap var(--nav-transition-duration) var(--nav-transition-ease);
}

.layout-shell.vertical-mode .nav-tabs {
  flex-direction: column;
  gap: 2.5rem;
  width: 100%;
  align-items: center;
}

.nav-item {
  position: relative;
  color: rgba(255, 255, 240, 0.886);
  display: flex;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-main);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  transition:
    color 0.22s ease,
    background-color 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease;
}

.nav-link i {
  font-size: 1.1rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-link:hover {
  color: var(--primary-blue);
  background-color: rgba(0, 123, 255, 0.1);
}

.nav-link:hover i {
  transform: translateY(-2px);
  text-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.nav-link.active {
  color: var(--primary-blue);
}

.layout-shell.vertical-mode .nav-text {
  display: none;
}

.layout-shell.vertical-mode .nav-link {
  justify-content: center;
  padding: 12px;
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: var(--primary-blue);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.layout-shell.vertical-mode .nav-item:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(15px);
}

/* Light mode nav: white shell + dark text */
html.light-theme .layout-shell,
body.light-theme-index .layout-shell,
body.light-theme .layout-shell {
  background-color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12);
}

html.light-theme .layout-shell.vertical-mode,
body.light-theme-index .layout-shell.vertical-mode,
body.light-theme .layout-shell.vertical-mode {
  border-right: 1px solid rgba(15, 23, 42, 0.12);
}

html.light-theme .layout-shell.vertical-mode .brand-logo,
body.light-theme-index .layout-shell.vertical-mode .brand-logo,
body.light-theme .layout-shell.vertical-mode .brand-logo {
  border-bottom-color: rgba(15, 23, 42, 0.26);
}

html.light-theme .nav-item,
html.light-theme .nav-link,
html.light-theme .brand-logo,
html.light-theme .brand-logo i,
body.light-theme-index .nav-item,
body.light-theme-index .nav-link,
body.light-theme-index .brand-logo,
body.light-theme-index .brand-logo i,
body.light-theme .nav-item,
body.light-theme .nav-link,
body.light-theme .brand-logo,
body.light-theme .brand-logo i {
  color: #111112;
}

html.light-theme .nav-link:hover,
html.light-theme .nav-link.active,
html.light-theme .nav-link:hover i,
html.light-theme .nav-link.active i,
html.light-theme .brand-logo:hover i,
body.light-theme-index .nav-link:hover,
body.light-theme-index .nav-link.active,
body.light-theme-index .nav-link:hover i,
body.light-theme-index .nav-link.active i,
body.light-theme-index .brand-logo:hover i,
body.light-theme .nav-link:hover,
body.light-theme .nav-link.active,
body.light-theme .nav-link:hover i,
body.light-theme .nav-link.active i,
body.light-theme .brand-logo:hover i {
  color: var(--primary-blue);
}

body.sidebar-active {
  padding-left: var(--sidebar-width);
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 56px;
    --mobile-nav-height: 68px;
  }

  .layout-shell.vertical-mode {
    padding: 1rem 0;
  }

  .layout-shell.vertical-mode .brand-logo {
    width: 72%;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .layout-shell.vertical-mode .nav-link {
    width: 38px;
    height: 38px;
    padding: 8px;
  }

  .layout-shell {
    padding: 0 0.9rem;
  }

  .nav-tabs {
    gap: 0.45rem;
  }

  .nav-text {
    display: none;
  }

  .nav-link {
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 8px;
    border-radius: 10px;
  }

  /* Mobile active nav: render as bottom bar instead of side rail */
  body.sidebar-active {
    padding-left: 0 !important;
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)) !important;
  }

  .layout-shell.vertical-mode {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding: 0 0.9rem env(safe-area-inset-bottom);
    border-right: none;
    border-bottom: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .layout-shell.vertical-mode .brand-logo span {
    display: inline-block;
    font-size: 0 !important;
    width: 68px;
    height: 20px;
    margin-left: -6px;
    margin-top: 1px;
  }

  .layout-shell.vertical-mode .brand-logo i {
    font-size: 1.5rem;
    margin-right: -2px;
  }

  /* Mobile: shift brand-logo slightly to the left */
  .layout-shell.vertical-mode .brand-logo {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border-bottom: none;
    border-radius: 0;
    flex: 0 0 auto;
    transform: translateX(-8px);
  }

  /* Mobile top-bar: match the same positioning */
  .layout-shell:not(.vertical-mode) .brand-logo {
    transform: translateX(-8px);
  }

  .layout-shell.vertical-mode .nav-tabs {
    flex-direction: row;
    gap: 0.45rem;
    width: auto;
    align-items: center;
    justify-content: center;
  }

  .layout-shell.vertical-mode .nav-link {
    width: 42px;
    height: 42px;
    padding: 8px;
    border-radius: 10px;
  }

  .layout-shell.vertical-mode .nav-item::after {
    display: none !important;
  }

  html.light-theme .layout-shell.vertical-mode,
  body.light-theme-index .layout-shell.vertical-mode,
  body.light-theme .layout-shell.vertical-mode {
    border-right: none;
    border-top: 1px solid rgba(15, 23, 42, 0.18);
  }

  body.sidebar-active .content-area {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 0.7rem) !important;
  }

  body.sidebar-active .landing,
  body.sidebar-active main {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 0.7rem) !important;
  }

  body.sidebar-active .auth-container,
  body.sidebar-active .account-container {
    margin-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 0.7rem) !important;
  }

  body.sidebar-active .create-deck-fab,
  body.sidebar-active .folder-fab,
  body.sidebar-active .social-fab,
  body.sidebar-active .social-notif-fab,
  body.sidebar-active .notif-fab,
  body.sidebar-active .blog-social-fab,
  body.sidebar-active .settings-fab {
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 0.9rem) !important;
  }
}

/* Page-specific nav emphasis (e.g. Account when logged out, Create nudges) */
.nav-link.create-nav-highlight {
  position: relative;
  color: #d8ebff;
  background: rgba(0, 123, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(132, 197, 255, 0.26), 0 0 18px rgba(0, 123, 255, 0.18);
  animation: createCtaPulse 2.15s ease-in-out infinite;
}

.nav-link.create-nav-highlight i {
  color: #8dc6ff;
  animation: createPlusNudge 1.55s ease-in-out infinite;
}

.nav-link.create-nav-highlight::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(141, 198, 255, 0.22);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  animation: createRingPing 2.15s ease-out infinite;
}

@keyframes createCtaPulse {
  0%,
  100% {
    background: rgba(0, 123, 255, 0.1);
    box-shadow: 0 0 0 1px rgba(132, 197, 255, 0.2), 0 0 14px rgba(0, 123, 255, 0.12);
  }

  50% {
    background: rgba(0, 123, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(132, 197, 255, 0.35), 0 0 24px rgba(0, 123, 255, 0.28);
  }
}

@keyframes createPlusNudge {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-1px) scale(1.06);
  }
}

@keyframes createRingPing {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }

  35% {
    opacity: 0.38;
  }

  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

/* Custom Decks Logo for Navigation (replaces fa-layer-group) */
.brand-logo i.fa-layer-group {
  width: 44px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: -2px; /* Pulls wordmark aggressively into the logo mark */
}

.brand-logo i.fa-layer-group::before {
  content: "";
  width: 100%;
  height: 100%;
  background-image: url('./assets/decks-logo.png');
  background-size: contain; 
  background-repeat: no-repeat;
  background-position: center;
  filter: saturate(0%) opacity(0.85);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  transition: filter 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Hover and Active State for Custom Logo */
.brand-logo:hover i.fa-layer-group::before {
  filter: saturate(100%) opacity(1);
}

/* Custom ECKS Logo Text Component */
.brand-logo span {
  font-size: 0 !important; /* Hides physical text gracefully */
  display: inline-block;
  width: 68px;   /* Significantly scaled down */
  height: 20px;  /* Much shorter than the 30px 'D' height to cement hierarchy */
  margin-left: -6px; /* Backed off perfectly by 2 pixels to the right */
  margin-top: 1px; /* Gently shifts back upward */
  background-image: url('./assets/decks-ecks.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  filter: saturate(0%) opacity(0.85);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  transition: filter 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
  vertical-align: middle;
}

.brand-logo:hover span {
  filter: saturate(100%) opacity(1);
}
