/* ============================================================
   FileBrowser — sleek modern theme, violet accent
   Light + dark via the app's own :root / :root.dark variables
   ============================================================ */

/* ---------- Light ---------- */
:root {
  --background: #f7f7fb;
  --surfacePrimary: #ffffff;
  --surfaceSecondary: #ededf4;

  --textPrimary: #5b6172;   /* muted body text (app semantics: primary = muted) */
  --textSecondary: #14161f; /* strong text */

  --borderPrimary: rgba(20, 22, 31, 0.08);
  --borderSecondary: rgba(20, 22, 31, 0.16);
  --divider: rgba(20, 22, 31, 0.07);
  --hover: rgba(124, 58, 237, 0.06);

  /* accent: remap the app's blue to violet */
  --blue: #7c3aed;
  --dark-blue: #6d28d9;
  --icon-blue: #7c3aed;

  /* calmer file-type icon palette */
  --iconPrimary: #8b5cf6;
  --icon-red: #f0616d;
  --icon-orange: #f59e0b;
  --icon-yellow: #fbbf24;
  --icon-green: #34c98e;
  --icon-violet: #a78bfa;
}

/* ---------- Dark ---------- */
:root.dark {
  --background: #0e0f14;
  --surfacePrimary: #16171f;
  --surfaceSecondary: #23242f;

  --textPrimary: rgba(235, 236, 245, 0.62);
  --textSecondary: rgba(240, 240, 250, 0.94);

  --borderPrimary: rgba(255, 255, 255, 0.06);
  --borderSecondary: rgba(255, 255, 255, 0.14);
  --divider: rgba(255, 255, 255, 0.08);
  --hover: rgba(167, 139, 250, 0.09);

  --blue: #8b5cf6;
  --dark-blue: #7c3aed;
  --icon-blue: #a78bfa;

  --iconPrimary: #a78bfa;
  --icon-red: #f2727d;
  --icon-orange: #fba94b;
  --icon-yellow: #fcd34d;
  --icon-green: #3dd598;
  --icon-violet: #b8a1fa;
}

/* ---------- Typography ---------- */
/* self-hosted via the branding img/ passthrough — no external requests */
@font-face {
  font-family: "Inter";
  src: url("/static/img/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body,
input,
button,
textarea,
select {
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui,
    -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(139, 92, 246, 0.3);
}

/* ---------- Header (frosted) ---------- */
header {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--divider);
  box-shadow: none;
}
:root.dark header {
  background: rgba(22, 23, 31, 0.72);
}

/* ---------- Search bar → centered pill ---------- */
/* header siblings consume flex space, so true-center absolutely (desktop only) */
@media (min-width: 900px) {
  #search {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 25em;
    height: 2.6em;
  }
  #search.active {
    left: auto;
    transform: none;
  }
}
#search #input {
  border-radius: 999px;
  border: 1px solid var(--divider);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#search #input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
#search.active #input {
  border-radius: 0.6em;
}

/* ---------- Listing items ---------- */
#listing .item {
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease,
    box-shadow 0.12s ease, transform 0.12s ease;
}
#listing .item:hover {
  background: var(--hover);
  border-color: var(--borderPrimary);
}
#listing.mosaic .item {
  border: 1px solid var(--divider);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
#listing.mosaic .item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* ---------- Buttons ---------- */
.button {
  border-radius: 10px;
  transition: background 0.15s ease, box-shadow 0.15s ease,
    transform 0.1s ease;
}
.button--blue {
  background: linear-gradient(135deg, var(--blue), var(--dark-blue));
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
.button--blue:hover {
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
  transform: translateY(-1px);
}

/* ---------- Inputs ---------- */
.input {
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

/* ---------- Cards / modals / share boxes ---------- */
.card {
  border-radius: 16px;
  border: 1px solid var(--divider);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.share__box {
  border-radius: 16px;
  border: 1px solid var(--divider);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

/* ---------- Sidebar ---------- */
/* the file sidebar is a bare <nav>; the settings tab bar is <nav id="nav"> */
@media (min-width: 737px) {
  nav:not(#nav) {
    background: var(--surfacePrimary);
    border-right: 1px solid var(--divider);
    width: 18em;
    height: calc(100% - 4em);
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0.75em;
  }
  /* main's width is coupled to the sidebar width (16em + 3em gutters stock) */
  main {
    width: calc(100% - 21em);
  }
}
nav .action {
  border-radius: 10px;
  margin: 0 0.5em;
  width: calc(100% - 1em);
  transition: background 0.12s ease;
}
nav .action:hover {
  background: var(--hover);
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs a {
  border-radius: 8px;
}
.breadcrumbs a:hover {
  background-color: var(--hover);
}

/* ---------- Selection state ---------- */
#listing .item[aria-selected="true"] {
  background: rgba(124, 58, 237, 0.12) !important;
  color: var(--textSecondary) !important;
  box-shadow: inset 0 0 0 2px var(--blue);
  border-color: transparent;
}
#listing .item[aria-selected="true"] i {
  color: var(--blue);
}
:root.dark #listing .item[aria-selected="true"] {
  background: rgba(139, 92, 246, 0.18) !important;
}

/* ---------- Focus rings ---------- */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.button:focus-visible {
  outline-offset: 3px;
}

/* ---------- Login page ---------- */
#login {
  background: radial-gradient(
      circle at 50% -10%,
      rgba(124, 58, 237, 0.08),
      transparent 60%
    ),
    var(--background);
}
#login form {
  background: var(--surfacePrimary);
  border: 1px solid var(--divider);
  border-radius: 20px;
  max-width: 22em;
  padding: 2.5em 2em;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}
:root.dark #login {
  background: radial-gradient(
      circle at 50% -10%,
      rgba(139, 92, 246, 0.1),
      transparent 60%
    ),
    var(--background);
}
:root.dark #login form {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ---------- Dropdown / context menu ---------- */
#dropdown {
  background: var(--surfacePrimary);
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 0.3em;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
}
#dropdown .action {
  border-radius: 9px;
}

/* ---------- Progress bars (stock cyan → accent) ---------- */
.progress div,
.file-progress div {
  background-color: var(--blue);
}

/* ---------- Share page ---------- */
.share__box__icon i {
  color: var(--blue);
  font-size: 8em;
}
.share__box__header {
  font-weight: 500;
  padding: 1.25em 1em 0.75em;
}

/* ---------- Empty state ---------- */
.message {
  font-size: 1.4em;
  font-weight: 500;
  color: var(--textPrimary);
}
.message i {
  display: block;
  width: fit-content;
  margin: 0 auto 0.3em;
  line-height: 1;
  font-size: 2.6em;
  color: var(--blue);
}

/* ---------- Micro-animations ---------- */
@media (min-width: 737px) {
  .card.floating {
    animation: fb-modal-in 0.18s ease-out both;
  }
  @keyframes fb-modal-in {
    from {
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
  }
}
@media (max-width: 736px) {
  .card.floating {
    animation: fb-sheet-in 0.2s ease-out both;
  }
  @keyframes fb-sheet-in {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
#dropdown {
  opacity: 0;
  transition: transform 0.14s ease, opacity 0.14s ease;
}
#dropdown.active {
  opacity: 1;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--borderSecondary);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--blue);
  background-clip: content-box;
}
