/* Layik admin — soft mint dashboard (RTL) */

:root {
  --sb-w: 236px;
  --sb-w-mini: 76px;
  --content-max: none;
  --content-pad: 18px 20px 28px;
  --sb-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 68px;
  --radius: 16px;
  --font: "ALKATIPTorTom", "Segoe UI", Tahoma, sans-serif;

  --c-bg: #f4f6f9;
  --c-panel: #ffffff;
  --c-line: #e8edf3;
  --c-text: #1f2937;
  --c-muted: #8b95a5;

  --mint: #00b87a;
  --mint-strong: #00a56e;
  --mint-soft: #e8faf3;
  --mint-mid: #b6f0d6;
}

* { box-sizing: border-box; }

.admin-body,
.auth-shell {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 100% -10%, #e7fff5 0%, transparent 55%),
    radial-gradient(900px 420px at 0% 0%, #eef3ff 0%, transparent 50%),
    var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  font-weight: 400;
}

/* Flat weight: no bold across all admin pages (CSS / Tailwind / defaults) */
.admin-body,
.admin-body *,
.admin-body *::before,
.admin-body *::after,
.auth-shell,
.auth-shell *,
.auth-shell *::before,
.auth-shell *::after {
  font-weight: 400 !important;
}

/* Logged-in shell: only main content scrolls; sidebar stays put */
.admin-body:has(.admin-shell) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.ltr { direction: ltr; unicode-bidi: embed; }

.admin-shell {
  height: 100%;
  max-height: 100%;
  display: flex;
  width: 100%;
  overflow: hidden;
  padding: 14px;
  gap: 14px;
}

.sb-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.sb-header {
  min-height: var(--header-h);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 6px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.sb-header-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.sb-crumb {
  font-size: 14px;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sb-header-end {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sb-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--c-line);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.sb-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #34d399, #059669);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.sb-header-user-meta { min-width: 0; }
.sb-header-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-header-role {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 1px;
}
.sb-version {
  font-size: 11px;
  color: var(--c-muted);
}

.sb-content {
  flex: 1;
  min-height: 0;
  padding: var(--content-pad);
  overflow: auto;
  overscroll-behavior: contain;
}

.sb-content-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sb-content-inner.is-wide {
  max-width: none;
}

.sb-flash {
  border-radius: 16px;
  border: 1px solid var(--c-line);
  padding: 12px 16px;
  font-size: 13px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  overflow-wrap: anywhere;
}
.sb-flash.is-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.sb-flash.is-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.sb-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-line);
  background: #fff;
  color: #6b7280;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}
.sb-icon-btn:hover {
  background: var(--mint-soft);
  color: var(--mint-strong);
  border-color: var(--mint-mid);
}

/* ========== Sidebar ========== */
.sb {
  width: var(--sb-w);
  flex: 0 0 var(--sb-w);
  max-width: 100%;
  background: #fff;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06);
  transition: flex-basis .28s var(--sb-ease), width .28s var(--sb-ease);
  z-index: 40;
  position: relative;
}

.sb-top {
  min-height: 72px;
  padding: 16px 14px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sb-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #fff5f5;
  border: 1px solid #ffe0e0;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(245, 86, 77, 0.12);
  overflow: hidden;
}
.sb-logo img,
.sb-logo svg {
  width: 32px;
  height: 32px;
  display: block;
}

.sb-brand-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.sb-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.sb-nav {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overscroll-behavior: contain;
}

.sb-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sb-item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: #6b7280;
  text-decoration: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  width: 100%;
  text-align: start;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .15s ease;
  overflow: hidden;
}

.sb-item:hover {
  background: #f3f6f9;
  color: #111827;
}

.sb-item.is-active {
  background: var(--mint);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(0, 184, 122, 0.28);
}

.sb-txt {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: start;
}

.sb-bottom {
  padding: 10px 12px 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sb-bottom form { margin: 0; min-width: 0; }

.sb-promo {
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(160deg, #e8faf3 0%, #f0fdf8 55%, #eef6ff 100%);
  border: 1px solid #d8f5e8;
}
.sb-promo-title {
  font-size: 13px;
  font-weight: 700;
  color: #065f46;
}
.sb-promo-text {
  font-size: 11.5px;
  color: #6b7280;
  margin: 6px 0 12px;
  line-height: 1.5;
}
.sb-promo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--mint);
  color: #fff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 16px rgba(0, 184, 122, 0.25);
}
.sb-promo-btn:hover { background: var(--mint-strong); }

.sb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 6px;
  min-width: 0;
  overflow: hidden;
}

.sb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--mint-strong);
  border: 1px solid var(--mint-mid);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.sb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sb-user-meta {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.sb-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-id {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-settings-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  background: #f8fafc;
  color: #64748b;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.sb-settings-btn:hover {
  background: var(--mint-soft);
  color: var(--mint-strong);
  border-color: var(--mint-mid);
}
.sb-settings-btn svg { width: 16px; height: 16px; }

.admin-shell.is-collapsed .sb-avatar { cursor: pointer; }
.admin-shell.is-collapsed .sb-settings-btn { display: none; }

/* Profile modal */
.ad-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ad-mask.is-open { display: flex; }
.ad-modal {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e8edf3;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
}
.ad-modal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.ad-modal-h h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.ad-modal-b {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}
.ad-modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  flex-shrink: 0;
}
.ad-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 5px;
  font-weight: 500;
}
.ad-input {
  width: 100%;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  background: #fff;
  outline: none;
  font-family: inherit;
}
.ad-input:focus {
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}
.ad-input.ltr { direction: ltr; text-align: left; }
.ad-hint { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.ad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  background: #0f766e;
  color: #fff;
  font-family: inherit;
}
.ad-btn.ghost {
  background: #fff;
  color: #475569;
  border: 1px solid #dbe3ec;
}
.ad-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ad-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--mint-strong);
  border: 1px solid var(--mint-mid);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.ad-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-file {
  font-size: 12px;
  color: #64748b;
}
.ad-sec {
  border-top: 1px dashed #e2e8f0;
  padding-top: 12px;
  margin-top: 4px;
}
.ad-sec-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
}

.sb-header-avatar {
  overflow: hidden;
}
.sb-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sb-logout { color: #ef4444; }
.sb-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

.sb .sb-icon-btn {
  border-color: var(--c-line);
  background: #f8fafc;
  color: #6b7280;
  box-shadow: none;
}
.sb .sb-icon-btn:hover {
  background: var(--mint-soft);
  color: var(--mint-strong);
  border-color: var(--mint-mid);
}

.sb-only-mobile { display: none; }
.sb-only-desktop { display: inline-flex; }

.sb-expand-fab {
  display: none;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mint-mid);
  background: var(--mint-soft);
  color: var(--mint-strong);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.sb-expand-fab:hover {
  background: var(--mint);
  color: #fff;
  border-color: var(--mint);
}

/* ========== Desktop collapse ========== */
.admin-shell.is-collapsed .sb {
  width: var(--sb-w-mini);
  flex-basis: var(--sb-w-mini);
}

.admin-shell.is-collapsed .sb-brand-text,
.admin-shell.is-collapsed .sb-txt,
.admin-shell.is-collapsed .sb-user-meta,
.admin-shell.is-collapsed .sb-sub,
.admin-shell.is-collapsed .sb-promo {
  display: none !important;
}

.admin-shell.is-collapsed .sb-top {
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 14px 8px 8px;
  gap: 10px;
}
.admin-shell.is-collapsed .sb-brand {
  justify-content: center;
  flex: none;
}
.admin-shell.is-collapsed .sb-only-desktop { display: none !important; }
.admin-shell.is-collapsed .sb-expand-fab { display: inline-flex; }

.admin-shell.is-collapsed .sb-nav {
  padding: 8px;
  align-items: stretch;
}

.admin-shell.is-collapsed .sb-item {
  justify-content: center;
  padding: 12px 0;
  border-radius: 16px;
  position: relative;
  gap: 0;
}
.admin-shell.is-collapsed .sb-bottom { padding: 8px; }
.admin-shell.is-collapsed .sb-user {
  justify-content: center;
  padding: 4px 0;
}

.admin-shell.is-collapsed .sb-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  inset-inline-end: calc(100% + 10px);
  transform: translateY(-50%);
  background: #111827;
  color: #fff;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

#sidebar-toggle { display: none; }

/* ========== Mobile ========== */
.sb-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 45;
  opacity: 0;
  transition: opacity .2s ease;
  backdrop-filter: blur(2px);
}
.sb-mask.is-show { opacity: 1; }

@media (max-width: 1023px) {
  .admin-shell {
    display: block;
    padding: 0;
    gap: 0;
  }

  .sb {
    position: fixed;
    top: 10px;
    bottom: 10px;
    inset-inline-end: 10px;
    width: min(290px, 86vw);
    flex: none;
    min-height: auto;
    transform: translateX(110%);
    transition: transform .28s var(--sb-ease);
    box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
    z-index: 50;
  }

  .admin-shell.is-mobile-open .sb {
    transform: translateX(0) !important;
  }

  .sb-main {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .sb-only-mobile { display: inline-flex; }
  .sb-only-desktop { display: none !important; }
  .sb-expand-fab { display: none !important; }
  .sb-header-user-meta { display: none; }

  .admin-shell.is-collapsed .sb {
    width: min(290px, 86vw);
  }
  .admin-shell.is-collapsed .sb-brand-text,
  .admin-shell.is-collapsed .sb-txt,
  .admin-shell.is-collapsed .sb-user-meta,
  .admin-shell.is-collapsed .sb-sub,
  .admin-shell.is-collapsed .sb-promo {
    display: block !important;
  }
  .admin-shell.is-collapsed .sb-txt { display: block !important; }
  .admin-shell.is-collapsed .sb-promo-btn { display: inline-flex !important; }
  .admin-shell.is-collapsed .sb-item {
    justify-content: flex-start;
    padding: 10px 14px;
    gap: 10px;
    border-radius: 999px;
  }
  .admin-shell.is-collapsed .sb-top {
    flex-direction: row;
    justify-content: space-between;
    padding: 16px 14px 8px;
  }
  .admin-shell.is-collapsed .sb-brand {
    flex: 1;
    justify-content: flex-start;
  }

  #sidebar-open { display: inline-flex; }
  #sidebar-toggle { display: none !important; }

  .sb-header { padding: 12px 14px 4px; }
  .sb-content { padding: 12px 14px 20px; }
}

@media (min-width: 1024px) {
  :root {
    --sb-w: 236px;
    --sb-w-mini: 76px;
    --content-max: none;
    --content-pad: 18px 24px 28px;
  }

  #sidebar-open { display: none; }
  #sidebar-toggle { display: inline-flex; }
}

@media (min-width: 1280px) {
  :root {
    --sb-w: 248px;
    --content-pad: 20px 28px 32px;
  }
  .admin-shell { padding: 16px; gap: 16px; }
}

@media (min-width: 1536px) {
  :root {
    --sb-w: 260px;
    --content-pad: 22px 32px 36px;
  }
}

@media (min-width: 1920px) {
  :root {
    --sb-w: 272px;
    --content-pad: 24px 40px 40px;
  }
}
