/* ═══════════════════════════════════════════════
   Data.gouv.fr Search Tool — Styles
   ═══════════════════════════════════════════════ */

/* Hero gradient */
.dg-hero {
    background: linear-gradient(135deg, #0c4a6e 0%, #0e7490 50%, #06b6d4 100%);
    position: relative;
    overflow: hidden;
}

.dg-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 50%);
    pointer-events: none;
}

/* Search bar */
.dg-search-wrap {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
}

.dg-search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    padding-right: 3.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.dg-search-input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.12);
}

.dg-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    border: none;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.dg-search-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

.dg-search-btn:active {
    transform: translateY(-50%) scale(0.97);
}

/* Loader */
.dg-loader {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
}

.dg-loader.active {
    display: block;
}

.dg-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #0891b2;
    border-radius: 50%;
    animation: dg-spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Results grid */
.dg-results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .dg-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Result card */
.dg-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    padding: 1.5rem;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08);
    border-color: #0891b2;
}

.dg-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dg-card-title a {
    color: inherit;
    text-decoration: none;
}

.dg-card-title a:hover {
    color: #0891b2;
}

.dg-card-desc {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.dg-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
    margin-top: auto;
}

.dg-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dg-card-meta i {
    color: #0891b2;
    font-size: 0.75rem;
}

/* Tag badge for the org */
.dg-org-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f0fdfa;
    color: #0d9488;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #ccfbf1;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Empty / Error state */
.dg-message {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.dg-message i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

.dg-message p {
    font-size: 0.95rem;
}

.dg-message.error {
    color: #ef4444;
}

.dg-message.error i {
    color: #ef4444;
}

/* Stats badge */
.dg-stats {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.25rem;
}

.dg-stats strong {
    color: #0891b2;
    font-weight: 700;
}

/* Link to data.gouv */
.dg-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0891b2;
    text-decoration: none;
    transition: color 0.15s;
}

.dg-card-link:hover {
    color: #0e7490;
}

/* Powered by badge */
.dg-powered {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.dg-powered a {
    color: #0891b2;
    text-decoration: none;
    font-weight: 600;
}

.dg-powered a:hover {
    text-decoration: underline;
}

/* ── Resources button ── */
.dg-resources-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0891b2;
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    border-radius: 0.6rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.dg-resources-btn:hover {
    background: #ccfbf1;
    border-color: #0891b2;
}

.dg-resources-btn.active {
    background: #0891b2;
    color: white;
    border-color: #0891b2;
}

/* ── Resources panel ── */
.dg-resources-panel {
    border-top: 1px solid #e2e8f0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    animation: dg-slide-down 0.25s ease-out;
}

@keyframes dg-slide-down {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dg-res-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0e7490;
    margin-bottom: 0.6rem;
}

.dg-res-header i {
    margin-right: 0.3rem;
}

.dg-res-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dg-res-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dg-res-item-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dg-res-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    word-break: break-word;
}

.dg-res-format {
    display: inline-block;
    background: #0891b2;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 0.4rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.dg-res-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.75rem;
    color: #94a3b8;
}

.dg-res-size {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dg-res-size i {
    font-size: 0.65rem;
    color: #94a3b8;
}

.dg-res-type {
    color: #64748b;
    font-style: italic;
}

.dg-res-download {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #0891b2;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.dg-res-download:hover {
    color: #0e7490;
    text-decoration: underline;
}

.dg-res-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 0.75rem;
}

.dg-res-empty i {
    margin-right: 0.3rem;
}

/* ── Organization filter bar ── */
.dg-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
}

.dg-filter-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.dg-filter-label i {
    margin-right: 0.25rem;
    color: #0891b2;
}

.dg-filter-org {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dg-filter-org:hover {
    background: #f0fdfa;
    border-color: #0891b2;
    color: #0e7490;
}

.dg-filter-org.active {
    background: #0891b2;
    color: white;
    border-color: #0891b2;
}

.dg-filter-count {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    min-width: 1.1rem;
    text-align: center;
}

.dg-filter-org.active .dg-filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Tag filter buttons — same style */
.dg-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}

.dg-filter-tag:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.dg-filter-tag.active {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.dg-filter-tag.active .dg-filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Load more button ── */
.dg-load-more-wrap {
    text-align: center;
    padding: 1.5rem 0;
}

.dg-load-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    border: none;
    border-radius: 0.85rem;
    padding: 0.75rem 2rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.2);
}

.dg-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 145, 178, 0.3);
}

.dg-load-more:active {
    transform: translateY(0);
}