/* CSP Violation Reporter — styles.css */
/* Royal Purple dark palette */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --bg: #0D0818;
    --bg2: #130D22;
    --surface: #1A1030;
    --surface2: #211543;
    --border: #311D60;
    --primary: #6C5CE7;
    --secondary: #A29BFE;
    --accent: #FD79A8;
    --success: #00B894;
    --warning: #FFEAA7;
    --danger: #FF7675;
    --text: #EDE9FE;
    --muted: #7F6AC8;
    --radius: 12px;
    --radius-sm: 8px;
    --glass: rgba(108, 92, 231, 0.08);
    --glass-border: rgba(162, 155, 254, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 70% 40% at 10% 0%, rgba(108, 92, 231, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 50% 30% at 90% 100%, rgba(253, 121, 168, 0.08) 0%, transparent 55%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ──────────────────────────────────────────────── */
header {
    background: rgba(13, 8, 24, 0.9);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.tagline {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 184, 148, 0.1);
    border: 1px solid rgba(0, 184, 148, 0.3);
    color: var(--success);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

/* ── Controls Bar ────────────────────────────────────────── */
.controls-bar {
    background: rgba(13, 8, 24, 0.7);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    backdrop-filter: blur(8px);
}

.controls-inner {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.policy-group {
    flex: 2;
    min-width: 260px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.ctrl-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 6px;
}

.policy-row {
    display: flex;
    gap: 6px;
}

.filter-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.policy-txt,
.search-txt {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.policy-txt:focus,
.search-txt:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

.policy-txt::placeholder,
.search-txt::placeholder {
    color: var(--muted);
    font-family: 'Inter', sans-serif;
}

.select-field {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.select-field:focus {
    border-color: var(--primary);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.72rem;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: #5A4BD8;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.4);
}

.btn-accent {
    background: rgba(253, 121, 168, 0.15);
    color: var(--accent);
    border: 1px solid rgba(253, 121, 168, 0.3);
}

.btn-accent:hover {
    background: rgba(253, 121, 168, 0.25);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--muted);
}

/* ── Stats ───────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    backdrop-filter: blur(4px);
    transition: transform 0.18s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1;
}

.stat-lbl {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 4px;
}

.stat-critical .stat-num {
    color: #FF7675;
}

.stat-high .stat-num {
    color: #FDCB6E;
}

.stat-medium .stat-num {
    color: #FFEAA7;
}

/* ── Panel ───────────────────────────────────────────────── */
.panel {
    background: rgba(26, 16, 48, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--muted);
    cursor: pointer;
}

.toggle-row input {
    accent-color: var(--primary);
}

/* ── Violation List ──────────────────────────────────────── */
.violation-list {
    padding: 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.2;
    margin-bottom: 14px;
}

.empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    mb: 6px;
}

.empty-sub {
    font-size: 0.82rem;
    color: #4B3F7A;
    margin-top: 8px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Violation Card ──────────────────────────────────────── */
.violation-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
    transition: box-shadow 0.18s, border-color 0.18s;
    animation: slide-in 0.22s ease;
    cursor: pointer;
}

.violation-card:hover {
    border-color: var(--secondary);
    box-shadow: 0 2px 12px rgba(108, 92, 231, 0.2);
}

.violation-card.expanded {
    border-color: var(--primary);
}

.vc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    flex-wrap: wrap;
}

.severity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sv-critical {
    background: #FF7675;
    box-shadow: 0 0 6px rgba(255, 118, 117, 0.5);
}

.sv-high {
    background: #FDCB6E;
    box-shadow: 0 0 6px rgba(253, 203, 110, 0.4);
}

.sv-medium {
    background: #FFEAA7;
}

.sv-low {
    background: #55EFC4;
}

.vc-directive {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(108, 92, 231, 0.15);
    color: var(--secondary);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(162, 155, 254, 0.2);
    white-space: nowrap;
}

.vc-uri {
    flex: 1;
    font-size: 0.78rem;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vc-time {
    font-size: 0.65rem;
    color: var(--muted);
    flex-shrink: 0;
}

.vc-expand {
    color: var(--muted);
    font-size: 0.8rem;
    transition: transform 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.violation-card.expanded .vc-expand {
    transform: rotate(90deg);
}

.vc-body {
    border-top: 1px solid var(--border);
    padding: 12px 14px;
    display: none;
    animation: fade-in 0.18s ease;
}

.violation-card.expanded .vc-body {
    display: block;
}

.vc-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.vc-detail {}

.vc-detail-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 3px;
}

.vc-detail-value {
    font-size: 0.78rem;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}

.fix-box {
    background: rgba(0, 184, 148, 0.06);
    border: 1px solid rgba(0, 184, 148, 0.2);
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 8px;
}

.fix-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--success);
    margin-bottom: 5px;
    font-weight: 600;
}

.fix-text {
    font-size: 0.78rem;
    color: #ADEFDF;
    line-height: 1.5;
}

/* ── Group Header ────────────────────────────────────────── */
.group-header {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary);
    padding: 10px 4px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(162, 155, 254, 0.15);
    margin-bottom: 6px;
}

/* ── Policy Panel ────────────────────────────────────────── */
.policy-pre {
    background: rgba(13, 8, 24, 0.8);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #C3B1FD;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 12px 18px 16px;
    line-height: 1.6;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slide-up 0.22s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text);
}

.detail-content {
    space-y: 12px;
}

.detail-section {
    margin-bottom: 14px;
}

.detail-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.detail-section-value {
    background: rgba(13, 8, 24, 0.7);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--secondary);
    word-break: break-all;
}

/* ── Toast ───────────────────────────────────────────────── */
#toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.83rem;
    color: var(--text);
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: slide-right 0.22s ease;
}

.toast.success {
    border-color: rgba(0, 184, 148, 0.4);
    color: #55EFC4;
}

.toast.error {
    border-color: rgba(255, 118, 117, 0.4);
    color: #FF7675;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes slide-in {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }
}

@keyframes slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
}

@keyframes slide-right {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .controls-inner {
        flex-direction: column;
    }

    .policy-row {
        flex-wrap: wrap;
    }
}