:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1a1d26;
    --text-muted: #5c6370;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --radius: 16px;
    --font: 'Vazirmatn', system-ui, sans-serif;
}

body.dark {
    --bg: #0f1117;
    --card: #1a1d27;
    --text: #e8eaed;
    --text-muted: #9ca3af;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --border: #2d3140;
    --shadow: 0 4px 24px rgba(0,0,0,0.35);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.app {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 8px 0;
}

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

.logo-icon {
    font-size: 2.4rem;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(79,70,229,0.3);
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.theme-btn {
    background: var(--card);
    border: 1px solid var(--border);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.theme-btn:hover {
    transform: scale(1.08);
}

body.light .moon { display: none; }
body.dark .sun { display: none; }

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: background 0.3s, border 0.3s;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* Form */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .grid-2 { grid-template-columns: 1fr; }
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.field input,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 28px;
    color: var(--text);
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 6px 20px rgba(79,70,229,0.35);
    margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(79,70,229,0.45);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner.hidden { display: none; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.clean {
    background: rgba(16,185,129,0.15);
    color: #059669;
}

.badge.threats {
    background: rgba(239,68,68,0.15);
    color: #dc2626;
}

.badge.warning {
    background: rgba(245,158,11,0.15);
    color: #d97706;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-box .num {
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
}

.stat-box .lbl {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-box.danger .num { color: var(--danger); }
.stat-box.warning .num { color: var(--warning); }
.stat-box.success .num { color: var(--success); }

.details h3 {
    font-size: 1rem;
    margin: 20px 0 10px;
    color: var(--text-muted);
}

.threat-item, .susp-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-right: 4px solid var(--danger);
    font-size: 0.9rem;
}

.susp-item {
    border-right-color: var(--warning);
}

.threat-item .path, .susp-item .path {
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin-bottom: 6px;
    direction: ltr;
    text-align: left;
}

.threat-item .reasons {
    color: var(--danger);
    font-size: 0.85rem;
}

.wp-info {
    background: linear-gradient(135deg, rgba(79,70,229,0.1), rgba(124,58,237,0.1));
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.history-header .count {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.15s;
}

.history-item:hover {
    transform: translateX(-4px);
}

.history-item.threats_found {
    border-right: 4px solid var(--danger);
}

.history-item.clean {
    border-right: 4px solid var(--success);
}

.hi-host {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.hi-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.wp-tag {
    background: #4f46e5;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.hi-stats {
    display: flex;
    gap: 16px;
}

.hi-stats .stat {
    text-align: center;
}

.hi-stats .num {
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
}

.hi-stats .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hi-stats .threat .num { color: var(--danger); }
.hi-stats .warn .num { color: var(--warning); }

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

/* Footer */
.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 20px;
    line-height: 1.8;
}

.hidden { display: none !important; }

/* Errors */
.error-box {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
