/* ══════════════════════════════════════════════════════════════
   Al Khoury Diamonds — Custom Stylesheet
   ══════════════════════════════════════════════════════════════ */

/* Remove number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

:root {
  --gold:         #c9a84c;
  --gold-light:   #f5edda;
  --sidebar-bg:   #1a1a2e;
  --sidebar-text: #b0b8cc;
  --sidebar-w:    240px;
  --topbar-h:     56px;
}

/* ── Typography ─────────────────────────────────────────────── */
body {
  background: #f4f6fb;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #2d2d3a;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 1000;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 0.5px;
}

.sidebar .nav-link {
  color: var(--sidebar-text);
  padding: 9px 20px;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 13px;
  opacity: 0.85;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 14px 20px 4px;
  text-transform: uppercase;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: var(--sidebar-text);
}

/* ── Main Content ────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}
.sidebar.collapsed ~ #main-content {
  margin-left: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Content Area ────────────────────────────────────────────── */
.content-area {
  padding-top: 8px;
}

/* ── Gold theme ──────────────────────────────────────────────── */
.text-gold        { color: var(--gold) !important; }
.bg-gold          { background-color: var(--gold) !important; }
.bg-gold-light    { background-color: var(--gold-light) !important; }

.btn-gold {
  background-color: var(--gold);
  border-color: var(--gold);
  color: #fff;
  font-weight: 600;
}
.btn-gold:hover {
  background-color: #b5912f;
  border-color: #b5912f;
  color: #fff;
}

.badge.bg-gold {
  background-color: var(--gold) !important;
  color: #fff !important;
}

/* ── KPI Cards ───────────────────────────────────────────────── */
.kpi-card {
  border-radius: 12px;
  transition: transform 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: #2d2d3a;
}
.kpi-label {
  font-size: 12px;
  color: #8a8fa8;
  margin-top: 2px;
}

.bg-danger-light  { background: #fde8e8; }
.bg-warning-light { background: #fef3e0; }
.bg-success-light { background: #e5f7ed; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  border-radius: 12px;
}
.card-header {
  border-radius: 12px 12px 0 0 !important;
  border-bottom: 1px solid #f0f0f5;
  font-size: 14px;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f9f7ff; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 0.2rem rgba(201, 168, 76, 0.2);
}

/* ── Login ───────────────────────────────────────────────────── */
.login-body  { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%); }
.login-card  { border-radius: 16px; }

/* ── Hover Card ──────────────────────────────────────────────── */
.hover-card {
  transition: transform 0.15s, box-shadow 0.15s;
  color: #2d2d3a;
}
.hover-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

/* ── Diamond row (fiche form) ────────────────────────────────── */
.diamond-row { background: #fafafa; }
.diamond-row:last-child { border-bottom: none !important; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { font-weight: 600; letter-spacing: 0.3px; }

/* ── Mobile overlay ──────────────────────────────────────────── */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
#sidebarOverlay.active { display: block; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1000;
    width: 75vw;
    max-width: 300px;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  #main-content { margin-left: 0; }

  .sidebar .nav-link {
    padding: 6px 14px;
    font-size: 13.5px;
  }
  .sidebar-section {
    padding: 8px 14px 2px;
    font-size: 10px;
  }
  .sidebar-brand {
    padding: 12px 14px;
    font-size: 1rem;
  }
  .sidebar-footer {
    padding: 10px 14px;
  }

  #sidebarToggle {
    width: 42px;
    height: 42px;
    font-size: 18px;
    border: none;
    background: var(--sidebar-bg);
    color: var(--gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Sidebar drag-to-reorder ─────────────────────────────────── */
.sortable-ghost { opacity: 0.4; background: var(--gold-light); border-radius: 6px; }
#sidebarNav .nav-item { cursor: grab; }
#sidebarNav .nav-item:active { cursor: grabbing; }
#sidebarNav .sidebar-section { cursor: grab; }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, #sidebarOverlay, #sidebarToggle,
  form.no-print, .btn, .alert, .alert-dismissible { display: none !important; }
  #main-content { margin-left: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; font-size: 12px; }
  .content-area { padding-top: 0 !important; }
}
