/* =========================================================
   DYNASTY — APP SHELL
   Shared application layout and navigation
   Theme: Black, white and gold
   ========================================================= */

/* ---------- Application root ---------- */

.app-root {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--dynasty-black, #0a0a0a);
  color: var(--dynasty-white, #ffffff);
}

/* ---------- Top navigation bar ---------- */

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  gap: 14px;

  min-height: 64px;
  padding: 12px 20px;
  box-sizing: border-box;

  background: color-mix(
  in srgb,
  var(--dynasty-black) 96%,
  transparent
);
  border-bottom: 1px solid var(--dynasty-border, #302b1d);

  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.app-topbar-brand {
  color: var(--dynasty-gold, #c9a227);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* ---------- Menu toggle ---------- */

.menu-toggle {
  width: 40px;
  height: 40px;
  padding: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;

  flex-shrink: 0;

  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 2px;

  background: var(--dynasty-white, #ffffff);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.menu-toggle:focus-visible,
.drawer-link:focus-visible {
  outline: 2px solid var(--dynasty-gold, #c9a227);
  outline-offset: 3px;
}

/* ---------- Drawer background overlay ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;

  background: rgba(0, 0, 0, 0.65);
}

/* ---------- Side navigation drawer ---------- */

.app-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 70;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;

  width: 300px;
  max-width: 85vw;
  height: 100%;
  height: 100dvh;

  padding: 18px 14px 20px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;

  background: var(--dynasty-panel, #141414);
  border-right: 1px solid var(--dynasty-border, #302b1d);
}

/* ---------- Drawer branding ---------- */

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 18px;

  min-height: 100px;
  padding: 18px 14px 24px;
  margin: 36px 0 18px;

  border-bottom: 1px solid var(--dynasty-border, #302b1d);
  box-sizing: border-box;
}

/* Gold diamond */

.drawer-brand-mark {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  flex: 0 0 42px;

  box-sizing: border-box;
  border: 1.5px solid var(--dynasty-gold, #c9a227);

  transform: rotate(45deg);
}

/*
   IMPORTANT:
   Do not generate another D here.
   The HTML should contain only one D.
*/

.drawer-brand-mark::before {
  content: none;
  display: none;
}

/* Keep the diamond tilted, but the D perfectly upright */
.drawer-brand-mark {
  transform: rotate(45deg);
}

.drawer-brand-mark > span,
.drawer-brand-mark > strong,
.drawer-brand-mark > i {
  display: block;
  color: var(--dynasty-gold, #c9a227);
  font-size: 15px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  transform: rotate(-45deg);
}

/* Dynasty wordmark */

.drawer-brand-name {
  color: var(--dynasty-gold, #c9a227);

  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;

  white-space: nowrap;
}

/* ---------- Navigation links ---------- */

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;

  width: 100%;
  min-height: 48px;
  padding: 12px 14px;

  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 6px;

  background: transparent;
  color: var(--dynasty-white, #ffffff);

  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;

  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.drawer-link:hover {
  background: var(--dynasty-border);
  color: var(--dynasty-gold);
}

.drawer-link:active {
  background: var(--dynasty-border);
}

/* Selected navigation item */

.drawer-link.active,
.drawer-link[aria-current="page"] {
  color: var(--dynasty-gold);
  background: var(--dynasty-border);
  border-color: var(--dynasty-gold);
}
/* ---------- Sign Out ---------- */

.drawer-link-danger {
  margin-top: auto;
  flex-shrink: 0;

  color: #ef6b6b;
}

.drawer-link-danger:hover {
  color: #ff8585;
  background: rgba(239, 83, 80, 0.08);
}

/* ---------- Main application content ---------- */

.app-content {
  min-width: 0;
  padding: 20px;
  box-sizing: border-box;
}

.route-placeholder {
  padding: 40px 20px;
  text-align: center;
}

/* ---------- Fatal error screen ---------- */

.fatal-error-box {
  position: fixed;
  inset: 0;
  z-index: 2000;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 20px;
  box-sizing: border-box;

  background: var(--dynasty-black, #0a0a0a);
  color: var(--dynasty-white, #ffffff);
  text-align: center;
}

.fatal-error-box h1 {
  color: var(--dynasty-gold, #c9a227);
}

.fatal-error-box p {
  max-width: 440px;
  line-height: 1.6;
}

/* ---------- Utility ---------- */

[hidden] {
  display: none !important;
}

/* ---------- Responsive layout ---------- */

@media (max-width: 480px) {
  .app-topbar {
    gap: 10px;
    padding: 10px 14px;
  }

  .app-content {
    padding: 14px;
  }

  .app-drawer {
    width: min(300px, 85vw);
    padding: 16px 14px 20px;
  }

  .drawer-brand {
    gap: 16px;
    padding: 18px 12px 22px;
    margin-top: 36px;
  }

  .drawer-link {
    min-height: 48px;
    padding: 12px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-drawer,
  .drawer-link,
  .menu-toggle {
    scroll-behavior: auto;
    transition: none;
    animation: none;
  }
}