/* ════════════════════════════════════════════════════════
   Exoty-Profils v5 — Design System
   Dark industrial theme · Full responsive · No zoom needed
   ════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  --bg:        #0b1120;
  --surface:   #141e30;
  --surface2:  #1c2a40;
  --surface3:  #243350;
  --border:    #2d3f5a;
  --border2:   #3a5070;
  --primary:   #3b82f6;
  --primary-d: #2563eb;
  --accent:    #f59e0b;
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --sidebar-w: 230px;
  --header-h:  56px;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: .9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════
   PAGE LAYOUT (fixed header + sidebar + main + footer)
   ════════════════════════════════════════════════════════ */

/* Fixed header at top */
.it-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: .75rem;
  box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(0,0,0,.4);
}
.it-header-brand {
  display: flex; align-items: center; gap: .4rem;
  font-size: 1.05rem; font-weight: 700;
  color: var(--accent);
  letter-spacing: .03em;
  white-space: nowrap;
  text-decoration: none;
}
.it-header-brand:hover { color: var(--accent); }
.it-header-spacer { flex: 1; }
.it-header-right {
  display: flex; align-items: center;
  gap: .5rem; flex-shrink: 0;
}
.it-user-pill {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .25rem .75rem;
  font-size: .8rem;
  color: var(--text);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.it-user-pill .role-badge {
  font-size: .6rem; font-weight: 700;
  background: var(--accent);
  color: #000;
  border-radius: 100px;
  padding: 1px 5px;
  flex-shrink: 0;
}
/* Hamburger — hidden on desktop */
#menuBtn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  width: 36px; height: 36px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
#menuBtn:hover { background: var(--surface2); color: var(--text); }

/* Body shifted down by header */
body.has-layout { padding-top: var(--header-h); }

/* Overlay behind mobile sidebar */
#sidebarOverlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 700;
  cursor: pointer;
}
#sidebarOverlay.visible { display: block; }

/* Sidebar */
.it-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 800;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  /* Desktop: always visible */
}

/* Sidebar inner padding */
.it-sidebar-inner {
  padding: .75rem .5rem 1rem;
  flex: 1;
}
/* Sidebar close button — hidden on desktop */
.it-sidebar-close-btn {
  display: none;
  margin: .5rem .5rem .25rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  padding: .3rem .6rem;
  font-size: .78rem;
  cursor: pointer;
  align-items: center;
  gap: .3rem;
  align-self: flex-start;
}
.it-sidebar-close-btn:hover { background: var(--surface2); color: var(--text); }

/* Nav */
.it-nav-section {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  padding: .6rem .75rem .2rem;
}
.it-nav-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: .875rem;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
  cursor: pointer;
  text-decoration: none;
  min-height: 40px; /* touch friendly */
}
.it-nav-link:hover { background: var(--surface2); color: var(--text); }
.it-nav-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.it-nav-link i { width: 15px; text-align: center; flex-shrink: 0; font-size: .85rem; }
.it-nav-badge {
  margin-left: auto;
  font-size: .6rem;
  background: var(--primary);
  color: #fff;
  border-radius: 100px;
  padding: 1px 6px;
  font-weight: 700;
}
.it-nav-link.active .it-nav-badge { background: rgba(255,255,255,.3); }

/* Main content area */
.it-main {
  margin-left: var(--sidebar-w);
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
}

/* Page title bar */
.it-topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.it-page-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Content scroll area */
.it-content {
  flex: 1;
  padding: 1.5rem;
  overflow-x: hidden;
}

/* Footer */
.it-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: .6rem 1.5rem;
  flex-shrink: 0;
}
.it-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .72rem;
  color: var(--text3);
}

/* ════════════════════════════════════════════════════════
   COMPONENTS
   ════════════════════════════════════════════════════════ */

/* Cards */
.it-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.it-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Forms */
.form-label {
  color: var(--text2);
  font-size: .82rem;
  margin-bottom: .25rem;
  display: block;
}
.form-control, .form-select {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  font-size: .9rem;
  padding: .55rem .75rem;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.18) !important;
  color: var(--text) !important;
  background: var(--bg) !important;
}
.form-control::placeholder { color: var(--text3); }
.form-control-sm, .form-select-sm {
  font-size: .82rem !important;
  padding: .35rem .6rem !important;
}
textarea.form-control { resize: vertical; min-height: 88px; }
.input-group-text {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text3) !important;
  border-radius: var(--radius) 0 0 var(--radius) !important;
}
.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child) {
  border-radius: 0 var(--radius) var(--radius) 0 !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: .5rem 1rem;
  font-size: .875rem;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  border: 1px solid transparent;
  min-height: 38px;
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; min-height: 30px; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; min-height: 48px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-warning { background: var(--accent); border-color: var(--accent); color: #111; }
.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text2);
}
.btn-outline-secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-outline-light {
  background: transparent;
  border-color: rgba(255,255,255,.2);
  color: var(--text2);
}
.btn-outline-light:hover { background: rgba(255,255,255,.08); color: var(--text); }
.btn-outline-danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn-outline-danger:hover { background: #7f1d1d22; }
.btn-outline-success { background: transparent; border-color: #065f46; color: #6ee7b7; }

/* Tables */
.table { color: var(--text); width: 100%; font-size: .875rem; border-collapse: collapse; }
.table th { color: var(--text3); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.table th, .table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.table tbody tr:hover td { background: var(--surface2); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Alerts */
.alert {
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert .btn-close { margin-left: auto; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; flex-shrink: 0; }
.alert-success { background: #064e3b22; border-color: #065f4655; color: #6ee7b7; }
.alert-danger  { background: #7f1d1d22; border-color: #7f1d1d55; color: #fca5a5; }
.alert-warning { background: #78350f22; border-color: #78350f55; color: #fcd34d; }
.alert-info    { background: #1e3a5f22; border-color: #1e40af55; color: #93c5fd; }

/* Badges */
.badge {
  display: inline-block;
  padding: .18rem .5rem;
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-primary  { background: var(--primary);  color: #fff; }
.badge-success  { background: var(--success);  color: #fff; }
.badge-warning  { background: var(--accent);   color: #000; }
.badge-danger   { background: var(--danger);   color: #fff; }
.badge-muted    { background: var(--surface3); color: var(--text2); }
/* History */
.it-badge-profil    { background: #1d4ed8; color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }
.it-badge-avatar    { background: #7c3aed; color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }
.it-badge-photo     { background: #065f46; color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }
.it-badge-done      { background: var(--success); color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }
.it-badge-error     { background: var(--danger);  color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }
.it-badge-pending   { background: var(--text3);   color: #fff; padding: .2rem .55rem; border-radius: 100px; font-size: .7rem; font-weight: 600; }

/* GPO permission toggle chips */
.gpo-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .6rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: .75rem;
  color: var(--text3);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
  white-space: nowrap;
}
.gpo-chip input[type="checkbox"] { display: none; }
.gpo-chip.checked {
  border-color: var(--gpo-c, var(--primary));
  background: color-mix(in srgb, var(--gpo-c, var(--primary)) 15%, transparent);
  color: var(--gpo-c, var(--primary));
}
.gpo-chip.locked { opacity: .45; cursor: not-allowed; }
.gpo-chip i { font-size: .7rem; }

/* Login page */
.it-login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.it-login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.6);
}
.it-login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.it-login-logo .logo-icon {
  font-size: 2.5rem;
  color: var(--accent);
}
.it-login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-top: .4rem;
}
.it-login-logo p {
  font-size: .82rem;
  color: var(--text3);
  margin-top: .2rem;
}

/* Drop zone */
.it-drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  background: var(--bg);
  transition: border-color .2s, background .2s;
}
.it-drop-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%; cursor: pointer;
}
.it-drop-zone.drag-over { border-color: var(--accent); background: #1a2236; }
.it-drop-icon { font-size: 2rem; color: var(--text3); margin-bottom: .6rem; }
.it-drop-zone p { color: var(--text2); font-size: .88rem; margin-top: .4rem; }
.it-drop-zone strong { color: var(--accent); }

/* File list */
.it-file-list { margin-top: .8rem; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.it-file-item {
  background: var(--surface2); border-radius: var(--radius);
  padding: .4rem .75rem; font-size: .8rem;
  display: flex; align-items: center; gap: .45rem;
  color: var(--text);
}
.it-file-item i { color: var(--text3); flex-shrink: 0; }

/* Progress bar */
.it-progress-wrap { display: none; margin-top: .75rem; height: 6px; background: var(--bg); border-radius: 10px; overflow: hidden; }
.it-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 10px; transition: width .3s ease; }

/* Process button */
.btn-it-process {
  width: 100%; margin-top: 1rem;
  background: var(--primary); color: #fff;
  border: none; padding: .9rem;
  border-radius: var(--radius-lg);
  font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
  min-height: 50px;
}
.btn-it-process:hover { background: var(--primary-d); transform: translateY(-1px); }
.btn-it-process:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Result grid */
.it-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.it-result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.it-result-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.it-result-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.it-result-card .info { padding: .5rem .65rem; display: flex; justify-content: space-between; align-items: center; gap: .3rem; }
.it-fname { color: var(--text3); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Spec badges */
.it-specs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.it-spec { background: var(--surface2); border: 1px solid var(--border); border-radius: 100px; padding: .2rem .65rem; font-size: .72rem; color: var(--text3); }
.it-spec b { color: var(--accent); }

/* Lightbox */
.it-lb {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.92); z-index: 9000;
  align-items: center; justify-content: center; padding: 1rem;
  cursor: zoom-out;
}
.it-lb.open { display: flex; }
.it-lb img { max-width: 96vw; max-height: 90dvh; border-radius: var(--radius); object-fit: contain; cursor: default; box-shadow: 0 8px 60px rgba(0,0,0,.8); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */

/* Tablet + Mobile: sidebar becomes drawer */
@media (max-width: 991px) {
  #menuBtn { display: flex !important; }

  .it-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 32px rgba(0,0,0,.6);
  }
  .it-sidebar.open {
    transform: translateX(0);
  }
  .it-sidebar-close-btn { display: flex !important; }

  .it-main {
    margin-left: 0;
  }
}

/* Mobile tweaks */
@media (max-width: 767px) {
  :root { --header-h: 52px; }
  .it-content { padding: 1rem; }
  .it-topbar { padding: .6rem 1rem; }
  .it-footer { padding: .5rem 1rem; }
  .it-footer-inner { font-size: .68rem; }
  .it-card { padding: 1rem; margin-bottom: .75rem; }
  .it-user-pill { max-width: 130px; font-size: .72rem; }
  .it-result-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
  .it-login-card { padding: 1.75rem 1.25rem; }
}

@media (max-width: 479px) {
  .it-content { padding: .75rem; }
  .it-card { padding: .875rem; }
  .it-card-title { font-size: .875rem; }
  body { font-size: .875rem; }
  /* Stack Bootstrap grid cols */
  .row { --bs-gutter-x: .75rem; }
  .col-md-1, .col-md-2, .col-md-3, .col-md-4,
  .col-md-5, .col-md-6, .col-sm-2, .col-sm-3,
  .col-sm-4, .col-sm-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  /* Keep 2-col grids on small */
  .row.row-2col > [class*="col-"] {
    width: 50% !important;
    flex: 0 0 50% !important;
  }
  .it-result-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════ */
.text-muted  { color: var(--text3) !important; }
.text-accent { color: var(--accent) !important; }
.text-success{ color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.border-top-accent { border-top: 3px solid var(--accent) !important; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
