/* Cooley Construction App — UI v2 */

:root {
  /* Cooley Technology & Design — navy + teal */
  --cooley-blue:    #16263d;
  --cooley-blue-mid:#214f67;
  --cooley-orange:  #159aab;   /* accent, now teal (brand has no orange) */
  --cooley-orange-lt:#34b5c7;
  --cooley-teal:    #159aab;
  --cooley-light:   #f4f7f9;
  --sidebar-w:      250px;
  --header-h:       64px;
  --radius:         8px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
  --transition:     .18s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1e2a38;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Sidebar ── */
.nav-header {
  background: var(--cooley-blue);
  height: var(--header-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  z-index: 1100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.dlabnav {
  background: var(--cooley-blue);
  width: var(--sidebar-w);
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,.15);
  transition: transform var(--transition);
}

.dlabnav-scroll { padding: 0.75rem 0 2rem; }

/* Sidebar section label */
.nav-label {
  color: rgba(255,255,255,.35);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 1.25rem 1.25rem 0.35rem;
  display: block;
}

.metismenu { list-style: none; margin: 0; padding: 0; }

.metismenu li { margin: 2px 0.5rem; }

.metismenu li a {
  color: rgba(255,255,255,.68);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 450;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.metismenu li a:hover {
  color: #fff;
  background: rgba(255,255,255,.10);
}

.metismenu li.active > a {
  color: #fff;
  background: var(--cooley-orange);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(21,154,171,.38);
}

.metismenu li a i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Top Header ── */
.header {
  height: var(--header-h);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.07);
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.header-content { width: 100%; }

/* ── Content area ── */
.content-body {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 1.5rem 1.75rem 3rem;
  min-height: calc(100vh - var(--header-h));
}

/* ── Page title bar ── */
.page-titles {
  padding: 0.5rem 0 1rem;
  margin-bottom: 0;
  display: flex;
  align-items: center;
}

.page-titles .breadcrumb {
  margin-bottom: 0;
  font-size: 0.8rem;
}

.breadcrumb-item a { color: var(--cooley-blue); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }

/* ── Cards ── */
.card {
  border: 1px solid rgba(0,0,0,.055);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 1.25rem;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.055);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h4,
.card-header h5,
.card-header .card-title { margin-bottom: 0; font-weight: 600; font-size: 0.95rem; }

.card-footer {
  background: #fafafa;
  border-top: 1px solid rgba(0,0,0,.055);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.75rem 1.25rem;
}

/* KPI stat cards */
.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  opacity: .15;
}

.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; opacity: .85; margin-top: .25rem; }

/* ── Tables ── */
.table > :not(caption) > * > * {
  padding: 0.7rem 1rem;
  vertical-align: middle;
}

.table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  border-bottom: 2px solid rgba(0,0,0,.07);
  background: #fafafa;
}

.table tbody tr:hover { background: #f8faff; }

/* ── Forms ── */
.form-control, .form-select {
  border-radius: 6px;
  border-color: #d1d5db;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--cooley-blue);
  box-shadow: 0 0 0 3px rgba(26,58,92,.12);
}

.form-label {
  font-weight: 500;
  font-size: 0.825rem;
  color: #374151;
  margin-bottom: 0.35rem;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--cooley-blue);
  border-color: var(--cooley-blue);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--cooley-blue-mid);
  border-color: var(--cooley-blue-mid);
}

.btn-xs {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  line-height: 1.4;
}

/* ── Badges ── */
.badge { font-weight: 500; letter-spacing: .02em; }

/* ── Alerts ── */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  padding: 0.75rem 1.1rem;
}

/* ── Auth pages ── */
.authincation {
  background: linear-gradient(135deg, var(--cooley-blue) 0%, #0f2340 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.auth-form {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

/* ── Hover lift for portal cards ── */
.hover-shadow {
  transition: box-shadow var(--transition), transform var(--transition);
}
.hover-shadow:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Utilities ── */
.x-small { font-size: 0.7rem; }
.text-cooley-blue  { color: var(--cooley-blue) !important; }
.text-cooley-orange { color: var(--cooley-orange) !important; }
.bg-cooley-blue    { background: var(--cooley-blue) !important; }

/* ── Scrollbar (WebKit) ── */
.dlabnav::-webkit-scrollbar { width: 4px; }
.dlabnav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

/* ── Responsive ── */
@media (max-width: 991px) {
  .dlabnav { transform: translateX(-100%); }
  .dlabnav.open { transform: translateX(0); }
  .nav-header { width: 100%; }
  .header { left: 0; }
  .content-body { margin-left: 0; }
}

/* ── Hamburger button ── */
.hamburger { cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.hamburger .line {
  width: 24px; height: 2px;
  background: rgba(255,255,255,.8);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ═══════════════════════════════════════════
   GLOBAL POLISH — Cooley Construction v2.1
   ═══════════════════════════════════════════ */

/* ── Page Hero (reusable gradient header) ── */
.page-hero {
  background: linear-gradient(135deg, var(--cooley-blue) 0%, #2d4a8a 60%, #4f5fdc 100%);
  border-radius: 14px;
  padding: 1.5rem 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.page-hero h1, .page-hero h2, .page-hero h3 {
  font-weight: 800; letter-spacing: -.02em; margin: 0; color: #fff;
}
.page-hero p { color: rgba(255,255,255,.65); font-size: .88rem; margin: .25rem 0 0; }
.page-hero .hero-stat {
  background: rgba(255,255,255,.12);
  border-radius: 10px; padding: .65rem 1.1rem;
  text-align: center; min-width: 80px;
}
.page-hero .hero-stat .n { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.page-hero .hero-stat .l { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.55); }

/* ── Section divider label ── */
.section-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: #64748b;
  margin: 1.5rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid #e5e7eb;
}
.section-divider .sd-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 3.5rem 1.5rem;
}
.empty-state .empty-icon {
  font-size: 3.5rem; color: #d1d5db; margin-bottom: 1rem; display: block;
}
.empty-state h4 { font-weight: 700; color: #374151; margin-bottom: .5rem; }
.empty-state p  { color: #9ca3af; font-size: .88rem; margin-bottom: 1.25rem; }

/* ── Status badges — unified ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; border-radius: 6px; padding: 3px 9px;
  white-space: nowrap;
}
.status-active      { background: #dcfce7; color: #166534; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-pending     { background: #f3f4f6; color: #6b7280; }
.status-completed   { background: #ede9fe; color: #5b21b6; }
.status-on_hold     { background: #fef3c7; color: #92400e; }
.status-cancelled   { background: #fee2e2; color: #991b1b; }
.status-review      { background: #ecfeff; color: #155e75; }
.status-draft       { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* ── Priority pills ── */
.priority-high   { background: #fee2e2; color: #991b1b; }
.priority-medium { background: #fef3c7; color: #92400e; }
.priority-low    { background: #f0fdf4; color: #166534; }

/* ── Info row (label + value inline) ── */
.info-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: .45rem 0; border-bottom: 1px solid #f8fafc;
  font-size: .85rem;
}
.info-row:last-child { border-bottom: none; }
.info-row .ir-label { color: #9ca3af; min-width: 120px; font-size: .78rem; flex-shrink: 0; }
.info-row .ir-value { color: #1e293b; font-weight: 500; }

/* ── Table improvements ── */
.table-clean thead th {
  background: #f8fafc;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #64748b; border-bottom: 2px solid #e5e7eb;
  padding: .65rem 1rem;
}
.table-clean tbody td { padding: .75rem 1rem; vertical-align: middle; }
.table-clean tbody tr:hover { background: #f8faff; }
.table-clean tbody tr:last-child td { border-bottom: none; }

/* ── Card with colored left border ── */
.card-accent { border-left: 4px solid var(--cooley-orange); }
.card-accent-blue { border-left: 4px solid var(--cooley-blue); }
.card-accent-green { border-left: 4px solid #10b981; }
.card-accent-purple { border-left: 4px solid #8b5cf6; }
.card-accent-amber  { border-left: 4px solid #f59e0b; }

/* ── Soft icon container ── */
.icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.icon-box-blue   { background: #eff6ff; color: #1d4ed8; }
.icon-box-green  { background: #ecfdf5; color: #065f46; }
.icon-box-orange { background: #fff7ed; color: #c2410c; }
.icon-box-purple { background: #f5f3ff; color: #6d28d9; }
.icon-box-gray   { background: #f3f4f6; color: #374151; }
.icon-box-teal   { background: #ecfeff; color: #155e75; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: #e5e7eb;
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #3b82f6; border: 2px solid #fff;
  box-shadow: 0 0 0 2px #3b82f6;
}
.timeline-item.done::before { background: #10b981; box-shadow: 0 0 0 2px #10b981; }
.timeline-item.pending::before { background: #d1d5db; box-shadow: 0 0 0 2px #d1d5db; }

/* ── Modal improvements ── */
.modal-header.gradient {
  background: linear-gradient(135deg, var(--cooley-blue), #4f5fdc);
  color: #fff; border-bottom: none;
}
.modal-header.gradient .btn-close { filter: invert(1); }

/* ── Utility extras ── */
.fw-450 { font-weight: 450; }
.fw-550 { font-weight: 550; }
.fs-xs  { font-size: .72rem; }
.fs-sm  { font-size: .82rem; }
.lh-sm  { line-height: 1.35; }
.gap-xs { gap: .35rem; }
.rounded-xl { border-radius: 14px !important; }
.rounded-2xl { border-radius: 20px !important; }
.shadow-colored-blue { box-shadow: 0 4px 16px rgba(26,58,92,.2); }
.shadow-colored-green { box-shadow: 0 4px 16px rgba(16,185,129,.2); }
.text-balance { text-wrap: balance; }
.truncate-2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.bg-surface { background: #f8fafc; }
.border-soft { border-color: #e5e7eb !important; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--cooley-blue);
  outline-offset: 2px;
}

/* ── Print ── */
@media print {
  .dlabnav, .nav-header, .header, #spade-toggle, #spade-panel { display: none !important; }
  .content-body { margin-left: 0 !important; margin-top: 0 !important; }
}
