/* ==========================================================================
   AIRH Cockpit Operationnel — Futuristic Neumorphism
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------------- */
.cockpit {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
  padding-bottom: 40px;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.ck__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.ck__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ck__date {
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-weight: 500;
  text-transform: capitalize;
  margin-top: 4px;
}

.ck__header-actions {
  display: flex;
  gap: 10px;
}

.ck__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--neu-raised-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.ck__btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--neu-raised);
}

.ck__btn:active {
  transform: translateY(0);
  box-shadow: var(--neu-pressed);
}

.ck__btn--active {
  background: linear-gradient(135deg, var(--color-accent), #6366f1);
  color: #fff;
}

.ck__btn--refresh svg {
  transition: transform 0.6s ease;
}

.ck__btn--refresh.is-spinning svg {
  transform: rotate(360deg);
}

/* ---------------------------------------------------------------------------
   KPI Strip
   --------------------------------------------------------------------------- */
.ck__kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.ck__kpi {
  background: var(--color-bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-raised);
  padding: 20px 16px;
  text-align: center;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.ck__kpi:hover {
  box-shadow: var(--neu-raised-lg);
}

.ck__kpi-val {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ck__kpi-val--success { color: var(--color-success); }
.ck__kpi-val--warning { color: var(--color-warning); }
.ck__kpi-val--error { color: var(--color-error); }
.ck__kpi-val--accent { color: var(--color-accent); }

.ck__kpi-label {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

/* ---------------------------------------------------------------------------
   Site Cards Grid
   --------------------------------------------------------------------------- */
.ck__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ---------------------------------------------------------------------------
   Site Card
   --------------------------------------------------------------------------- */
.ck__card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-raised);
  padding: 20px 24px;
  position: relative;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(16px);
  animation: ck-fade-up 0.5s ease forwards;
  border-left: 3px solid var(--color-error);
}

.ck__card:hover {
  box-shadow: var(--neu-raised-lg);
  transform: translateY(-2px);
}

.ck__card--ok {
  border-left-color: var(--color-success);
  box-shadow: var(--neu-raised), 0 0 20px rgba(15, 123, 108, 0.06);
}

@keyframes ck-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------------------
   Card Header (avatar + text + badge)
   --------------------------------------------------------------------------- */
.ck__card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ck__card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ck__card--ok .ck__card-avatar {
  background: linear-gradient(135deg, var(--color-success), #34d399);
}

.ck__card-header-text {
  flex: 1;
  min-width: 0;
}

.ck__card-site {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ck__card-client {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.ck__card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ck__card-badge--active {
  background: var(--color-success-bg, rgba(0, 184, 148, 0.12));
  color: var(--color-success);
}

.ck__card-badge--inactive {
  background: rgba(160, 168, 176, 0.12);
  color: var(--color-text-tertiary);
}

/* ---------------------------------------------------------------------------
   Stats Grid (inset neumorphic)
   --------------------------------------------------------------------------- */
.ck__card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.ck__card-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--color-bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-inset-sm);
}

.ck__card-stat-val {
  font-size: 16px;
  font-weight: 800;
  display: block;
  line-height: 1.2;
}

.ck__card-stat-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--color-text-placeholder, var(--color-text-tertiary));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  display: block;
}

/* ---------------------------------------------------------------------------
   Progress Bar
   --------------------------------------------------------------------------- */
.ck__card-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.ck__card-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-bg-tertiary, #e5e7eb);
  overflow: hidden;
}

.ck__card-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 500ms ease;
}

.ck__card-bar-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Alert Pills
   --------------------------------------------------------------------------- */
.ck__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ck__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: var(--neu-inset-sm);
  transition: all 0.25s ease;
  background: var(--color-bg-primary);
}

.ck__pill:hover {
  box-shadow: var(--neu-flat);
}

.ck__pill--absent {
  color: var(--color-error);
}

.ck__pill--retard {
  color: var(--color-warning);
}

.ck__pill--hab {
  color: var(--color-error);
}

.ck__pill--epi {
  color: var(--color-warning);
}

.ck__pill--ok {
  color: var(--color-success);
}

/* ---------------------------------------------------------------------------
   Quick List (urgent items)
   --------------------------------------------------------------------------- */
.ck__quick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ck__quick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-inset-sm);
}

.ck__quick-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ck__quick-dot--error { background: var(--color-error); }
.ck__quick-dot--warning { background: var(--color-warning); }
.ck__quick-dot--success { background: var(--color-success); }

.ck__quick-label {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-right: 4px;
}

/* ---------------------------------------------------------------------------
   Skeleton
   --------------------------------------------------------------------------- */
.ck__skeleton {
  height: 200px;
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-inset-sm);
  animation: neu-pulse 1.8s ease-in-out infinite;
}

.ck__skeleton--kpi {
  height: 90px;
}

@keyframes neu-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------------------------------------------------------------------------
   Empty state
   --------------------------------------------------------------------------- */
.ck__empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  font-size: 14px;
  color: var(--color-text-tertiary);
  font-weight: 600;
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-inset-sm);
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .ck__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1023px) {
  .ck__grid {
    grid-template-columns: 1fr;
  }

  .ck__kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .cockpit {
    gap: 18px;
  }

  .ck__title {
    font-size: 22px;
  }

  .ck__kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ck__grid {
    gap: 14px;
  }

  .ck__card {
    padding: 16px;
  }

  .ck__header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
