/* ─── Reset & Base ───────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ─── Navbar ─────────────────────────────────────────────────── */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand h1 { font-size: 20px; color: var(--primary); }
.nav-subtitle { font-size: 12px; color: var(--text-light); }
.nav-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-icon {
    width: 30px; height: 30px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--border); background: white;
    cursor: pointer; font-size: 14px;
}
.btn-icon:hover { background: var(--bg); border-color: var(--primary); }

.badge {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
}

/* ─── Container ──────────────────────────────────────────────── */
.container { max-width: 1600px; margin: 0 auto; padding: 16px 24px; }

/* ─── Stats Row ──────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
}
.stat-card.stat-nouveau { border-left-color: var(--info); }
.stat-card.stat-a-contacter { border-left-color: var(--warning); }
.stat-card.stat-en-cours { border-left-color: var(--primary); }
.stat-card.stat-interesse { border-left-color: #8b5cf6; }
.stat-card.stat-gagne { border-left-color: var(--success); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ─── Daily Fetch Panel ──────────────────────────────────────── */
.daily-fetch-panel {
    background: linear-gradient(135deg, #065f46 0%, #059669 100%);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}
.daily-fetch-panel .scan-header h3 { font-size: 18px; margin-bottom: 4px; }
.daily-fetch-panel .scan-header p { font-size: 13px; opacity: 0.8; margin-bottom: 14px; }
.daily-fetch-panel .scan-controls .filter-group label { color: rgba(255,255,255,0.8); }
.daily-fetch-panel .scan-controls .filter-group select {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
}
.daily-fetch-panel .scan-controls .filter-group option { color: var(--text); }
.fetch-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.fetch-results-table th {
    text-align: left;
    padding: 6px 12px;
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.7;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.fetch-results-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.fetch-status-ok { color: #a7f3d0; }
.fetch-status-fail { color: #fca5a5; }

/* ─── WHOIS Scanner Panel ────────────────────────────────────── */
.whois-scan-panel {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.scan-header h3 { font-size: 18px; margin-bottom: 4px; }
.scan-header p { font-size: 13px; opacity: 0.8; margin-bottom: 14px; }
.scan-controls {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
}
.scan-controls .filter-group label { color: rgba(255,255,255,0.8); }
.scan-controls .filter-group input,
.scan-controls .filter-group select {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
}
.scan-controls .filter-group input::placeholder { color: rgba(255,255,255,0.5); }
.scan-controls .filter-group input:focus,
.scan-controls .filter-group select:focus { border-color: white; }
.scan-controls .filter-group option { color: var(--text); }

.scan-progress { margin-top: 16px; }
.progress-bar-container {
    width: 100%; height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px; overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22d3ee);
    border-radius: 12px;
    transition: width 0.5s ease;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: white;
    min-width: 40px;
}
.scan-stats {
    display: flex; gap: 20px; margin-top: 10px;
    font-size: 13px; opacity: 0.9;
}
.scan-stats strong { font-size: 15px; }

/* ─── Filters ────────────────────────────────────────────────── */
.filters-panel {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 150px; }
.filter-group label { font-size: 11px; color: var(--text-light); font-weight: 600; text-transform: uppercase; }
.filter-group input,
.filter-group select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}
.filter-group input:focus,
.filter-group select:focus { outline: none; border-color: var(--primary); }
.filter-actions { flex-direction: row; gap: 6px; align-items: flex-end; }
.checkbox-label {
    display: flex; align-items: center; gap: 6px; font-size: 13px;
    cursor: pointer; padding: 7px 0;
}

/* ─── Bulk Actions ───────────────────────────────────────────── */
.bulk-actions {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

/* ─── Table ──────────────────────────────────────────────────── */
.table-container {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.domain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.domain-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.domain-table th.sortable { cursor: pointer; }
.domain-table th.sortable:hover { color: var(--primary); }
.domain-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.domain-table tr:hover { background: #f8fafc; }
.domain-table tr.selected { background: #eff6ff; }

.domain-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.domain-link:hover { text-decoration: underline; }

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-light);
}

/* ─── Status badges ──────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.status-nouveau { background: #e0f2fe; color: #0369a1; }
.status-a_contacter { background: #fef3c7; color: #92400e; }
.status-en_cours { background: #dbeafe; color: #1d4ed8; }
.status-interesse { background: #ede9fe; color: #6d28d9; }
.status-pas_interesse { background: #fee2e2; color: #991b1b; }
.status-injoignable { background: #f1f5f9; color: #475569; }
.status-gagne { background: #dcfce7; color: #166534; }
.status-perdu { background: #fecaca; color: #991b1b; }

/* Status select in table */
.status-select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-light); margin: 0 12px; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card);
    border-radius: 12px;
    width: 700px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-sm { width: 500px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
    border: none; background: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-light);
}
.modal-body { padding: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-weight: 600;
    font-size: 12px; margin-bottom: 4px;
    color: var(--text-light); text-transform: uppercase;
}
.input-full { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.input-sm { width: 120px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
textarea.input-full { min-height: 80px; resize: vertical; font-family: inherit; }
.hint { font-size: 12px; color: var(--text-light); margin-bottom: 12px; }

/* Modal detail sections */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.detail-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px;
}
.detail-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 8px;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}
.detail-row .label { color: var(--text-light); }
.detail-row .value { font-weight: 500; }

.history-item {
    padding: 10px;
    border-left: 3px solid var(--primary);
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
}
.history-item .date { font-size: 11px; color: var(--text-light); }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .filter-row { flex-direction: column; }
    .filter-group { min-width: auto; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .navbar { flex-direction: column; gap: 8px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 12px; }
}

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Visit link */
.visit-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 12px;
}
.visit-link:hover { color: var(--primary); }
