/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-primary: #0f1923;
    --bg-secondary: #1a2732;
    --bg-card: #1e2d3a;
    --bg-input: #253545;
    --border: #2e4052;
    --text-primary: #e4e8ec;
    --text-secondary: #8a9bae;
    --text-muted: #5a6e80;
    --green: #22c55e;
    --green-bg: rgba(34,197,94,.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234,179,8,.12);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59,130,246,.12);
    --accent: #3b82f6;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Layout === */
.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }

header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky; top: 0; z-index: 100;
}
header .container { display: flex; align-items: center; justify-content: space-between; padding-top: 0; padding-bottom: 0; }
.logo { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.refresh-info { font-size: .78rem; color: var(--text-muted); }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius);
    font-size: .85rem; font-weight: 500; cursor: pointer;
    transition: all .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* === Add Domain Form === */
.add-domain {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.add-domain .field { flex: 1; min-width: 250px; }
.add-domain label { display: block; font-size: .8rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.add-domain input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
    font-size: .9rem; outline: none; transition: border-color .15s;
}
.add-domain input:focus { border-color: var(--accent); }
.add-domain input::placeholder { color: var(--text-muted); }

/* === Summary Cards === */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform .15s;
}
.card:hover { transform: translateY(-2px); }
.card-label { font-size: .78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.card-value { font-size: 2rem; font-weight: 700; margin-top: 4px; }
.card-value.green { color: var(--green); }
.card-value.yellow { color: var(--yellow); }
.card-value.red { color: var(--red); }
.card-value.blue { color: var(--blue); }

/* === Table === */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
.table-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.table-header h2 { font-size: 1rem; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: 12px 16px;
    font-size: .75rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 14px 16px; font-size: .88rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(59,130,246,.04); }

/* === Status Badge === */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-green .badge-dot { background: var(--green); }
.badge-yellow .badge-dot { background: var(--yellow); }
.badge-red .badge-dot { background: var(--red); }

/* === Risk Bar === */
.risk-bar { display: flex; align-items: center; gap: 8px; }
.risk-track { width: 60px; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.risk-fill { height: 100%; border-radius: 3px; transition: width .3s ease; }
.risk-fill.green { background: var(--green); }
.risk-fill.yellow { background: var(--yellow); }
.risk-fill.red { background: var(--red); }
.risk-label { font-size: .78rem; font-weight: 600; min-width: 28px; }

/* === Action buttons in table === */
.actions { display: flex; gap: 6px; }

/* === Empty state === */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state p { font-size: .95rem; margin-top: 8px; }
.empty-icon { font-size: 2.5rem; margin-bottom: 8px; opacity: .5; }

/* === Toast === */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius);
    font-size: .85rem; color: #fff;
    box-shadow: var(--shadow);
    animation: slideIn .25s ease;
    max-width: 380px;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }

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

/* === Loading spinner === */
.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
.spinner-dark {
    border-color: rgba(138,155,174,.3);
    border-top-color: var(--text-secondary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Responsive === */
@media (max-width: 768px) {
    .summary { grid-template-columns: repeat(2, 1fr); }
    .add-domain { flex-direction: column; }
    .add-domain .field { min-width: 100%; }
}
