/* ============================================================
   IDENT - Portail Veille Juridique CRDC
   Design: minimaliste, rapide, 0 framework CSS
   ============================================================ */

:root {
    --primary: #800020;
    --accent: #E8A838;
    --bg: #f6f7fb;
    --white: #FFFFFF;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #E2E8F0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.1);

    /* Badges annonces */
    --badge-liquidation: #DC3545;
    --badge-redressement: #FD7E14;
    --badge-creation: #0D6EFD;
    --badge-radiation: #6C757D;
    --badge-modification: #198754;
    --badge-cloture: #6F42C1;
    --badge-dissolution: #D63384;
    --badge-appel: #0DCAF0;
    --badge-vente: #FFC107;
    --badge-default: #ADB5BD;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.nav {
    background: var(--primary);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { color: var(--white); font-weight: 700; font-size: 18px; letter-spacing: -0.3px; }
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: rgba(255,255,255,.8); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--white); text-decoration: none; }
.nav-links a.active { color: var(--accent); }

/* ---- Page Accueil ---- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px - 48px);
    text-align: center;
    padding: 40px 20px;
}
.hero h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.hero p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 32px;
}
.search-box {
    width: 100%;
    max-width: 640px;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 16px 56px 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 48px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    background: var(--white);
}
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,58,92,.12);
}
.search-box button {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 44px;
    border: none;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.search-box button:hover { background: #660018; }
.search-hint {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}
.search-hint code {
    background: #E2E8F0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ---- Resultats ---- */
.results-header {
    padding: 24px 0 16px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.results-header h2 { font-size: 18px; font-weight: 600; }
.results-header h2 span { color: var(--text-light); font-weight: 400; }
.results-meta { font-size: 13px; color: var(--text-light); }

.results-layout { display: flex; gap: 24px; padding-bottom: 40px; }
.results-filters { width: 220px; flex-shrink: 0; }
.results-list { flex: 1; min-width: 0; }

/* Filtres */
.filter-group { margin-bottom: 20px; }
.filter-group h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); margin-bottom: 8px; }
.filter-group a {
    display: block;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 6px;
    color: var(--text);
    transition: background .15s;
}
.filter-group a:hover { background: rgba(27,58,92,.06); text-decoration: none; }
.filter-group a.active { background: var(--primary); color: var(--white); font-weight: 500; }
.filter-count { float: right; color: var(--text-light); font-size: 12px; }
.filter-group a.active .filter-count { color: rgba(255,255,255,.7); }

/* Tri */
.sort-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.sort-bar a {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all .15s;
}
.sort-bar a:hover { border-color: var(--primary); text-decoration: none; }
.sort-bar a.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Carte resultat */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
    border-left: 4px solid transparent;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 600; color: var(--primary); }
.card-title a { color: inherit; }
.card-title a:hover { text-decoration: underline; }
.card-date { font-size: 13px; color: var(--text-light); }
.card-excerpt { font-size: 14px; color: var(--text); line-height: 1.7; }
.card-excerpt mark { background: #FFF3CD; padding: 1px 3px; border-radius: 2px; }
.card-footer { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.card-rg { font-size: 12px; color: var(--text-light); background: #F1F5F9; padding: 3px 8px; border-radius: 4px; }

/* Border couleur selon type */
.card[data-type="liquidation_judiciaire"] { border-left-color: var(--badge-liquidation); }
.card[data-type="redressement_judiciaire"] { border-left-color: var(--badge-redressement); }
.card[data-type="constitution"],
.card[data-type="creation"] { border-left-color: var(--badge-creation); }
.card[data-type="radiation"] { border-left-color: var(--badge-radiation); }
.card[data-type="modification"] { border-left-color: var(--badge-modification); }
.card[data-type="cloture_liquidation"] { border-left-color: var(--badge-cloture); }
.card[data-type="dissolution"] { border-left-color: var(--badge-dissolution); }
.card[data-type="appel_offres"] { border-left-color: var(--badge-appel); }
.card[data-type="vente_encheres"] { border-left-color: var(--badge-vente); }

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-radius: 12px;
    color: var(--white);
    background: var(--badge-default);
}
.badge-liquidation_judiciaire { background: var(--badge-liquidation); }
.badge-redressement_judiciaire { background: var(--badge-redressement); }
.badge-constitution, .badge-creation { background: var(--badge-creation); }
.badge-radiation { background: var(--badge-radiation); }
.badge-modification { background: var(--badge-modification); }
.badge-cloture_liquidation { background: var(--badge-cloture); }
.badge-dissolution { background: var(--badge-dissolution); }
.badge-appel_offres { background: var(--badge-appel); }
.badge-vente_encheres { background: var(--badge-vente); color: #333; }
.badge-divers { background: var(--badge-default); }
.badge-resolution_plan { background: #20C997; }
.badge-nc { background: var(--primary); }
.badge-pf { background: #0D6EFD; }
.badge-debiteur { background: var(--accent); color: #333; font-size: 10px; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    transition: all .15s;
}
.pagination a:hover { border-color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination .disabled { color: var(--text-light); opacity: .5; pointer-events: none; }

/* ---- Detail ---- */
.detail-container { padding: 24px 0 48px; }
.detail-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}
.detail-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    line-height: 1.8;
    font-size: 15px;
    white-space: pre-wrap;
    margin-bottom: 24px;
}
.detail-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.detail-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 6px 16px;
    font-size: 14px;
}
.detail-grid dt { color: var(--text-light); font-weight: 500; }
.detail-grid dd { color: var(--text); }
.rapproch-match {
    background: #D4EDDA;
    border: 1px solid #C3E6CB;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 14px;
}
.rapproch-match strong { color: #155724; }

/* ---- Dashboard ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    padding: 24px 0;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}
.chart-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.chart-container h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { width: 180px; text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-fill { height: 24px; border-radius: 4px; background: var(--primary); min-width: 2px; transition: width .3s; }
.bar-count { width: 60px; font-weight: 600; color: var(--text); }

/* ---- Error ---- */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    text-align: center;
}
.error-page h1 { font-size: 48px; color: var(--primary); margin-bottom: 8px; }
.error-page p { color: var(--text-light); }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 16px 0;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .results-layout { flex-direction: column; }
    .results-filters { width: 100%; display: flex; gap: 12px; flex-wrap: wrap; }
    .filter-group { margin-bottom: 8px; }
    .hero h1 { font-size: 24px; }
    .detail-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
