/* =============================================================
   ReverseMX — Postmastery Tooling
   style.css
   ============================================================= */

:root {
    --pm-blue:      #0a4d8c;
    --pm-blue-dark: #083a6e;
    --pm-accent:    #1e88e5;
    --pm-green:     #2e7d32;
    --pm-red:       #c62828;
    --pm-orange:    #e65100;
    --bg:           #f4f6f9;
    --surface:      #ffffff;
    --border:       #dde3eb;
    --text:         #1a2332;
    --text-muted:   #6b7a8d;
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono:         'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --radius:       6px;
    --shadow:       0 1px 4px rgba(0,0,0,.08);
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

code {
    font-family: var(--mono);
    background: #eef2f7;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* ---- Header ---- */
header {
    background: var(--pm-blue);
    color: #fff;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 32px;
}

.logo { font-size: 18px; font-weight: 700; letter-spacing: -.3px; flex-shrink: 0; }
.logo-pm   { color: #fff; }
.logo-tool { color: #90caf9; margin-left: 4px; }

nav { display: flex; gap: 4px; }
nav a {
    color: rgba(255,255,255,.8);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
nav a:hover, nav a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
    text-decoration: none;
}

/* ---- Stats bar ---- */
.stats-bar {
    background: var(--pm-blue-dark);
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 48px;
    border-right: 1px solid rgba(255,255,255,.1);
}
.stat:last-child { border-right: none; }

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #90caf9;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.stat-label {
    font-size: 11px;
    color: rgba(255,255,255,.6);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-top: 4px;
}

/* ---- Main content ---- */
main { flex: 1; max-width: 1400px; margin: 0 auto; width: 100%; padding: 24px; }

.content { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }

.content-header { margin-bottom: 20px; }
.content-header h1 { font-size: 20px; font-weight: 600; color: var(--text); }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---- Breadcrumb ---- */
.breadcrumb { margin-bottom: 16px; font-size: 13px; }
.breadcrumb a { color: var(--pm-accent); }

/* ---- Search ---- */
.search-form { margin-bottom: 20px; }

.search-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrap input[type="text"] {
    flex: 1;
    min-width: 280px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    font-family: var(--mono);
    transition: border-color .15s, box-shadow .15s;
}
.search-wrap input[type="text"]:focus {
    outline: none;
    border-color: var(--pm-accent);
    box-shadow: 0 0 0 3px rgba(30,136,229,.12);
}

.search-wrap button {
    padding: 8px 20px;
    background: var(--pm-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s;
}
.search-wrap button:hover { background: var(--pm-blue); }

.btn-reset {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    transition: background .15s;
}
.btn-reset:hover { background: #f0f0f0; text-decoration: none; color: var(--text); }

.search-result-info { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.search-result-info strong { color: var(--text); }

/* ---- Export bar ---- */
.export-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-export {
    padding: 6px 16px;
    background: var(--pm-green);
    color: #fff;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: opacity .15s;
}
.btn-export:hover { opacity: .85; text-decoration: none; }
.export-info { font-size: 12px; color: var(--text-muted); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }

.mx-table, .domain-table, .import-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mx-table th, .domain-table th, .import-table th {
    background: #f0f4f8;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.mx-table td, .domain-table td, .import-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.mx-table tr:hover td, .domain-table tr:hover td { background: #f7f9fc; }

.col-rank  { width: 60px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.col-mx    { font-family: var(--mono); font-size: 12px; }
.col-count { width: 120px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-bar   { width: 200px; }
.col-action { width: 120px; text-align: center; }
.col-domain { font-family: var(--mono); font-size: 12px; }
.col-updated { width: 100px; color: var(--text-muted); white-space: nowrap; }

.mx-link, .domain-link {
    color: var(--pm-accent);
    font-family: var(--mono);
    font-size: 12px;
}
.mx-link:hover, .domain-link:hover { text-decoration: underline; }

/* Bar de proportion */
.bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bar {
    height: 8px;
    background: var(--pm-accent);
    border-radius: 4px;
    min-width: 2px;
    opacity: .75;
    flex-shrink: 0;
}
.bar-pct { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.btn-lookup {
    display: inline-block;
    padding: 4px 12px;
    background: var(--pm-blue);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    transition: background .15s;
}
.btn-lookup:hover { background: var(--pm-blue-dark); text-decoration: none; }

.empty { text-align: center; color: var(--text-muted); padding: 32px; font-style: italic; }

/* ---- Lookup header ---- */
.lookup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.lookup-mx-name h1 { font-size: 18px; font-weight: 600; }
.lookup-mx-name h1 code { font-size: 16px; background: none; padding: 0; color: var(--pm-blue); }
.lookup-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-size: 12px; color: var(--text-muted); }

.btn-copy {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 12px;
    transition: background .15s;
}
.btn-copy:hover { background: #f0f0f0; text-decoration: none; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--pm-accent);
    font-size: 13px;
    transition: background .15s, color .15s;
}
.page-btn:hover { background: var(--pm-accent); color: #fff; border-color: var(--pm-accent); text-decoration: none; }
.page-btn.active { background: var(--pm-blue); color: #fff; border-color: var(--pm-blue); font-weight: 600; }

.page-info { margin-left: 12px; font-size: 12px; color: var(--text-muted); }

/* ---- Imports section ---- */
.imports-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}
.imports-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

.filename { font-family: var(--mono); font-size: 11px; color: var(--text-muted); max-width: 250px; overflow: hidden; text-overflow: ellipsis; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.badge-done    { background: #e8f5e9; color: var(--pm-green); }
.badge-running { background: #e3f2fd; color: var(--pm-accent); }
.badge-error   { background: #ffebee; color: var(--pm-red); }

/* ---- Alert ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-error { background: #ffebee; border-left: 4px solid var(--pm-red); color: #b71c1c; }

/* ---- Footer ---- */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--pm-accent); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .stats-bar { flex-wrap: wrap; }
    .stat { padding: 10px 20px; border-right: none; border-bottom: 1px solid rgba(255,255,255,.1); width: 50%; }
    main { padding: 12px; }
    .lookup-header { flex-direction: column; }
    .lookup-meta { align-items: flex-start; }
    .col-bar { display: none; }
    .col-action { display: none; }
}

/* Colonnes supplémentaires MX Index v2 */
.col-friendly { font-size: 12px; }
.col-type     { width: 130px; }
.col-spam     { width: 70px; text-align: center; }

.friendly-link {
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}
.friendly-link:hover { color: var(--pm-accent); text-decoration: underline; }

.classify-link {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}
.classify-link:hover { color: var(--pm-accent); text-decoration: underline; }

/* Type badges dans index */
.type-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.type-mailbox_b2b  { background: #e3f2fd; color: #1565c0; }
.type-mailbox_b2c  { background: #e8f5e9; color: #2e7d32; }
.type-hosting      { background: #fff3e0; color: #e65100; }
.type-sending      { background: #f3e5f5; color: #6a1b9a; }
.type-inhouse      { background: #fce4ec; color: #880e4f; }
.type-parked       { background: #f5f5f5; color: #757575; }
.type-undefined    { background: #f5f5f5; color: #9e9e9e; }

/* Lookup classification bar */
.lookup-classification {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
    flex-wrap: wrap;
}

.friendly-name-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--pm-blue);
    background: #e8f0fb;
    padding: 3px 10px;
    border-radius: 12px;
}
