/*
  IMA Logistics - Pack Starter shared layout
  Structure globale, themes, RTL et shell applicatif.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--starter-bg);
  color: var(--starter-text);
  font-family: var(--starter-font-sans);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

img,
svg {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--starter-primary) 45%, transparent);
  outline-offset: 3px;
}

:root,
html[data-theme="light"] {
  color-scheme: light;
  --starter-font-sans: "Inter", "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
  --starter-font-ar: "Cairo", "Tahoma", Arial, sans-serif;
  --starter-bg: #f5f7fb;
  --starter-surface: #ffffff;
  --starter-surface-soft: #eef4ff;
  --starter-card: #ffffff;
  --starter-text: #162033;
  --starter-muted: #667085;
  --starter-border: #d9e2ef;
  --starter-primary: #2563eb;
  --starter-primary-hover: #1d4ed8;
  --starter-accent: #0f766e;
  --starter-success: #059669;
  --starter-warning: #d97706;
  --starter-danger: #dc2626;
  --starter-info: #0284c7;
  --starter-sidebar-bg: #0f1f35;
  --starter-sidebar-text: #ffffff;
  --starter-sidebar-muted: #a9b8cd;
  --starter-sidebar-active: rgba(37, 99, 235, 0.22);
  --starter-radius-sm: 6px;
  --starter-radius-md: 8px;
  --starter-radius-lg: 12px;
  --starter-shadow-sm: 0 4px 14px rgba(15, 31, 53, 0.06);
  --starter-shadow-md: 0 14px 35px rgba(15, 31, 53, 0.08);
  --starter-shadow-lg: 0 24px 60px rgba(15, 31, 53, 0.14);
  --starter-sidebar-width: 272px;
  --starter-topbar-height: 74px;
  --starter-transition: 180ms ease;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --starter-bg: #0b1220;
  --starter-surface: #111c2f;
  --starter-surface-soft: #172640;
  --starter-card: #101a2c;
  --starter-text: #f3f6fb;
  --starter-muted: #9fb0c7;
  --starter-border: #26384f;
  --starter-primary: #60a5fa;
  --starter-primary-hover: #93c5fd;
  --starter-accent: #2dd4bf;
  --starter-success: #34d399;
  --starter-warning: #fbbf24;
  --starter-danger: #f87171;
  --starter-info: #38bdf8;
  --starter-sidebar-bg: #07101f;
  --starter-sidebar-text: #f8fafc;
  --starter-sidebar-muted: #94a3b8;
  --starter-sidebar-active: rgba(96, 165, 250, 0.18);
  --starter-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.22);
  --starter-shadow-md: 0 16px 42px rgba(0, 0, 0, 0.28);
  --starter-shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.36);
}

html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  font-family: var(--starter-font-ar);
}

.starter-app {
  min-height: 100vh;
  background: var(--starter-bg);
}

.starter-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--starter-sidebar-width);
  height: 100vh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--starter-sidebar-bg);
  color: var(--starter-sidebar-text);
  border-right: 1px solid color-mix(in srgb, var(--starter-border) 30%, transparent);
}

html[dir="rtl"] .starter-sidebar {
  inset: 0 0 0 auto;
  border-right: 0;
  border-left: 1px solid color-mix(in srgb, var(--starter-border) 30%, transparent);
}

.starter-sidebar-header {
  min-height: var(--starter-topbar-height);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.starter-brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--starter-radius-md);
  display: grid;
  place-items: center;
  background: var(--starter-primary);
  color: #ffffff;
  font-weight: 900;
}

.starter-brand-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.starter-brand-text strong {
  font-size: 15px;
  line-height: 1.2;
}

.starter-brand-text span {
  color: var(--starter-sidebar-muted);
  font-size: 12px;
  font-weight: 700;
}

.starter-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 14px;
}

.starter-nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--starter-radius-md);
  color: var(--starter-sidebar-muted);
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  transition: background var(--starter-transition), color var(--starter-transition);
}

.starter-nav-link:hover,
.starter-nav-link.is-active,
.starter-nav-link[aria-current="page"] {
  background: var(--starter-sidebar-active);
  color: var(--starter-sidebar-text);
}

.starter-nav-link i {
  width: 20px;
  text-align: center;
}

.starter-sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.starter-main {
  min-height: 100vh;
  margin-left: var(--starter-sidebar-width);
  display: flex;
  flex-direction: column;
}

html[dir="rtl"] .starter-main {
  margin-left: 0;
  margin-right: var(--starter-sidebar-width);
}

.starter-topbar {
  min-height: var(--starter-topbar-height);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--starter-surface) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--starter-border);
}

.starter-topbar-left,
.starter-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.starter-topbar-left {
  min-width: 0;
}

.starter-page-title {
  margin: 0;
  color: var(--starter-text);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
}

.starter-page-subtitle {
  margin: 4px 0 0;
  color: var(--starter-muted);
  font-size: 13px;
  font-weight: 600;
}

.starter-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
}

.starter-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.starter-page-header .starter-page-title {
  font-size: 26px;
}

.starter-grid {
  display: grid;
  gap: 16px;
}

.starter-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.starter-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.starter-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.starter-section {
  margin-top: 22px;
}

.starter-section-title {
  margin: 0 0 12px;
  color: var(--starter-text);
  font-size: 18px;
  font-weight: 900;
}

.starter-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgba(7, 16, 31, 0.52);
}

.starter-menu-toggle {
  display: none;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.is-loading {
  cursor: wait;
}

.is-active {
  opacity: 1;
}

.is-disabled,
[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.starter-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.starter-plan-badge {
  margin: 10px 14px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--starter-border, #d8e0ec);
  border-radius: 8px;
  background: var(--starter-surface, #ffffff);
  color: var(--starter-text, #142033);
  font-size: 12px;
}

.starter-topbar-plan-badge {
  margin: 0;
}

.starter-plan-badge-title {
  font-weight: 900;
}

.starter-plan-badge-detail {
  color: var(--starter-muted, #64748b);
  font-weight: 700;
}
