/* ═══════════════════════════════════════════
   VENOM — Static Malware Analyzer
   Dark cybersec aesthetic
   ═══════════════════════════════════════════ */

:root {
    --bg-primary: #0a0a0c;
    --bg-secondary: #111114;
    --bg-card: #151518;
    --bg-card-hover: #1a1a1e;
    --bg-elevated: #1e1e22;

    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-dim: rgba(255, 255, 255, 0.07);
    --border-medium: rgba(255, 255, 255, 0.1);

    --text-primary: #e8e8ec;
    --text-secondary: #8a8a96;
    --text-muted: #55555f;
    --text-faint: #3a3a42;

    --accent-cyan: #00d4ff;
    --accent-cyan-dim: rgba(0, 212, 255, 0.12);
    --accent-green: #00ff88;
    --accent-green-dim: rgba(0, 255, 136, 0.1);
    --accent-red: #ff3355;
    --accent-red-dim: rgba(255, 51, 85, 0.1);
    --accent-orange: #ff8833;
    --accent-orange-dim: rgba(255, 136, 51, 0.1);
    --accent-yellow: #ffcc00;
    --accent-yellow-dim: rgba(255, 204, 0, 0.1);
    --accent-purple: #aa55ff;
    --accent-purple-dim: rgba(170, 85, 255, 0.1);

    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);
    --shadow-glow-red: 0 0 20px rgba(255, 51, 85, 0.15);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ═══ Background Effects ═══ */

.grid-bg {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    opacity: 0.3;
    z-index: 999;
    animation: scanLine 8s linear infinite;
    pointer-events: none;
}

@keyframes scanLine {
    0% { top: -2px; }
    100% { top: 100vh; }
}

/* ═══ App Container ═══ */

.app-container {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* ═══ Header ═══ */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 32px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 32px;
}

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

.logo-icon {
    width: 38px;
    height: 38px;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.3));
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text h1 {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--text-primary);
    line-height: 1;
}

.logo-sub {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ═══ Upload Zone ═══ */

.upload-section {
    animation: fadeInUp 0.5s ease;
}

.upload-zone {
    position: relative;
    border: 1.5px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 64px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.03), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-cyan);
    background: var(--bg-card);
    box-shadow: var(--shadow-glow-cyan);
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
    opacity: 1;
}

.upload-icon {
    width: 56px;
    height: 56px;
    color: var(--text-muted);
    transition: color 0.3s, transform 0.3s;
}

.upload-zone:hover .upload-icon {
    color: var(--accent-cyan);
    transform: translateY(-4px);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-text {
    text-align: center;
}

.upload-primary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.upload-browse {
    color: var(--accent-cyan);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.upload-browse:hover {
    color: #33ddff;
}

.upload-secondary {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ═══ Cards ═══ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.45s ease backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.12s; }
.card:nth-child(3) { animation-delay: 0.19s; }
.card:nth-child(4) { animation-delay: 0.26s; }
.card:nth-child(5) { animation-delay: 0.33s; }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.card-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    flex: 1;
}

.card-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

/* ═══ File Meta Grid ═══ */

.file-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.meta-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.meta-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.meta-value {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.4;
}

.meta-value.hash {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* ═══ Threat Gauge ═══ */

.threat-gauge-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.threat-gauge {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.gauge-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s;
    background: var(--accent-green);
}

.gauge-fill.low { background: var(--accent-green); }
.gauge-fill.medium { background: var(--accent-yellow); }
.gauge-fill.high { background: var(--accent-orange); }
.gauge-fill.critical { background: var(--accent-red); }

.threat-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2px;
    white-space: nowrap;
}

.threat-label.clean { color: var(--accent-green); }
.threat-label.low { color: var(--accent-green); }
.threat-label.medium { color: var(--accent-yellow); }
.threat-label.high { color: var(--accent-orange); }
.threat-label.critical { color: var(--accent-red); }

.threat-score {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 44px;
    text-align: right;
}

/* ═══ Threat Tags ═══ */

.threat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.threat-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 5px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.threat-tag.info {
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.threat-tag.warn {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
    border: 1px solid rgba(255, 136, 51, 0.15);
}

.threat-tag.danger {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border: 1px solid rgba(255, 51, 85, 0.15);
}

.threat-tag.safe {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.15);
}

/* ═══ Detections ═══ */

.detection-count,
.webhook-count,
.string-count {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
}

.detections-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.detection-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}

.detection-item:hover {
    border-color: var(--border-dim);
}

.detection-severity {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 1px;
}

.detection-severity.critical {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.detection-severity.high {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
}

.detection-severity.medium {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
}

.detection-severity.low {
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
}

.detection-body {
    flex: 1;
    min-width: 0;
}

.detection-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.detection-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.detection-match {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 3px;
    margin-top: 6px;
    word-break: break-all;
    display: block;
    max-height: 60px;
    overflow: hidden;
}

.no-detections {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.no-detections svg {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    color: var(--accent-green);
}

/* ═══ Webhooks ═══ */

.webhook-icon {
    color: #5865F2 !important;
}

.webhook-count {
    background: rgba(88, 101, 242, 0.15) !important;
    color: #5865F2 !important;
}

.webhooks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.webhook-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.webhook-item:hover {
    border-color: rgba(88, 101, 242, 0.2);
}

.webhook-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.5;
    min-width: 0;
}

.webhook-delete-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 51, 85, 0.25);
    border-radius: var(--radius-sm);
    background: var(--accent-red-dim);
    color: var(--accent-red);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.webhook-delete-btn:hover {
    background: rgba(255, 51, 85, 0.2);
    border-color: rgba(255, 51, 85, 0.4);
    box-shadow: var(--shadow-glow-red);
}

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

.webhook-delete-btn.deleted {
    background: var(--accent-green-dim);
    border-color: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
    cursor: default;
    pointer-events: none;
}

.webhook-delete-btn.deleting {
    opacity: 0.6;
    cursor: wait;
}

.webhook-delete-btn svg {
    width: 12px;
    height: 12px;
}

/* ═══ Strings ═══ */

.strings-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-input:focus {
    border-color: var(--accent-cyan);
}

.strings-list {
    max-height: 300px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.8;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.strings-list .string-line {
    padding: 1px 0;
    word-break: break-all;
    border-bottom: 1px solid var(--border-subtle);
}

.strings-list .string-line:last-child {
    border-bottom: none;
}

.strings-list .string-line.suspicious {
    color: var(--accent-orange);
}

.strings-list .string-line.webhook {
    color: #5865F2;
}

/* ═══ New Scan Button ═══ */

.new-scan-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 24px auto 0;
    padding: 12px 28px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s;
    text-transform: uppercase;
    width: 100%;
    justify-content: center;
}

.new-scan-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    box-shadow: var(--shadow-glow-cyan);
}

.new-scan-btn svg {
    width: 16px;
    height: 16px;
}

/* ═══ Toast Notifications ═══ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    border: 1px solid var(--border-dim);
    box-shadow: var(--shadow-elevated);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.2s forwards;
    max-width: 360px;
}

.toast.success {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.toast.error {
    background: rgba(255, 51, 85, 0.1);
    border-color: rgba(255, 51, 85, 0.2);
    color: var(--accent-red);
}

.toast.info {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.2);
    color: var(--accent-cyan);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-8px); }
}

/* ═══ Scrollbar ═══ */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ═══ Upload Hint ═══ */

.upload-hint {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-faint);
    letter-spacing: 1px;
    margin-top: 4px;
}

/* ═══ JAR Structure ═══ */

.jar-icon {
    color: var(--accent-orange) !important;
}

.jar-file-count {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
}

.jar-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.jar-meta-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.jar-meta-tag span {
    color: var(--text-muted);
    margin-right: 4px;
}

.jar-tree {
    max-height: 350px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    line-height: 1.7;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.jar-tree-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.jar-tree-entry:last-child {
    border-bottom: none;
}

.jar-tree-entry .jar-entry-icon {
    font-size: 0.7rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.jar-tree-entry .jar-entry-name {
    flex: 1;
    min-width: 0;
    word-break: break-all;
}

.jar-tree-entry .jar-entry-size {
    color: var(--text-muted);
    font-size: 0.6rem;
    flex-shrink: 0;
}

.jar-tree-entry.suspicious-entry {
    color: var(--accent-orange);
}

.jar-tree-entry.class-entry {
    color: var(--text-primary);
}

.jar-tree-entry.resource-entry {
    color: var(--text-muted);
}

/* ═══ Utilities ═══ */

.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ Responsive ═══ */

@media (max-width: 640px) {
    .app-container {
        padding: 16px 14px 60px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .upload-zone {
        padding: 40px 20px;
    }

    .file-meta-grid {
        grid-template-columns: 1fr;
    }

    .webhook-item {
        flex-direction: column;
        align-items: stretch;
    }

    .webhook-delete-btn {
        width: 100%;
        justify-content: center;
    }

    .threat-gauge-container {
        flex-wrap: wrap;
    }
}
