/* ─────────────────────────────────────────
   CSS VARIABLES — light theme
   Legacy var names preserved so all
   JS-injected inline styles still resolve
───────────────────────────────────────── */
:root {
    /* Page surfaces */
    --bg0:    #f5f9f8;
    --bg1:    #ffffff;
    --bg2:    #f5f9f8;
    --bg3:    #eaf4f1;
    --border: rgba(78,179,154,0.15);

    /* Semantic colours (used heavily in JS-rendered HTML) */
    --amber:  #d97706;
    --amber2: #b45309;
    --green:  #16a34a;
    --red:    #dc2626;
    --blue:   #2563eb;
    --purple: #7c3aed;

    /* Text */
    --text0:  #1a2e2b;
    --text1:  #5f7a74;
    --text2:  #94aaa6;

    /* Font stacks — DM Mono/Sans already loaded by header.php */
    --mono:   'DM Mono', monospace;
    --sans:   'DM Sans', sans-serif;
}

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

/* ─────────────────────────────────────────
   PAGE WRAPPER
───────────────────────────────────────── */
.ct-page {
    font-family: var(--sans);
    background: var(--bg0);
    min-height: 100vh;
    color: var(--text0);
    padding: 0 0 5rem;
}

/* ─────────────────────────────────────────
   HERO — dark card (consistent with other tools)
───────────────────────────────────────── */
.ct-masthead {
    background: linear-gradient(145deg, #0e2d27 0%, #1a4a3d 60%, #0e3530 100%);
    border-bottom: 1px solid rgba(78,179,154,0.2);
    padding: 2.25rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}
.ct-masthead::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 60% 50%, rgba(78,179,154,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.ct-masthead-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

/* Brand inside hero */
.ct-brand { display: flex; align-items: center; gap: 14px; }
.ct-brand-icon {
    width: 44px; height: 44px;
    background: rgba(78,179,154,0.15);
    border: 1px solid rgba(78,179,154,0.35);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ct-brand-icon svg { width: 22px; height: 22px; stroke: #6fd1b3; fill: none; }
.ct-brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}
.ct-brand-text p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

/* Badges inside hero */
.ct-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ct-badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid;
}
.ct-badge.amber  { color: #fcd34d; border-color: rgba(252,211,77,.3);  background: rgba(252,211,77,.08); }
.ct-badge.green  { color: #6fd1b3; border-color: rgba(111,209,179,.3); background: rgba(111,209,179,.08); }
.ct-badge.blue   { color: #93c5fd; border-color: rgba(147,197,253,.3); background: rgba(147,197,253,.08); }

/* ─────────────────────────────────────────
   MAIN CONTENT AREA
───────────────────────────────────────── */
.ct-inner { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* ─────────────────────────────────────────
   SECTION HEADING — matches site pattern
───────────────────────────────────────── */
.ct-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.ct-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text1);
}
.ct-section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: rgba(78,179,154,0.15);
}

/* ─────────────────────────────────────────
   UPLOAD ZONE
───────────────────────────────────────── */
.upload-zone {
    border: 2px dashed rgba(78,179,154,0.3);
    border-radius: 14px;
    background: #fff;
    padding: 2.75rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 1.5rem;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #4eb39a;
    background: #f5f9f8;
}
.upload-icon {
    width: 52px; height: 52px;
    background: #e1f5ee;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
}
.upload-icon svg { width: 26px; height: 26px; stroke: #3a9b83; fill: none; }
.upload-zone h3 { font-size: 1rem; font-weight: 700; color: #0e2d27; margin-bottom: .4rem; }
.upload-zone p  { font-size: 0.82rem; color: var(--text1); }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* OR divider */
.or-divider {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text2);
    font-size: 0.75rem;
    font-family: var(--mono);
}
.or-divider::before, .or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(78,179,154,0.15);
}

/* ─────────────────────────────────────────
   TEXTAREA
───────────────────────────────────────── */
.ct-textarea {
    width: 100%;
    background: #fff;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 10px;
    padding: 1rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #1a2e2b;
    resize: vertical;
    min-height: 160px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.ct-textarea::placeholder { color: var(--text2); }
.ct-textarea:focus { border-color: #4eb39a; }

/* ─────────────────────────────────────────
   BUTTON ROW
───────────────────────────────────────── */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 2rem; }

.btn-primary {
    background: #4eb39a;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 700;
    color: #0e2d27;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    display: flex; align-items: center; gap: 8px;
}
.btn-primary:hover   { background: #3a9b83; transform: translateY(-1px); }
.btn-primary:active  { transform: scale(.98); }
.btn-primary:disabled{ background: #e1f5ee; color: #94aaa6; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.25);
    border-radius: 8px;
    padding: 10px 18px;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text1);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    display: flex; align-items: center; gap: 8px;
}
.btn-secondary:hover { border-color: #4eb39a; color: #3a9b83; background: #f5f9f8; }

/* ─────────────────────────────────────────
   RESULTS SECTION
───────────────────────────────────────── */
#results { display: none; }

/* ─────────────────────────────────────────
   STAT CARDS
───────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-left: 3px solid var(--accent, #4eb39a);
    border-radius: 10px;
    padding: 1.1rem 1rem;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.stat-card-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text1);
    margin-bottom: .4rem;
}
.stat-card-value {
    font-family: var(--mono);
    font-size: 1.6rem;
    font-weight: 600;
    color: #0e2d27;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-card-sub {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text2);
    margin-top: 4px;
}

/* ─────────────────────────────────────────
   THREAT PANEL
───────────────────────────────────────── */
.threat-panel {
    background: #fff;
    border: 1px solid rgba(220,38,38,0.2);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.threat-panel-head {
    background: rgba(220,38,38,0.05);
    border-bottom: 1px solid rgba(220,38,38,0.12);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.threat-panel-head svg { width: 18px; height: 18px; stroke: #dc2626; fill: none; flex-shrink: 0; }
.threat-panel-head span { font-size: 0.875rem; font-weight: 700; color: #991b1b; letter-spacing: .01em; }
.threat-count {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(220,38,38,0.1);
    color: #dc2626;
    border: 1px solid rgba(220,38,38,0.25);
}

.threat-list { padding: .5rem; }
.threat-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background .15s;
    cursor: default;
}
.threat-item:hover { background: rgba(78,179,154,0.04); }
.threat-item:last-child { margin-bottom: 0; }

/* Severity badges — light-bg versions */
.threat-sev {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sev-critical { background: rgba(220,38,38,0.1);   color: #991b1b; border: 1px solid rgba(220,38,38,0.25); }
.sev-high     { background: rgba(217,119,6,0.1);   color: #92400e; border: 1px solid rgba(217,119,6,0.25); }
.sev-medium   { background: rgba(217,119,6,0.07);  color: #b45309; border: 1px solid rgba(217,119,6,0.2); }
.sev-info     { background: rgba(37,99,235,0.08);  color: #1e40af; border: 1px solid rgba(37,99,235,0.2); }

.threat-body  { flex: 1; min-width: 0; }
.threat-title { font-size: 0.875rem; font-weight: 600; color: #0e2d27; margin-bottom: 2px; }
.threat-detail {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-threats {
    padding: 2rem;
    text-align: center;
    color: #16a34a;
    font-family: var(--mono);
    font-size: 0.82rem;
}

/* ─────────────────────────────────────────
   TWO-COL + DATA CARDS
───────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }

.data-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.data-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.data-card-head {
    padding: .75rem 1.1rem;
    border-bottom: 1px solid rgba(78,179,154,0.12);
    background: #f5f9f8;
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text1);
    display: flex;
    align-items: center;
    gap: 8px;
}
.data-card-head svg { width: 14px; height: 14px; stroke: #3a9b83; fill: none; stroke-width: 1.5; }

/* Rank list */
.rank-list { padding: .5rem 0; }
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .45rem 1.1rem;
    transition: background .15s;
}
.rank-row:hover { background: rgba(78,179,154,0.04); }
.rank-num   { font-family: var(--mono); font-size: 0.68rem; color: var(--text2); min-width: 18px; }
.rank-label { font-family: var(--mono); font-size: 0.75rem; color: #0e2d27; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar-wrap { width: 80px; height: 4px; background: rgba(78,179,154,0.1); border-radius: 99px; overflow: hidden; }
.rank-bar   { height: 100%; border-radius: 99px; background: #4eb39a; transition: width .6s ease; }
.rank-count { font-family: var(--mono); font-size: 0.68rem; color: var(--text1); min-width: 36px; text-align: right; }

/* ─────────────────────────────────────────
   TIMELINE CHART — white card
───────────────────────────────────────── */
.timeline-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.timeline-canvas-wrap { padding: 1rem 1.25rem 1.25rem; position: relative; height: 180px; }
canvas#timelineChart { width: 100% !important; height: 100% !important; }

/* ─────────────────────────────────────────
   EVENT LOG TABLE
───────────────────────────────────────── */
.event-log-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.filter-bar {
    padding: .75rem 1rem;
    border-bottom: 1px solid rgba(78,179,154,0.12);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    background: #f5f9f8;
}
.filter-input {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 7px;
    padding: 7px 12px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #1a2e2b;
    outline: none;
    transition: border-color .2s;
    flex: 1;
    min-width: 160px;
}
.filter-input::placeholder { color: var(--text2); }
.filter-input:focus { border-color: #4eb39a; }

.filter-select {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 7px;
    padding: 7px 10px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: #1a2e2b;
    outline: none;
    cursor: pointer;
    transition: border-color .2s;
}
.filter-select:focus { border-color: #4eb39a; }

.table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
.ct-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; min-width: 700px; }
.ct-table thead th {
    padding: .6rem 1rem;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text1);
    background: #eaf4f1;
    border-bottom: 1px solid rgba(78,179,154,0.15);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.ct-table tbody tr { border-bottom: 1px solid rgba(78,179,154,0.07); transition: background .1s; }
.ct-table tbody tr:hover { background: rgba(78,179,154,0.04); }
.ct-table tbody td {
    padding: .55rem 1rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text1);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ct-table tbody td:first-child { color: var(--text2); font-size: 0.68rem; }

/* Event status badges — light-bg versions */
.ev-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--mono);
    letter-spacing: 0.03em;
}
.ev-badge.error   { background: rgba(220,38,38,0.08);  color: #991b1b; }
.ev-badge.warning { background: rgba(217,119,6,0.08);  color: #92400e; }
.ev-badge.success { background: rgba(22,163,74,0.08);  color: #166534; }
.ev-badge.info    { background: rgba(37,99,235,0.08);  color: #1e40af; }

.table-footer {
    padding: .6rem 1rem;
    border-top: 1px solid rgba(78,179,154,0.12);
    background: #f5f9f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text2);
    font-family: var(--mono);
    flex-wrap: wrap;
    gap: .5rem;
}

/* ─────────────────────────────────────────
   SERVICE BREAKDOWN
───────────────────────────────────────── */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 2rem;
}
.service-item {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 10px;
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.2s;
}
.service-item:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.05); }
.service-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.service-name  { font-family: var(--mono); font-size: 0.75rem; color: #0e2d27; flex: 1; }
.service-count { font-family: var(--mono); font-size: 0.75rem; color: var(--text1); }

/* ─────────────────────────────────────────
   SAMPLE NOTE
───────────────────────────────────────── */
.sample-note {
    font-size: 0.78rem;
    color: var(--text2);
    margin-bottom: 1rem;
    font-family: var(--mono);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sample-note a { color: #3a9b83; cursor: pointer; text-decoration: none; font-weight: 600; }
.sample-note a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────
   SEO / FAQ CARD
───────────────────────────────────────── */
.seo-block {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 10px;
    padding: 1.75rem 2rem;
    margin-top: 2rem;
}
.seo-block h2 { font-size: 1.1rem; font-weight: 700; color: #0e2d27; margin-bottom: .5rem; }
.seo-block p  { font-size: 0.875rem; color: var(--text1); line-height: 1.8; }
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.faq-item {
    background: #f5f9f8;
    border: 1px solid rgba(78,179,154,0.15);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.faq-q { font-size: 0.875rem; font-weight: 600; color: #0e2d27; margin-bottom: .4rem; }
.faq-a { font-size: 0.82rem; color: var(--text1); line-height: 1.7; }

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
.ct-toast {
    position: fixed;
    bottom: 2rem; right: 2rem;
    background: #0e2d27;
    border: 1px solid rgba(78,179,154,0.35);
    border-radius: 10px;
    padding: .7rem 1.25rem;
    font-size: 0.82rem;
    font-family: var(--mono);
    color: #e1f5ee;
    z-index: 999;
    transform: translateY(80px);
    opacity: 0;
    transition: all .3s;
    pointer-events: none;
}
.ct-toast.show { transform: translateY(0); opacity: 1; }

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 700px) {
    .ct-inner     { padding: 1.25rem; }
    .two-col      { grid-template-columns: 1fr; }
    .stat-grid    { grid-template-columns: repeat(2, 1fr); }
    .ct-masthead  { padding: 1.75rem 1.25rem 1.5rem; }
    .seo-block    { padding: 1.25rem; }
}
