/* DMARC MSP Platform - Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

:root {
    --bg:         #0d1117;
    --bg2:        #161b22;
    --bg3:        #21262d;
    --border:     #30363d;
    --text:       #e6edf3;
    --text2:      #8b949e;
    --text3:      #6e7681;
    --accent:     #58a6ff;
    --accent2:    #1f6feb;
    --pass:       #3fb950;
    --fail:       #f85149;
    --warn:       #d29922;
    --none:       #6e7681;
    --radius:     6px;
    --radius-lg:  10px;
    --font:       'IBM Plex Sans', sans-serif;
    --mono:       'IBM Plex Mono', monospace;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- Layout ---- */
.layout {
    display: flex;
    min-height: 100vh;
    min-width: 800px;
}

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 32px; height: 32px;
    background: var(--accent2);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: white;
}

.sidebar-logo .logo-text {
    font-size: 13px; font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.sidebar-logo .logo-text small {
    display: block;
    font-size: 11px;
    color: var(--text2);
    font-weight: 400;
}

.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-section {
    padding: 12px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    color: var(--text2);
    font-size: 13px;
    transition: all 0.15s;
    cursor: pointer;
    border-left: 2px solid transparent;
    text-decoration: none;
}
.nav-item:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-item.active {
    color: var(--accent);
    background: rgba(88,166,255,0.08);
    border-left-color: var(--accent);
}
.nav-item .icon { width: 16px; text-align: center; font-size: 14px; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text2);
}
.sidebar-footer .user-name { font-weight: 500; color: var(--text); }

.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: auto;
}

.topbar {
    height: 56px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.page-body { padding: 24px; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.card-body { padding: 20px; }

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}
.stat-card.pass::before  { background: var(--pass); }
.stat-card.fail::before  { background: var(--fail); }
.stat-card.warn::before  { background: var(--warn); }
.stat-card.info::before  { background: var(--accent); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text2);
    margin-bottom: 8px;
}
.stat-value {
    font-size: 28px;
    font-weight: 600;
    font-family: var(--mono);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card.pass .stat-value { color: var(--pass); }
.stat-card.fail .stat-value { color: var(--fail); }
.stat-card.warn .stat-value { color: var(--warn); }
.stat-card.info .stat-value { color: var(--accent); }
.stat-sub { font-size: 11px; color: var(--text2); }

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    text-transform: uppercase;
}
.badge-pass { background: rgba(63,185,80,0.15); color: var(--pass); }
.badge-fail { background: rgba(248,81,73,0.15); color: var(--fail); }
.badge-warn { background: rgba(210,153,34,0.15); color: var(--warn); }
.badge-none { background: var(--bg3); color: var(--text2); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    font-family: var(--font);
}
.btn-primary {
    background: var(--accent2);
    color: white;
    border-color: var(--accent2);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: white; text-decoration: none; }
.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--text2); text-decoration: none; }
.btn-danger {
    background: rgba(248,81,73,0.15);
    color: var(--fail);
    border-color: rgba(248,81,73,0.3);
}
.btn-danger:hover { background: rgba(248,81,73,0.25); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: var(--font);
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88,166,255,0.1);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- Alerts / Flash ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert-success { background: rgba(63,185,80,0.1);  border-color: rgba(63,185,80,0.3);  color: var(--pass); }
.alert-error   { background: rgba(248,81,73,0.1);  border-color: rgba(248,81,73,0.3);  color: var(--fail); }
.alert-warning { background: rgba(210,153,34,0.1); border-color: rgba(210,153,34,0.3); color: var(--warn); }
.alert-info    { background: rgba(88,166,255,0.1); border-color: rgba(88,166,255,0.3); color: var(--accent); }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Flag ---- */
.flag { font-size: 16px; }
.ip-cell { font-family: var(--mono); font-size: 12px; }
.count-bar {
    display: flex; align-items: center; gap: 8px;
}
.count-bar-fill {
    height: 4px; border-radius: 2px; background: var(--accent2);
    min-width: 4px;
}

/* ---- Pagination ---- */
.pagination {
    display: flex; gap: 4px; align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text2);
    border: 1px solid transparent;
    text-decoration: none;
}
.page-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.page-link.active {
    background: var(--accent2);
    color: white;
    border-color: var(--accent2);
}

/* ---- Login ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-box {
    width: 360px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo .icon {
    width: 48px; height: 48px;
    background: var(--accent2);
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; color: white; margin-bottom: 12px;
}
.login-logo h1 { font-size: 18px; font-weight: 600; }
.login-logo p  { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ---- Chart container ---- */
.chart-container { position: relative; height: 200px; }

/* ---- Unread badge ---- */
.unread-badge {
    background: var(--fail);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    margin-left: auto;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text2);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ---- Progress bar ---- */
.progress {
    height: 6px; background: var(--bg3);
    border-radius: 3px; overflow: hidden;
}
.progress-bar {
    height: 100%; border-radius: 3px;
    transition: width 0.3s ease;
}
.progress-pass { background: var(--pass); }
.progress-fail { background: var(--fail); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Misc ---- */
.text-mono { font-family: var(--mono); }
.text-sm   { font-size: 12px; }
.text-muted { color: var(--text2); }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }
