// Rôle : définit le layout principal, la sidebar et la navigation.
@use "mixins";

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  width: 248px;
  height: auto;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border-right: 1px solid var(--color-border);
  background: rgba(11, 14, 27, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-lg);
  font-weight: 800;
}

.brand-name {
  color: var(--color-text-primary);
}

.brand-name-main {
  background: linear-gradient(
    90deg,
    var(--color-text-primary) 0%,
    var(--color-text-primary) 46%,
    var(--color-accent-gold) 58%,
    var(--color-accent-gold) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  background-position: 0 0;
  background-size: 220% 100%;
  color: transparent;
  transition: background-position 620ms var(--ease-standard);
}

.brand-name-accent {
  color: var(--color-accent-gold);
}

.brand:hover .brand-name-main {
  background-position: 100% 0;
}

.brand-name-accent {
  background: none;
}

.brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background: var(--gradient-brand);
  filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.28));
  mask: url("/static/icons/controller.svg") center / contain no-repeat;
  -webkit-mask: url("/static/icons/controller.svg") center / contain no-repeat;
  transition: transform 0.8s var(--ease-standard), filter var(--duration-normal) var(--ease-standard);
}

.brand:hover .brand-mark {
  filter: drop-shadow(0 0 22px rgba(139, 92, 246, 0.42));
  transform: rotate(360deg);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: var(--duration-normal) var(--ease-standard);
}

.nav-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  background: var(--color-accent-gold);
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: 20px 20px;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 20px 20px;
}

.nav-icon-home {
  mask-image: url("/static/icons/home.svg");
  -webkit-mask-image: url("/static/icons/home.svg");
}

.nav-icon-toolbox {
  mask-image: url("/static/icons/toolbox.svg");
  -webkit-mask-image: url("/static/icons/toolbox.svg");
}

.nav-icon-controller {
  mask-image: url("/static/icons/controller.svg");
  -webkit-mask-image: url("/static/icons/controller.svg");
}

.nav-item strong {
  color: inherit;
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.nav-item.active {
  border-color: var(--color-primary-border);
  background: var(--color-primary-soft);
  box-shadow: inset 3px 0 0 var(--color-primary);
  color: var(--color-text-primary);
}

.sidebar-secondary-links {
  display: grid;
  gap: 4px;
  margin-top: auto;
}

.sidebar-about-link {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 700;
  transition: var(--duration-normal) var(--ease-standard);
}

.sidebar-about-link strong {
  color: inherit;
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.sidebar-about-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--color-accent-gold);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  transition:
    color var(--duration-fast) var(--ease-standard),
    filter var(--duration-fast) var(--ease-standard);
}

.sidebar-about-icon .ui-icon {
  width: 14px;
  height: 14px;
  color: inherit;
}

.sidebar-about-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

.sidebar-about-link:hover .sidebar-about-icon {
  color: #ffd66b;
  filter: drop-shadow(0 0 6px rgba(246, 196, 83, 0.24));
}

.sidebar-about-link.active {
  color: var(--color-text-primary);
}

.sidebar-note {
  position: relative;
  isolation: isolate;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: rgba(16, 20, 38, 0.58);
  box-shadow: var(--shadow-sm);
}

.sidebar-note::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 92% 12%, rgba(246, 196, 83, 0.009), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.011), transparent 42%);
  pointer-events: none;
}

.sidebar-note::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 100% 0%, rgba(246, 196, 83, 0.42), transparent 34%),
    linear-gradient(135deg, rgba(246, 196, 83, 0.42), rgba(139, 92, 246, 0.32) 54%, rgba(196, 181, 253, 0.24));
  @include mixins.border-mask;
  pointer-events: none;
}

.sidebar-note > * {
  position: relative;
  z-index: 1;
}

.sidebar-note .badge {
  border: 1px solid rgba(246, 196, 83, 0.24);
  background:
    linear-gradient(135deg, rgba(246, 196, 83, 0.12), rgba(139, 92, 246, 0.16));
  color: var(--color-accent-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-note p {
  margin: 12px 0 0;
  font-size: var(--font-size-sm);
  line-height: 1.45;
}

.sidebar-storage-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.sidebar-action-button {
  display: inline-flex;
  background: rgba(7, 10, 24, 0.36);
}

.content-shell {
  grid-column: 2;
  display: flex;
  min-height: 100vh;
  min-width: 0;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-8);
  border-bottom: 1px solid var(--color-border);
  background: rgba(7, 9, 19, 0.78);
  backdrop-filter: blur(10px);
}

.topbar strong {
  font-size: var(--font-size-lg);
}

.topbar .eyebrow {
  margin-bottom: 2px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.toolbox-icon-button {
  padding: 0;
}

.toolbox-icon-button img {
  width: 21px;
  height: 21px;
  object-fit: contain;
}

main {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: min(1600px, calc(100% - 64px));
  margin: 0 auto;
  padding: var(--space-8) 0 var(--space-12);
}
