/**
 * Sharik internal workspace and authentication refresh.
 * Loaded only by dashboard/auth layouts so the public marketplace remains intact.
 */

:root {
  --admin-bg: var(--admin-bg-page);
  --admin-surface: var(--admin-bg-surface);
  --admin-text: var(--admin-text-primary);
  --admin-muted: var(--admin-text-muted);
  --admin-border: var(--admin-border-subtle);
  --internal-sidebar-light: #ffffff;
  --internal-sidebar-light-text: #334155;
  --internal-sidebar-light-muted: #718096;
}

/* ---------- Stable workspace shell ---------- */
.admin-shell {
  min-width: 0;
  overflow-x: clip;
  background:
    radial-gradient(circle at 78% -10%, rgba(37, 99, 235, .07), transparent 28rem),
    var(--admin-bg-page);
}

.admin-main {
  width: auto;
  max-width: none;
  min-height: 100vh;
  overflow: clip;
}

.admin-content-wrap {
  width: min(100%, 1480px);
  max-width: 1480px;
  min-width: 0;
  padding: clamp(1.25rem, 2.4vw, 2.25rem);
}

.admin-content-wrap > * {
  min-width: 0;
}

.admin-topbar {
  min-width: 0;
  padding-inline: clamp(.8rem, 2vw, 1.5rem);
  background: color-mix(in srgb, var(--admin-bg-surface) 92%, transparent);
  border-color: var(--admin-border-subtle);
}

.admin-topbar.scrolled {
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.admin-topbar-right,
.admin-topbar-left,
.topbar-actions {
  min-width: 0;
}

.admin-topbar-left {
  justify-content: flex-end;
}

.sidebar-launch {
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0 !important;
  justify-content: center;
  color: var(--admin-text-secondary) !important;
  border: 1px solid var(--admin-border-subtle) !important;
  background: var(--admin-bg-surface) !important;
}

.dashboard-topbar-brand {
  display: none;
  align-items: center;
  gap: .55rem;
  color: var(--admin-text-primary);
  font-weight: 850;
  text-decoration: none;
}

.dashboard-topbar-brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--admin-border-subtle);
}

/* Visible appearance switch in the internal workspace header. */
.dashboard-theme-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 40px;
  padding: .45rem .7rem !important;
  color: var(--admin-text-secondary) !important;
  border: 1px solid var(--admin-border-subtle) !important;
  background: var(--admin-bg-surface) !important;
  border-radius: 12px !important;
  white-space: nowrap;
}
.dashboard-theme-toggle:hover {
  color: var(--admin-primary) !important;
  border-color: color-mix(in srgb, var(--admin-primary) 45%, var(--admin-border-subtle)) !important;
  background: var(--admin-primary-soft) !important;
}
.dashboard-theme-toggle .theme-sun,
.dashboard-theme-toggle .theme-moon { display: none !important; flex: 0 0 auto; }
html[data-theme="dark"] .dashboard-theme-toggle .theme-sun { display: block !important; }
html:not([data-theme="dark"]) .dashboard-theme-toggle .theme-moon { display: block !important; }
.dashboard-theme-toggle [data-theme-label] { font-size: .74rem; font-weight: 700; }

@media (max-width: 1180px) {
  .dashboard-theme-toggle [data-theme-label] { display: none; }
  .dashboard-theme-toggle { width: 40px; padding: 0 !important; }
}

/* ---------- Sidebar: light follows light, dark follows dark ---------- */
.admin-sidebar {
  background: var(--internal-sidebar-light) !important;
  color: var(--internal-sidebar-light-text);
  border-inline-end: 1px solid var(--admin-border-subtle);
  box-shadow: -12px 0 32px rgba(15, 23, 42, .035);
}

.admin-sidebar-brand,
.admin-sidebar-user {
  border-color: var(--admin-border-subtle);
}

.admin-sidebar-user {
  background: #f8fafc;
}

.admin-brand-link,
.admin-brand-title strong,
.admin-sidebar-user-info strong {
  color: #10213d !important;
}

.admin-brand-title span,
.admin-group-label {
  color: var(--internal-sidebar-light-muted) !important;
}

.admin-brand-icon {
  overflow: hidden;
  padding: 2px;
  background: #fff;
  border: 1px solid #dbe4f0;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .12);
}

.admin-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.admin-user-avatar {
  background: #eaf2ff;
  color: #1d4ed8;
  border-color: #c8dcff;
}

.admin-role-chip {
  background: #eaf2ff;
  color: #1d4ed8;
}

.admin-role-chip.owner {
  background: #fff6d8;
  color: #9a6700;
}

.admin-nav-body {
  scrollbar-color: #cbd5e1 transparent;
}

.admin-nav-item {
  min-height: 44px;
  color: var(--internal-sidebar-light-text) !important;
}

.admin-nav-item svg {
  color: #7184a0;
  stroke-width: 1.9;
}

.admin-nav-item:hover {
  color: #174fbf !important;
  background: #f1f6ff !important;
  transform: translateX(-2px);
}

.admin-nav-item:hover svg {
  color: #2563eb;
}

.admin-nav-item.active {
  color: #1d4ed8 !important;
  background: #eaf2ff !important;
  box-shadow: inset -3px 0 #2563eb;
}

.admin-nav-item.active svg {
  color: #2563eb;
}

.admin-sidebar-footer {
  gap: .55rem;
  padding: .8rem;
  background: #f8fafc;
  border-color: var(--admin-border-subtle);
}

.admin-sidebar-footer .admin-market-link {
  flex: 1;
  justify-content: center;
  padding: .55rem .7rem;
  color: #1d4ed8 !important;
  background: #eaf2ff !important;
  border: 1px solid #c8dcff;
}

.admin-sidebar-footer form .admin-nav-item {
  width: 42px;
  height: 42px;
  padding: 0 !important;
  justify-content: center;
  background: #fff1f2 !important;
  color: #dc2626 !important;
}

html[data-theme="dark"] .admin-sidebar {
  background: #081424 !important;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, .14);
  box-shadow: -12px 0 36px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .admin-sidebar-brand,
html[data-theme="dark"] .admin-sidebar-user,
html[data-theme="dark"] .admin-sidebar-footer {
  background: rgba(255, 255, 255, .018);
  border-color: rgba(148, 163, 184, .14);
}

html[data-theme="dark"] .admin-brand-link,
html[data-theme="dark"] .admin-brand-title strong,
html[data-theme="dark"] .admin-sidebar-user-info strong {
  color: #f8fafc !important;
}

html[data-theme="dark"] .admin-brand-icon {
  background: #fff;
  border-color: rgba(255, 255, 255, .16);
}

html[data-theme="dark"] .admin-nav-item {
  color: #d8e1ed !important;
}

html[data-theme="dark"] .admin-nav-item:hover {
  color: #fff !important;
  background: rgba(96, 165, 250, .1) !important;
}

html[data-theme="dark"] .admin-nav-item.active {
  color: #fff !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .26);
}

html[data-theme="dark"] .admin-sidebar-footer .admin-market-link {
  color: #bfdbfe !important;
  background: rgba(37, 99, 235, .14) !important;
  border-color: rgba(96, 165, 250, .22);
}

/* ---------- Shared internal surfaces ---------- */
.admin-card,
.panel,
.stat-card {
  border-color: var(--admin-border-subtle);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03), 0 10px 30px rgba(15, 23, 42, .035);
}

.admin-card {
  min-width: 0;
  overflow: hidden;
}

.admin-page-header {
  padding: .25rem 0;
}

.admin-page-title {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}

.admin-page-subtitle {
  max-width: 720px;
  font-size: .94rem;
  line-height: 1.7;
}

.admin-btn {
  min-height: 42px;
  border-radius: 11px;
}

.admin-btn-primary {
  background: linear-gradient(135deg, #2f6df2, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .18);
}

.admin-input,
.admin-select {
  min-height: 48px;
  border-radius: 11px;
  background: var(--admin-bg-surface);
  color: var(--admin-text-primary);
}

textarea.admin-input {
  min-height: 140px;
  resize: vertical;
}

.admin-input::placeholder,
.admin-select::placeholder {
  color: color-mix(in srgb, var(--admin-text-muted) 74%, transparent);
}

.admin-input:focus,
.admin-select:focus {
  box-shadow: 0 0 0 4px var(--admin-primary-ring);
}

.admin-table-container {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.admin-table {
  min-width: 840px;
}

.admin-table thead th {
  background: var(--admin-bg-surface-subtle);
}

.projects-content-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
}

.projects-table-card {
  width: 100%;
}

/* ---------- Publish-request builder ---------- */
.request-page-header {
  margin-bottom: 1.5rem;
}

.request-draft-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 36px;
  padding: .45rem .75rem;
  border: 1px solid var(--admin-success-border);
  border-radius: 999px;
  background: var(--admin-success-soft);
  color: var(--admin-success);
  font-size: .78rem;
  font-weight: 700;
}

.request-draft-badge svg {
  width: 16px;
  height: 16px;
}

.request-builder-container {
  width: 100%;
  max-width: 1200px !important;
  margin-inline: auto !important;
}

.request-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px !important;
  align-items: start !important;
  gap: 1.5rem !important;
}

.request-main-card .admin-card-body {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.request-help-rail {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
  position: sticky;
  top: calc(var(--admin-topbar-height) + 1.25rem);
}

.request-help-rail .admin-card-body {
  padding: 1.15rem;
}

.admin-wizard-progress {
  isolation: isolate;
  gap: .4rem;
  overflow: hidden;
}

.admin-wizard-progress .progress-line {
  inset-inline: 8% !important;
  background: var(--admin-border-subtle) !important;
}

.admin-wizard-progress .progress-step {
  flex: 1;
  min-width: 0;
  padding-inline: .25rem;
  background: var(--admin-bg-surface) !important;
}

.admin-wizard-progress .progress-step > span {
  display: block;
  color: var(--admin-text-muted) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-wizard-progress .progress-step.active > span {
  color: var(--admin-text-primary) !important;
}

.admin-wizard-progress .step-circle {
  background: var(--admin-bg-surface) !important;
  border-color: var(--admin-border-strong) !important;
  color: var(--admin-text-muted) !important;
}

.admin-skills-grid {
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important;
}

.admin-checkbox-card,
.admin-radio-card,
.admin-file-upload {
  background: var(--admin-bg-surface-subtle) !important;
  border-color: var(--admin-border-subtle) !important;
  color: var(--admin-text-primary);
}

.admin-checkbox-card:has(input:checked),
.admin-radio-card:has(input:checked) {
  background: var(--admin-primary-soft) !important;
  border-color: var(--admin-primary) !important;
}

/* ---------- Authentication: one balanced visual system ---------- */
.auth-layout {
  min-height: 100svh;
  height: auto;
  background:
    radial-gradient(circle at 86% 10%, rgba(37, 99, 235, .12), transparent 25rem),
    radial-gradient(circle at 8% 88%, rgba(14, 165, 233, .08), transparent 24rem),
    #f5f8fc;
  overflow-y: auto;
}

.auth-header {
  position: sticky;
  top: 0;
  padding-block: .75rem;
  background: rgba(245, 248, 252, .86);
  border-bottom: 1px solid rgba(203, 213, 225, .72);
  backdrop-filter: blur(16px);
}

.auth-header-inner {
  min-height: 50px;
}

.auth-main {
  padding: clamp(1rem, 3vw, 2.5rem) 0 clamp(2rem, 5vw, 4rem);
}

.auth-split {
  grid-template-columns: minmax(360px, .92fr) minmax(430px, 1.08fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  width: min(1240px, calc(100% - 2.5rem));
}

.login-card,
.auth-card {
  max-width: 540px;
  border-radius: 24px;
  border: 1px solid #dce5f0;
  box-shadow: 0 24px 60px -32px rgba(15, 23, 42, .28), 0 8px 24px rgba(15, 23, 42, .05);
}

.login-card {
  max-width: 500px;
}

.login-showcase,
.auth-register-page .auth-brand {
  max-width: 590px;
  padding: clamp(1.6rem, 3vw, 2.6rem);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(96, 165, 250, .32), transparent 18rem),
    linear-gradient(145deg, #0b1f3a, #123666 68%, #174ea6);
  box-shadow: 0 28px 70px -38px rgba(11, 31, 58, .65);
  color: #dbeafe;
}

.login-showcase::before {
  display: none;
}

.login-showcase .showcase-heading,
.login-showcase .feature-text strong,
.auth-register-page .auth-brand h1,
.auth-register-page .auth-benefit strong {
  color: #fff;
}

.login-showcase .showcase-description,
.login-showcase .feature-text p,
.auth-register-page .auth-brand > p,
.auth-register-page .auth-benefit small {
  color: #bfcee2;
}

.login-showcase .highlight-blue {
  color: #8ec5ff;
}

.login-showcase .showcase-badge,
.auth-register-page .auth-brand .eyebrow {
  color: #dbeafe;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
}

.login-showcase .feature-icon-box,
.auth-register-page .auth-benefit-icon {
  color: #93c5fd;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .13);
}

.login-showcase .showcase-mini-dashboard {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(255, 255, 255, .38);
  box-shadow: 0 20px 45px -28px rgba(0, 0, 0, .65);
}

.auth-register-page .auth-brand {
  text-align: start;
}

.auth-register-page .auth-benefits {
  margin-inline: 0;
}

.auth-register-page .auth-card {
  width: 100%;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.auth-card .field,
.login-input {
  min-height: 50px;
  border-radius: 12px;
}

html[data-theme="dark"] .auth-layout {
  background:
    radial-gradient(circle at 86% 10%, rgba(37, 99, 235, .15), transparent 25rem),
    #050b14;
}

html[data-theme="dark"] .auth-header {
  background: rgba(5, 11, 20, .84);
  border-color: rgba(148, 163, 184, .14);
}

html[data-theme="dark"] .auth-brand-logo,
html[data-theme="dark"] .auth-brand-logo .brand-text {
  color: #f8fafc !important;
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .auth-card {
  border-color: rgba(148, 163, 184, .16);
  background: #0a1524;
}

html[data-theme="dark"] .login-showcase,
html[data-theme="dark"] .auth-register-page .auth-brand {
  border: 1px solid rgba(96, 165, 250, .15);
}

/* ---------- Responsive behavior ---------- */
@media (max-width: 1180px) {
  .admin-topbar .admin-breadcrumbs,
  .admin-topbar-left > .admin-btn-secondary {
    display: none !important;
  }

  .request-builder-layout {
    grid-template-columns: minmax(0, 1fr) 245px !important;
    gap: 1rem !important;
  }
}

@media (max-width: 1024px) {
  .admin-main,
  html.admin-sidebar-collapsed .admin-main {
    margin-inline-start: 0;
    width: 100%;
  }

  .admin-sidebar,
  html.admin-sidebar-collapsed .admin-sidebar {
    width: min(310px, 88vw);
    transform: translateX(105%);
    z-index: 120;
  }

  .admin-sidebar-backdrop {
    z-index: 110;
  }

  html.admin-sidebar-mobile-open .admin-sidebar {
    transform: translateX(0);
  }

  html.admin-sidebar-mobile-open .admin-brand-title,
  html.admin-sidebar-mobile-open .admin-sidebar-user-info,
  html.admin-sidebar-mobile-open .admin-group-label,
  html.admin-sidebar-mobile-open .admin-nav-item span,
  html.admin-sidebar-mobile-open .admin-nav-badge {
    display: flex !important;
  }

  .dashboard-topbar-brand {
    display: inline-flex;
  }

  .request-builder-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .request-help-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    position: static;
  }

  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    max-width: 680px;
  }

  .login-form-column,
  .login-showcase-column,
  .login-card,
  .login-showcase,
  .auth-register-page .auth-card,
  .auth-register-page .auth-brand {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .admin-topbar {
    height: 62px;
    padding-inline: .7rem;
  }

  .admin-topbar-left {
    flex: 0 1 auto;
  }

  .dashboard-topbar-brand span,
  .topbar-actions .admin-badge,
  .topbar-actions details.dropdown:not(.quick-create),
  .topbar-actions > a[href*="messages"] {
    display: none !important;
  }

  .topbar-actions {
    gap: .25rem !important;
  }

  #theme-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0 !important;
    justify-content: center;
  }

  .admin-content-wrap {
    padding: 1.1rem .8rem calc(5.5rem + env(safe-area-inset-bottom));
  }

  .admin-page-header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 1.15rem;
  }

  .admin-page-actions,
  .admin-page-actions .admin-btn {
    width: 100%;
  }

  .admin-page-actions .admin-btn {
    justify-content: center;
  }

  .request-help-rail {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .admin-wizard-progress {
    justify-content: space-between !important;
    overflow: hidden;
    padding-bottom: .5rem;
  }

  .admin-wizard-progress .progress-line {
    display: none;
  }

  .admin-wizard-progress .progress-step {
    flex: 1 1 20%;
    min-width: 0;
  }

  .admin-wizard-progress .progress-step > span {
    font-size: .65rem !important;
  }

  .request-wizard-step .admin-grid,
  .request-wizard-step [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .admin-card-head[role="search"] {
    align-items: stretch !important;
    flex-direction: column;
  }

  .admin-card-head[role="search"] > * {
    width: 100%;
    min-width: 0 !important;
  }

  .admin-card-head[role="search"] .admin-btn {
    width: 100%;
  }

  .auth-header {
    position: relative;
  }

  .auth-header-inner {
    min-height: 44px;
  }

  .auth-brand-logo .brand-text,
  .btn-auth-back span {
    display: none;
  }

  .btn-auth-back {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }

  .auth-split {
    width: min(100% - 1rem, 620px);
    padding-block: .25rem 1.5rem;
  }

  .login-showcase-column,
  .auth-register-page .auth-brand {
    display: none;
  }

  .login-card,
  .auth-register-page .auth-card {
    padding: 1.25rem;
    border-radius: 18px;
  }

  .auth-register-page .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 430px) {
  .topbar-actions > a[href*="notifications"] {
    display: none !important;
  }

  .admin-page-title {
    font-size: 1.55rem;
  }

  .request-main-card .admin-card-body {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  .admin-main,
  .admin-nav-item {
    transition: none !important;
  }
}
