/* ==========================================================================
   Sarkari Setu — assets/base.css
   The shell: design tokens, the glass app-window, the window bar, the
   sidebar, and the scrolling content column.

   Everything here is structure. Components live in components.css and
   per-page layouts in views.css.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens -- */

:root {
  /* The visual language is the Nexiitt store: one blue, one purple, one
     amber, a 14px radius and a soft shadow. Everything else is a tint of
     these, which is why the whole site can be re-skinned from this block. */
  --bg: #f3f5fc;
  --bg-deep: #e7ebf9;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f7f9fe;
  --line: #e2e6f5;
  --line-strong: #d0d7ee;
  --text: #12142b;
  --muted: #666c88;
  --muted-light: #4b5170;
  --mint: #3355ff;          /* the primary accent */
  --mint-deep: #1e3ad6;
  --blue: #5b7bff;
  --yellow: #ffa412;
  --orange: #ff8a3d;
  --red: #e5484d;
  --purple: #7b5cff;
  --green: #0a7d5e;
  --yellow-ink: #96590a;
  --orange-ink: #a34a10;
  --purple-ink: #5b3fd6;
  --shadow: 0 18px 46px rgba(24, 34, 92, 0.1);
  --shadow-lift: 0 12px 30px rgba(51, 85, 255, 0.16);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  /* Type + spacing aliases used by the component layer. */
  --font-sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-num: "Manrope", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gap: 11px;

  color-scheme: light;
}

/* Dark is the same design in a dark room, not a different one. */
[data-theme="dark"] {
  --bg: #0d1020;
  --bg-deep: #080a16;
  --panel: #161a2e;
  --panel-strong: #1c2138;
  --panel-soft: #1a1f34;
  --line: #262c46;
  --line-strong: #333a58;
  --text: #f2f4fb;
  --muted: #9aa2bd;
  --muted-light: #c3c9dd;
  --mint: #6b8bff;
  --mint-deep: #3355ff;
  --blue: #8fa8ff;
  --yellow: #ffb84d;
  --orange: #ffa06a;
  --red: #ff6b6f;
  --purple: #a68bff;
  --green: #2fd3a5;
  --yellow-ink: #ffc46b;
  --orange-ink: #ffb083;
  --purple-ink: #b9a2ff;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 12px 30px rgba(51, 85, 255, 0.28);

  color-scheme: dark;
}

/* ----------------------------------------------------------------- reset -- */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 6% 8%, rgba(51, 85, 255, 0.1), transparent 32%),
    radial-gradient(circle at 93% 5%, rgba(123, 92, 255, 0.09), transparent 28%),
    radial-gradient(circle at 80% 95%, rgba(255, 164, 18, 0.06), transparent 30%),
    linear-gradient(135deg, var(--bg-deep), var(--bg));
  font-family: var(--font-sans);
  overflow-x: hidden;
}

/* Two blurred orbs behind the glass. Purely decorative. */
body::before,
body::after {
  position: fixed;
  z-index: -2;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.4;
  pointer-events: none;
  content: "";
}
body::before { top: -180px; left: 35%; background: #c3d0ff; transform: rotate(20deg); }
body::after { right: -200px; bottom: -130px; background: #d8ccff; }

button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
img, svg { max-width: 100%; }

/* ------------------------------------------------------------------ a11y -- */

:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 60;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-strong);
  font-size: 11px;
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ------------------------------------------------------------------ icon -- */

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 21px; height: 21px; }

/* ------------------------------------------------------------ app window -- */

.page-shell {
  width: min(1480px, calc(100vw - 48px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  animation: shell-enter 0.8s ease both;
}

.app-window {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

/* A faint accent hairline along the top edge. */
.app-window::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(51, 85, 255, 0.28), transparent);
  content: "";
  pointer-events: none;
}

/* ------------------------------------------------------------- window bar -- */

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  flex: 0 0 auto;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.traffic-lights { display: flex; align-items: center; gap: 8px; width: 155px; }
.traffic-light {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(18, 20, 43, 0.5);
}
.traffic-light.red { background: #ff6c61; }
.traffic-light.yellow { background: #ffbd44; }
.traffic-light.green { background: #00ca4e; }

.window-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.window-title-mark {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(51, 85, 255, 0.45);
  border-radius: 7px;
  color: var(--mint);
  background: rgba(51, 85, 255, 0.1);
}
.window-title-mark .icon { width: 12px; height: 12px; }
.window-tools { display: flex; justify-content: flex-end; gap: 8px; width: 155px; }

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: 0.2s ease;
}
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel-soft);
  outline: none;
}
.icon-button.on { color: var(--mint); border-color: rgba(51, 85, 255, 0.3); background: rgba(51, 85, 255, 0.1); }

.notification-button { position: relative; }
.notification-button::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 5px;
  height: 5px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--orange);
  content: "";
}

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

.app-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

/* --------------------------------------------------------------- sidebar -- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 30px 18px 22px;
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}
[data-theme="dark"] .sidebar { background: rgba(255, 255, 255, 0.02); }

.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px; margin-bottom: 36px; }
.brand-mark {
  position: relative;
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  color: #ffffff;
  background: linear-gradient(135deg, #3355ff, #7b5cff);
  box-shadow: var(--shadow-lift);
}
.brand-mark::after {
  position: absolute;
  right: -12px;
  bottom: -20px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(18, 20, 43, 0.55);
  border-radius: 50%;
  content: "";
}
.brand-mark .icon { position: relative; z-index: 1; width: 21px; height: 21px; stroke-width: 2.1; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.04em; }
.brand-label {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav-group { margin-bottom: 26px; }
.nav-group:last-of-type { margin-bottom: 0; }
.nav-label {
  padding: 0 12px;
  margin: 0 0 9px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  margin: 3px 0;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted-light);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
a.nav-item { display: flex; }
.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  color: var(--text);
  background: rgba(18, 20, 43, 0.075);
}
.nav-item.active { box-shadow: inset 3px 0 0 var(--mint); }
.nav-item-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}
.nav-item .icon { color: var(--muted); }
.nav-item.active .icon { color: var(--mint); }
.nav-count {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(18, 20, 43, 0.07);
  font-family: var(--font-num);
  font-size: 9px;
  flex: 0 0 auto;
}
.nav-item.active .nav-count { color: var(--mint); background: rgba(51, 85, 255, 0.12); }

.sidebar-spacer { flex: 1; min-height: 18px; }

.sync-card {
  position: relative;
  overflow: hidden;
  padding: 15px;
  margin: 8px 7px 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    radial-gradient(circle at 100% 0%, rgba(51, 85, 255, 0.12), transparent 48%),
    var(--panel);
}
.sync-card::after {
  position: absolute;
  right: -24px;
  bottom: -30px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(51, 85, 255, 0.2);
  border-radius: 50%;
  content: "";
}
.sync-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint);
  font-family: var(--font-num);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(51, 85, 255, 0.12);
  animation: pulse 2s infinite;
}
.sync-title { max-width: 150px; margin: 0 0 8px; color: var(--text); font-size: 12px; font-weight: 800; line-height: 1.45; }
.sync-copy { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 20, 43, 0.04);
  transition: 0.2s ease;
}
a.user-card:hover { border-color: var(--line-strong); background: rgba(18, 20, 43, 0.07); }
.avatar {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #1e3ad6;
  background: linear-gradient(135deg, #f7d49f, #ffab81);
  font-size: 11px;
  font-weight: 800;
}
.user-copy { min-width: 0; flex: 1; }
.user-name { overflow: hidden; margin: 0 0 2px; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.user-role {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------- content -- */

.content { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 76px;
  flex: 0 0 auto;
  padding: 0 35px;
  border-bottom: 1px solid var(--line);
}
.content-header-lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 11px; }
.breadcrumb strong { overflow: hidden; color: var(--text); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-separator { color: rgba(18, 20, 43, 0.25); }
[data-theme="dark"] .breadcrumb-separator { color: rgba(255, 255, 255, 0.25); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.header-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 245px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(18, 20, 43, 0.04);
  font-size: 11px;
  cursor: text;
  transition: 0.2s ease;
}
.header-search:hover,
.header-search:focus-visible { border-color: var(--line-strong); color: var(--muted-light); background: rgba(18, 20, 43, 0.07); }
.header-search .ph { white-space: nowrap; }
.header-search kbd {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(18, 20, 43, 0.05);
  font-family: var(--font-num);
  font-size: 8px;
}

.mobile-menu { display: none; }

.content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 110px);
  padding: 32px 35px 40px;
  overflow: auto;
  scrollbar-color: rgba(18, 20, 43, 0.2) transparent;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}
.content-scroll::-webkit-scrollbar { width: 6px; }
.content-scroll::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(18, 20, 43, 0.18); }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------ animations -- */

@keyframes shell-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1180px) {
  .header-search { width: 200px; }
}

@media (max-width: 960px) {
  .page-shell { width: min(100% - 24px, 760px); margin: 12px auto; }
  .app-window { min-height: calc(100vh - 24px); }
  .app-layout { display: block; }
  .sidebar {
    position: absolute;
    z-index: 5;
    top: 62px;
    bottom: 0;
    left: 0;
    width: 250px;
    min-height: calc(100% - 62px);
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.25);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .traffic-lights { width: auto; }
  .window-title { margin-right: auto; margin-left: 14px; }
  .window-tools { width: auto; }
  .content-header { padding: 0 22px; }
  .content-scroll { max-height: none; padding: 25px 22px 35px; }
  .sidebar-backdrop { position: fixed; z-index: 4; inset: 0; display: none; background: rgba(0, 0, 0, 0.28); }
  .sidebar-backdrop.active { display: block; }
}

@media (max-width: 680px) {
  .window-title { display: none; }
  .header-search { display: none; }
  .content-header { height: 64px; padding: 0 16px; }
  .content-scroll { padding: 20px 16px 28px; }
}

@media (max-width: 420px) {
  .page-shell { width: 100%; margin: 0; }
  .app-window { min-height: 100vh; border: 0; border-radius: 0; }
  .window-bar { height: 58px; padding: 0 15px; }
  .sidebar { top: 58px; min-height: calc(100% - 58px); }
}

@media print {
  .window-bar, .sidebar, .content-header, .sidebar-backdrop { display: none !important; }
  .app-layout { display: block; }
  .content-scroll { max-height: none; overflow: visible; padding: 0; }
  .app-window { border: 0; box-shadow: none; background: #fff; }
  body { background: #fff; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
