/* ═══════════════════════════════════════════════════════════════
   CivilPro — Design System Core
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  /* === Core Backgrounds === */
  --bg-base:    #060b18;
  --bg-surface: #0d1526;
  --bg-card:    #111d35;
  --bg-hover:   #162040;
  --bg-input:   #0a1428;
  --bg-sidebar: #07101f;

  /* === Borders === */
  --border:       rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.12);
  --border-focus: rgba(59,130,246,0.5);

  /* === Text === */
  --text-primary:   #e2e8f0;
  --text-secondary: #8398b5;
  --text-muted:     #475a76;
  --text-white:     #ffffff;

  /* === Accent Blue (Primary) === */
  --blue:         #3b82f6;
  --blue-dark:    #2563eb;
  --blue-light:   #60a5fa;
  --blue-glow:    rgba(59, 130, 246, 0.18);
  --blue-surface: rgba(59, 130, 246, 0.08);

  /* === Accent Amber === */
  --amber:        #f59e0b;
  --amber-dark:   #d97706;
  --amber-light:  #fbbf24;
  --amber-glow:   rgba(245, 158, 11, 0.18);

  /* === Semantic Colors === */
  --success:       #10b981;
  --success-dark:  #059669;
  --success-glow:  rgba(16,185,129,0.18);

  --warning:       #f59e0b;
  --warning-glow:  rgba(245,158,11,0.18);

  --danger:        #ef4444;
  --danger-dark:   #dc2626;
  --danger-glow:   rgba(239,68,68,0.18);

  --info:          #06b6d4;
  --info-glow:     rgba(6,182,212,0.18);

  --purple:        #8b5cf6;
  --purple-glow:   rgba(139,92,246,0.18);

  /* === Gradients === */
  --grad-blue:    linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-amber:   linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-danger:  linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --grad-purple:  linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  --grad-card:    linear-gradient(145deg, #111d35 0%, #0d1526 100%);

  /* === Layout === */
  --sidebar-w:  260px;
  --header-h:   64px;

  /* === Radius === */
  --r-xs:  4px;
  --r-sm:  6px;
  --r:     10px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full: 9999px;

  /* === Shadows === */
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.4);
  --shadow:      0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 24px rgba(59,130,246,0.15);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);

  /* === Transitions === */
  --t: 200ms ease;
  --t-slow: 380ms ease;
}

/* ═══════ RESET ═══════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button { cursor: pointer; border: none; background: none; }
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }
ul, ol { list-style: none; }

/* ═══════ SCROLLBAR ═══════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #253352; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #344565; }
* { scrollbar-width: thin; scrollbar-color: #253352 var(--bg-surface); }

/* ═══════ TYPOGRAPHY ═══════ */
h1 { font-size: 1.8rem;  font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.4rem;  font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.35; }
h4 { font-size: 1rem;    font-weight: 600; }
h5 { font-size: 0.9rem;  font-weight: 600; }
p  { line-height: 1.65; color: var(--text-secondary); }

/* ═══════ COLOR UTILITIES ═══════ */
.text-primary   { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted)     !important; }
.text-white     { color: var(--text-white)     !important; }
.text-blue      { color: var(--blue)           !important; }
.text-amber     { color: var(--amber)          !important; }
.text-success   { color: var(--success)        !important; }
.text-danger    { color: var(--danger)         !important; }
.text-warning   { color: var(--warning)        !important; }
.text-info      { color: var(--info)           !important; }
.text-purple    { color: var(--purple)         !important; }

/* ═══════ FONT WEIGHT ═══════ */
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ═══════ FONT SIZE ═══════ */
.fs-xs   { font-size: 0.72rem; }
.fs-sm   { font-size: 0.83rem; }
.fs-base { font-size: 1rem;    }
.fs-lg   { font-size: 1.1rem;  }
.fs-xl   { font-size: 1.25rem; }
.fs-2xl  { font-size: 1.5rem;  }

/* ═══════ SPACING ═══════ */
.mt-1 { margin-top: 4px;  }
.mt-2 { margin-top: 8px;  }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px;  }
.mb-2 { margin-bottom: 8px;  }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.ml-2 { margin-left:  8px;  }
.ml-4 { margin-left:  16px; }
.mr-2 { margin-right: 8px;  }
.mr-4 { margin-right: 16px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ═══════ FLEX ═══════ */
.d-flex       { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.align-center  { align-items: center; }
.align-start   { align-items: flex-start; }
.align-end     { align-items: flex-end; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-1  { gap: 4px;  }
.gap-2  { gap: 8px;  }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-5  { gap: 20px; }
.gap-6  { gap: 24px; }

/* ═══════ GRID ═══════ */
.grid      { display: grid; }
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3    { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4    { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ═══════ TEXT ALIGN ═══════ */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ═══════ DISPLAY ═══════ */
.d-none  { display: none; }
.d-block { display: block; }

/* ═══════ SIZE ═══════ */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* ═══════ CURSOR ═══════ */
.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

/* ═══════ OVERFLOW ═══════ */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* ═══════ POSITION ═══════ */
.relative { position: relative; }
.absolute { position: absolute; }

/* ═══════ ANIMATIONS ═══════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px var(--blue-glow); }
  50%       { box-shadow: 0 0 24px var(--blue-glow); }
}

@keyframes countUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.fade-in      { animation: fadeIn 0.3s ease forwards; }
.fade-in-fast { animation: fadeInFast 0.2s ease forwards; }
.slide-left   { animation: slideInLeft 0.3s ease forwards; }
.slide-right  { animation: slideInRight 0.3s ease forwards; }
.scale-in     { animation: scaleIn 0.25s ease forwards; }

/* Staggered animation delays */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }

/* ═══════ SKELETON / LOADING ═══════ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--bg-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
  color: transparent;
}

/* ═══════ DIVIDER ═══════ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ═══════ EMPTY STATE ═══════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-state h4 { color: var(--text-secondary); }
.empty-state p  { color: var(--text-muted); font-size: 0.85rem; max-width: 280px; }

/* ═══════ SCROLLABLE TABLE WRAPPER ═══════ */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--r);
}
