/* ================================================================
   SAHATE INDUSTRIAL PARK — TMS Design System
   Global CSS: Variables, Reset, Typography, Utilities
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Brand Colors */
  --clr-primary:        #0D2B1E;
  --clr-primary-light:  #163D2A;
  --clr-primary-mid:    #1E5236;
  --clr-primary-dark:   #0D2B1E;
  --clr-accent:         #E85D04;
  --clr-accent-hover:   #F07030;
  --clr-accent-dim:     rgba(232, 93, 4, 0.12);

  /* Surface — Light Theme (White with light gray/green gradient) */
  --clr-surface:        #F4F7F5;
  --clr-surface-1:      #FFFFFF;
  --clr-surface-2:      #E8F0EC;
  --clr-surface-3:      #D9E6DF;
  --clr-card:           #FFFFFF;
  --clr-card-border:    rgba(13, 43, 30, 0.12);
  --clr-overlay:        rgba(8, 26, 18, 0.5);

  /* Text — Dark Green Dominant */
  --clr-text-1:         #0D2B1E;
  --clr-text-2:         #163D2A;
  --clr-text-3:         #2D6A4F;
  --clr-text-4:         #52796F;

  /* Semantic */
  --clr-success:        #10B981;
  --clr-success-dim:    rgba(16, 185, 129, 0.12);
  --clr-warning:        #F59E0B;
  --clr-warning-dim:    rgba(245, 158, 11, 0.12);
  --clr-danger:         #EF4444;
  --clr-danger-dim:     rgba(239, 68, 68, 0.12);
  --clr-info:           #3B82F6;
  --clr-info-dim:       rgba(59, 130, 246, 0.12);

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-2xl: 32px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
  --shadow-xl:  0 20px 50px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 20px rgba(232, 93, 4, 0.35);
  --shadow-glow:   0 0 30px rgba(26, 82, 54, 0.5);

  /* Typography */
  --font-sans:    'Inter', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Transitions */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:   cubic-bezier(0, 0, 0.2, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   150ms;
  --duration-base:   250ms;
  --duration-slow:   400ms;
  --duration-slower: 600ms;

  /* Sidebar */
  --sidebar-w:  260px;
  --sidebar-w-collapsed: 72px;
  --topbar-h:   64px;
}

/* ── Light Theme Override ── */
[data-theme="light"] {
  --clr-surface:        #F8FAFC;
  --clr-surface-1:      #FFFFFF;
  --clr-surface-2:      #F1F5F9;
  --clr-surface-3:      #E2E8F0;
  --clr-card:           rgba(255, 255, 255, 0.95);
  --clr-card-border:    rgba(13, 43, 30, 0.1);
  --clr-overlay:        rgba(0, 0, 0, 0.4);

  --clr-text-1:         #0D2B1E;
  --clr-text-2:         #1E5236;
  --clr-text-3:         #4A6E58;
  --clr-text-4:         #94A3B8;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--clr-surface);
  color: var(--clr-text-1);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Portal page overrides — light bg, dark green text */
.portal-wrapper {
  color: #0D2B1E;
}
.portal-wrapper body {
  background: #F0F5F2;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  border: none;
}

ul, ol { list-style: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--clr-primary-dark); }
::-webkit-scrollbar-thumb { background: var(--clr-primary-mid); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--clr-accent); }

/* ── Typography Scale ── */
.text-xs   { font-size: 0.75rem;   line-height: 1.4; }
.text-sm   { font-size: 0.875rem;  line-height: 1.5; }
.text-base { font-size: 1rem;      line-height: 1.6; }
.text-lg   { font-size: 1.125rem;  line-height: 1.5; }
.text-xl   { font-size: 1.25rem;   line-height: 1.4; }
.text-2xl  { font-size: 1.5rem;    line-height: 1.3; }
.text-3xl  { font-size: 1.875rem;  line-height: 1.2; }
.text-4xl  { font-size: 2.25rem;   line-height: 1.15; }
.text-5xl  { font-size: 3rem;      line-height: 1.1; }
.text-6xl  { font-size: 3.75rem;   line-height: 1.05; }

.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold{ font-weight: 800; }
.font-black    { font-weight: 900; }

.font-display  { font-family: var(--font-display); }

/* ── Utilities ── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.items-end   { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1  { gap: var(--sp-1); }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-6  { gap: var(--sp-6); }
.gap-8  { gap: var(--sp-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.hidden   { display: none !important; }
.block    { display: block; }

.w-full   { width: 100%; }
.h-full   { height: 100%; }

.overflow-hidden   { overflow: hidden; }
.overflow-auto     { overflow: auto; }
.overflow-y-auto   { overflow-y: auto; }

.rounded-sm  { border-radius: var(--r-sm); }
.rounded-md  { border-radius: var(--r-md); }
.rounded-lg  { border-radius: var(--r-lg); }
.rounded-xl  { border-radius: var(--r-xl); }
.rounded-full { border-radius: var(--r-full); }

.uppercase   { text-transform: uppercase; }
.capitalize  { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.1em; }
.tracking-widest { letter-spacing: 0.15em; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ── Glass Card ── */
.glass {
  background: var(--clr-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--clr-card-border);
  border-radius: var(--r-lg);
}

.glass-sm {
  background: rgba(22, 52, 34, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(52, 100, 68, 0.3);
  border-radius: var(--r-md);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all var(--duration-base) var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--clr-accent);
  color: #fff;
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 0 var(--clr-accent-dim);
}
.btn-primary:hover {
  background: var(--clr-accent-hover);
  border-color: var(--clr-accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--clr-text-2);
  border-color: var(--clr-card-border);
}
.btn-ghost:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text-1);
  border-color: var(--clr-primary-mid);
}

.btn-danger {
  background: var(--clr-danger-dim);
  color: var(--clr-danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--clr-danger);
  color: #fff;
}

.btn-sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.8125rem;
  border-radius: var(--r-sm);
}

.btn-icon {
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  aspect-ratio: 1;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: var(--clr-success-dim); color: var(--clr-success); }
.badge-warning { background: var(--clr-warning-dim); color: var(--clr-warning); }
.badge-danger  { background: var(--clr-danger-dim);  color: var(--clr-danger); }
.badge-info    { background: var(--clr-info-dim);    color: var(--clr-info); }
.badge-accent  { background: var(--clr-accent-dim);  color: var(--clr-accent); }

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--clr-text-2);
}

.form-control {
  width: 100%;
  background: var(--clr-surface-1);
  border: 1px solid var(--clr-card-border);
  border-radius: var(--r-md);
  color: var(--clr-text-1);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.9375rem;
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
.form-control:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px var(--clr-accent-dim);
}
.form-control::placeholder { color: var(--clr-text-4); }

/* ── Toast Notification ── */
.toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--clr-surface-3);
  border: 1px solid var(--clr-card-border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn var(--duration-slow) var(--ease-spring) forwards;
}
.toast.removing { animation: toastOut var(--duration-base) var(--ease-in) forwards; }

.toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; }
.toast-msg   { font-size: 0.8125rem; color: var(--clr-text-3); margin-top: 2px; }

.toast-success { border-left: 3px solid var(--clr-success); }
.toast-error   { border-left: 3px solid var(--clr-danger); }
.toast-warning { border-left: 3px solid var(--clr-warning); }
.toast-info    { border-left: 3px solid var(--clr-info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(80%) scale(0.9); }
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 26, 18, 0.85);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  animation: fadeIn var(--duration-base) var(--ease);
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-card-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  animation: modalIn var(--duration-slow) var(--ease-spring);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--clr-card-border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--clr-text-3);
  transition: all var(--duration-fast) var(--ease);
}
.modal-close:hover { background: var(--clr-danger-dim); color: var(--clr-danger); }

.modal-body   { padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.modal-footer { padding: var(--sp-4) var(--sp-6) var(--sp-6); display: flex; gap: var(--sp-3); justify-content: flex-end; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--clr-card-border);
  border: none;
  margin: 0;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--clr-text-1);
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--clr-text-3);
  margin-top: var(--sp-1);
}

/* ── Responsive helpers ── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}
