/* ═══════════════════════════════════════════════════════════
   UNIDET v2 — Mes contrats client
   Fichier : /unidet-v2/dashboard/assets/contrats-client-v2.css
   ═══════════════════════════════════════════════════════════ */

/* HEAD */
.udct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.udct-title { margin: 0 0 4px; font-size: 20px; font-weight: 800; color: #0A0E17; display: flex; align-items: center; gap: 8px; }
.udct-title-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 9px; background: #0A0E17; color: #C9A227; font-size: 12px; font-weight: 800; border-radius: 100px; }
.udct-sub { margin: 0; font-size: 12.5px; color: #64748B; font-weight: 500; }
.udct-head-actions { display: flex; gap: 8px; }

/* BANDEAU ALERTE */
.udct-alert {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; margin-bottom: 16px;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 1.5px solid #F59E0B; border-radius: 12px;
}
.udct-alert-icon {
    width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
    background: #F59E0B; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    animation: udctBell 2s ease-in-out infinite;
}
@keyframes udctBell {
    0%, 100% { transform: rotate(0); }
    5%, 15%, 25% { transform: rotate(-10deg); }
    10%, 20%, 30% { transform: rotate(10deg); }
    35% { transform: rotate(0); }
}
.udct-alert-body { flex: 1; min-width: 0; }
.udct-alert-title { font-size: 14px; font-weight: 800; color: #78350F; margin-bottom: 2px; }
.udct-alert-sub { font-size: 12px; color: #92400E; font-weight: 500; }

/* KPI */
.udct-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.udct-kpi {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: #fff;
    border: 1px solid #E5E9F0; border-radius: 12px; min-height: 56px;
}
.udct-kpi-icon {
    width: 36px; height: 36px; min-width: 36px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.udct-kpi.is-total   .udct-kpi-icon { background: #EFF6FF; color: #1D4ED8; }
.udct-kpi.is-pending .udct-kpi-icon { background: #FFF7ED; color: #C2410C; }
.udct-kpi.is-signed  .udct-kpi-icon { background: #ECFDF5; color: #047857; }
.udct-kpi.is-value   .udct-kpi-icon { background: #FEF3C7; color: #92400E; }
.udct-kpi-body { flex: 1; min-width: 0; }
.udct-kpi-label { font-size: 10.5px; font-weight: 800; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.udct-kpi-value { font-size: 18px; font-weight: 900; color: #0A0E17; line-height: 1.1; }
.udct-kpi-sub { font-size: 10.5px; color: #94A3B8; font-weight: 600; margin-top: 1px; }

/* PANNEAU FILTRES */
.udct-panel {
    background: #fff; border: 1px solid #E8ECF1;
    border-radius: 14px; margin-bottom: 16px; overflow: hidden;
}
.udct-panel-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    border-bottom: 1px solid #E8ECF1;
}
.udct-panel-head-icon {
    width: 36px; height: 36px; min-width: 36px; border-radius: 10px;
    background: #0A0E17; color: #C9A227;
    display: inline-flex; align-items: center; justify-content: center;
}
.udct-panel-head-text { flex: 1; min-width: 0; }
.udct-panel-head-text h3 { margin: 0; font-size: 14px; font-weight: 800; color: #0A0E17; }
.udct-panel-head-text p { margin: 2px 0 0; font-size: 12px; color: #64748B; }
.udct-panel-reset {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: #fff;
    border: 1px solid #E2E8F0; border-radius: 8px;
    color: #475569; font-family: inherit; font-size: 12px;
    font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.udct-panel-reset:hover { background: #0A0E17; color: #C9A227; border-color: #0A0E17; }
.udct-panel-search { padding: 16px 20px 0; }
.udct-panel-search label {
    display: block; font-size: 11px; font-weight: 800; color: #475569;
    text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px;
}
.udct-panel-search input {
    width: 100%; padding: 10px 14px; border: 1.5px solid #E2E8F0;
    border-radius: 9px; font-family: inherit; font-size: 13px;
    color: #0A0E17; background: #fff; outline: none;
    box-sizing: border-box; height: 42px;
}
.udct-panel-search input:focus { border-color: #0A0E17; box-shadow: 0 0 0 3px rgba(10, 14, 23, 0.07); }
.udct-panel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 14px 20px 20px; }
.udct-panel-field { display: flex; flex-direction: column; gap: 6px; }
.udct-panel-field label {
    font-size: 11px; font-weight: 800; color: #475569;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.udct-panel-field select,
.udct-panel-field input {
    width: 100%; padding: 10px 12px; border: 1.5px solid #E2E8F0;
    border-radius: 9px; font-family: inherit; font-size: 13px;
    color: #0A0E17; background: #fff; outline: none;
    height: 42px; box-sizing: border-box; font-weight: 600;
}
.udct-panel-field select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.udct-panel-field select:focus,
.udct-panel-field input:focus { border-color: #0A0E17; box-shadow: 0 0 0 3px rgba(10, 14, 23, 0.07); }

/* LISTE */
.udct-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.udct-card {
    background: #fff; border: 1px solid #E5E9F0;
    border-radius: 14px; padding: 18px 22px;
    position: relative; overflow: hidden;
    transition: all 0.15s ease;
}
.udct-card::before {
    content: ''; position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: #E5E9F0;
}
.udct-card.is-signed::before   { background: #10B981; }
.udct-card.is-pending::before  { background: #F59E0B; }
.udct-card.is-declined::before { background: #EF4444; }

.udct-card:hover {
    background: #fff !important;
    border-color: #C9A227 !important;
    box-shadow: 0 4px 18px rgba(10, 14, 23, 0.06) !important;
}

/* Head */
.udct-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.udct-card-icon {
    width: 42px; height: 42px; min-width: 42px; border-radius: 10px;
    background: linear-gradient(135deg, #0A0E17, #1A1F2E);
    color: #C9A227;
    display: inline-flex; align-items: center; justify-content: center;
}
.udct-card.is-signed .udct-card-icon   { background: linear-gradient(135deg, #10B981, #059669); color: #fff; }
.udct-card.is-pending .udct-card-icon  { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.udct-card.is-declined .udct-card-icon { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; }
.udct-card-info { flex: 1; min-width: 0; }
.udct-card-ref { font-family: 'Courier New', monospace; font-size: 14px; font-weight: 800; color: #0A0E17; margin-bottom: 4px; }
.udct-card-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: #64748B; font-weight: 600; }
.udct-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.udct-card-status {
    padding: 5px 12px; border-radius: 100px;
    font-size: 10.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.4px;
    white-space: nowrap;
}
.udct-card-status.is-signed   { background: #ECFDF5; color: #047857; }
.udct-card-status.is-pending  { background: #FEF3C7; color: #92400E; }
.udct-card-status.is-declined { background: #FEF2F2; color: #991B1B; }
.udct-card-status.is-none     { background: #F1F5F9; color: #475569; }

/* Timeline */
.udct-timeline {
    display: flex; align-items: center; gap: 0;
    margin-bottom: 16px; padding: 12px 16px;
    background: #F8FAFC; border-radius: 10px;
}
.udct-step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; min-width: 44px; }
.udct-step-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: #F1F5F9; color: #94A3B8;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900;
    border: 2px solid #E2E8F0;
    position: relative;
}
.udct-step-label { font-size: 9.5px; font-weight: 800; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.4px; }
.udct-step.is-done .udct-step-num {
    background: #10B981; color: #fff; border-color: #10B981;
    font-size: 0;
}
.udct-step.is-done .udct-step-num::after {
    content: '✓'; font-size: 14px; font-weight: 900; color: #fff;
}
.udct-step.is-done .udct-step-label { color: #047857; }
.udct-step.is-failed .udct-step-num {
    background: #EF4444; color: #fff; border-color: #EF4444; font-size: 0;
}
.udct-step.is-failed .udct-step-num::after {
    content: '✕'; font-size: 12px; font-weight: 900; color: #fff;
}
.udct-step.is-failed .udct-step-label { color: #991B1B; }
.udct-step-sep { flex: 1; height: 2px; background: #E2E8F0; margin: 0 -2px 18px; min-width: 20px; }
.udct-step-sep.is-done { background: #10B981; }

/* Infos */
.udct-card-infos { margin-bottom: 14px; }
.udct-info-line {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: 12px;
    border-bottom: 1px dashed #F1F5F9;
}
.udct-info-line:last-child { border-bottom: none; }
.udct-info-label { color: #64748B; font-weight: 600; }
.udct-info-value { color: #0A0E17; font-weight: 700; }

/* Signataires */
.udct-signers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.udct-signer {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: #F8FAFC;
    border: 1px solid #EEF2F6; border-radius: 9px;
}
.udct-signer.is-signed  { background: #ECFDF5; border-color: #6EE7B7; }
.udct-signer.is-pending { background: #FEF3C7; border-color: #FCD34D; }
.udct-signer-av {
    width: 28px; height: 28px; min-width: 28px; border-radius: 50%;
    background: #fff; color: #3730A3;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 900; text-transform: uppercase;
}
.udct-signer.is-signed .udct-signer-av  { background: #10B981; color: #fff; }
.udct-signer.is-pending .udct-signer-av { background: #F59E0B; color: #fff; }
.udct-signer-info { flex: 1; min-width: 0; }
.udct-signer-name { font-size: 12.5px; font-weight: 700; color: #0A0E17; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.udct-signer-email { font-size: 10.5px; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.udct-signer-status { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; padding: 3px 8px; border-radius: 100px; white-space: nowrap; }
.udct-signer.is-signed .udct-signer-status  { background: #047857; color: #fff; }
.udct-signer.is-pending .udct-signer-status { background: #92400E; color: #fff; }

/* Actions */
.udct-card-actions {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    padding-top: 14px; border-top: 1px solid #F1F5F9;
}
.udct-action-hint {
    flex: 1; min-width: 100%;
    padding: 10px 14px;
    background: #FFFBEB; border-left: 3px solid #F59E0B;
    border-radius: 0 8px 8px 0;
    font-size: 12px; color: #78350F; font-weight: 600;
    line-height: 1.5;
}

/* Empty */
.udct-empty {
    text-align: center; padding: 60px 20px;
    background: #fff; border: 2px dashed #E5E9F0; border-radius: 12px;
}
.udct-empty-icon {
    font-size: 48px; opacity: 0.35; margin-bottom: 12px;
    color: #94A3B8; display: flex; justify-content: center;
}
.udct-empty h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: #0A0E17; }
.udct-empty p { margin: 0; font-size: 13px; color: #64748B; }

/* Pagination */
.udct-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 14px; margin-top: 20px; padding: 12px 16px;
    background: #fff; border: 1px solid #E5E9F0; border-radius: 12px;
}
.udct-page-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: #fff;
    border: 1.5px solid #E5E9F0; border-radius: 8px;
    color: #0A0E17; font-family: inherit;
    font-size: 12.5px; font-weight: 700;
    cursor: pointer; transition: all 0.15s; line-height: 1;
}
.udct-page-btn:hover:not(:disabled) { background: #0A0E17; border-color: #0A0E17; color: #C9A227; }
.udct-page-btn:hover:not(:disabled) svg { stroke: #C9A227; }
.udct-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.udct-page-info { font-size: 12.5px; color: #64748B; font-weight: 600; white-space: nowrap; }
.udct-page-info strong { color: #0A0E17; font-weight: 800; }

/* Responsive */
@media (max-width: 1024px) {
    .udct-kpis { grid-template-columns: repeat(2, 1fr); }
    .udct-panel-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .udct-kpis,
    .udct-panel-grid { grid-template-columns: 1fr; }
    .udct-pagination { flex-wrap: wrap; gap: 8px; }
}

/* ═══════════════════════════════════════════════════════════
   OVERRIDE CLIENT — Force 3 colonnes (comme admin)
   Le CSS admin utilise auto-fill, on impose repeat(3)
   ═══════════════════════════════════════════════════════════ */
#udca-grid.udca-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

/* Responsive : 2 colonnes en tablette */
@media (max-width: 1280px) {
    #udca-grid.udca-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* 1 colonne en mobile */
@media (max-width: 768px) {
    #udca-grid.udca-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   Ajustements spécifiques client (débiteur plus court)
   ═══════════════════════════════════════════════════════════ */
/* Débiteur : on peut wrapper si trop long */
#udca-grid .udca-party-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
#udca-grid .udca-party-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}