/* ============================================
   DeepShield App Styles
   Design system matches landing page
   ============================================ */

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

:root {
    --bg-deep: #06080d;
    --bg-card: #0c1017;
    --bg-elevated: #111822;
    --bg-input: #0a0e14;
    --accent: #00d4aa;
    --accent-dim: #00d4aa22;
    --accent-glow: #00d4aa44;
    --accent-bright: #00ffcc;
    --text-primary: #e8ecf1;
    --text-secondary: #8a95a5;
    --text-muted: #5a6577;
    --border: #1a2233;
    --border-hover: #253045;
    --danger: #ff4757;
    --danger-dim: #ff475722;
    --warning: #ffa502;
    --warning-dim: #ffa50222;
    --success: #00d4aa;
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.grid-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

/* ---- NAV ---- */
nav {
    position: relative;
    z-index: 10;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #0088ff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.nav-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent-glow);
    padding: 8px 18px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
}
.nav-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

/* ---- LAYOUT ---- */
main { position: relative; z-index: 1; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

.view { display: none; }
.view.active { display: block; }

/* ---- TYPOGRAPHY ---- */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 16px;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
}

.highlight {
    background: linear-gradient(135deg, var(--accent), #0088ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 520px;
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

.required { color: var(--danger); }

/* ---- UPLOAD VIEW ---- */
.view-header {
    text-align: center;
    padding: 60px 0 40px;
}

.view-header .subtitle {
    margin: 0 auto;
}

.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

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

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ---- DROPZONE ---- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    margin-bottom: 20px;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.dropzone.dragover .dropzone-icon {
    color: var(--accent);
}

.dropzone-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.accent-link {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- PREVIEW GRID ---- */
.preview-grid {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-remove:hover {
    background: var(--danger);
}

/* ---- BUTTONS ---- */
.btn-primary {
    width: 100%;
    padding: 16px 24px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-deep);
    background: linear-gradient(135deg, var(--accent), #0088ff);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

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

.btn-large { padding: 18px 24px; font-size: 1.05rem; }

.btn-secondary {
    padding: 10px 20px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    background: var(--bg-card);
}

.btn-danger-outline {
    padding: 10px 18px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
    background: var(--danger-dim);
    border: 1px solid #ff475744;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-danger-outline:hover {
    background: #ff475733;
    border-color: var(--danger);
}

.form-disclaimer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ---- SCANNING VIEW ---- */
.scanning-container {
    text-align: center;
    padding: 100px 24px;
}

.scan-visual {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 40px;
}

.scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: scan-pulse 3s ease-out infinite;
}

.ring-1 { width: 80px; height: 80px; margin: -40px 0 0 -40px; animation-delay: 0s; }
.ring-2 { width: 120px; height: 120px; margin: -60px 0 0 -60px; animation-delay: 1s; }
.ring-3 { width: 160px; height: 160px; margin: -80px 0 0 -80px; animation-delay: 2s; }

@keyframes scan-pulse {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.scan-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: shield-glow 2s ease-in-out infinite alternate;
}

@keyframes shield-glow {
    from { filter: drop-shadow(0 0 8px var(--accent-glow)); }
    to { filter: drop-shadow(0 0 24px var(--accent)); }
}

.scanning-container h2 {
    margin-bottom: 8px;
}

.scanning-container .text-secondary {
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.progress-track {
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    margin: 0 auto 40px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #0088ff);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.scan-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}

.scan-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.scan-step.active { color: var(--accent); }
.scan-step.done { color: var(--text-secondary); }

.scan-step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.scan-step.active .scan-step-icon { animation: spin 1s linear infinite; }

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

/* ---- RESULTS VIEW ---- */
.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 60px 0 32px;
}

.results-header .section-label { margin-bottom: 8px; }

.summary-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
}

.summary-stat {
    background: var(--bg-card);
    padding: 20px;
    text-align: center;
}

.summary-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- RESULT CARDS ---- */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    border-left: 4px solid var(--text-muted);
    transition: border-color 0.2s, transform 0.2s;
}

.result-card:hover {
    transform: translateX(2px);
}

.result-card.threat-critical { border-left-color: var(--danger); }
.result-card.threat-high { border-left-color: #ff6b6b; }
.result-card.threat-medium { border-left-color: var(--warning); }
.result-card.threat-low { border-left-color: var(--success); }

.result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.result-platform {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1rem;
}

.result-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 100px;
}

.badge-critical { background: var(--danger-dim); color: var(--danger); border: 1px solid #ff475744; }
.badge-high { background: #ff6b6b22; color: #ff6b6b; border: 1px solid #ff6b6b44; }
.badge-medium { background: var(--warning-dim); color: var(--warning); border: 1px solid #ffa50244; }
.badge-low { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-glow); }

.confidence-bar {
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.result-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

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

.result-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
    max-width: 60%;
}

.result-content-type {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: 6px;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.result-card .takedown-sent {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.results-footer {
    text-align: center;
    padding: 20px 0 60px;
}

/* ---- MODAL ---- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
}

.modal.open { display: flex; align-items: center; justify-content: center; }

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.modal-body pre {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.7;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn-primary {
    width: auto;
    flex: 1;
}

.modal-footer .btn-secondary {
    flex: 0 0 auto;
}

/* ---- PLAN STATUS BAR ---- */
.plan-bar {
    position: relative;
    z-index: 5;
    border-bottom: 1px solid var(--border);
}

.plan-bar-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-badge {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border-radius: 100px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.plan-badge.badge-basic {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-glow);
}

.plan-badge.badge-pro {
    background: #6c5ce722;
    color: #6c5ce7;
    border-color: #6c5ce744;
}

.plan-badge.badge-premium {
    background: #f39c1222;
    color: #f39c12;
    border-color: #f39c1244;
}

.plan-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.plan-upgrade-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.plan-upgrade-btn:hover {
    color: var(--accent-bright);
}

/* ---- FEATURE GATE OVERLAY ---- */
.feature-gated {
    position: relative;
}

.gate-overlay {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 13, 0.85);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 24px;
    text-align: center;
}

.gate-overlay .gate-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.gate-overlay .gate-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.gate-overlay .gate-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.gate-overlay .gate-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bg-deep);
    background: linear-gradient(135deg, #6c5ce7, #8b5cf6);
    padding: 10px 24px;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.25s;
}

.gate-overlay .gate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px #6c5ce744;
}

/* ---- SUBSCRIPTION SUCCESS TOAST ---- */
.sub-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent);
    color: var(--bg-deep);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 12px;
    z-index: 200;
    box-shadow: 0 8px 32px var(--accent-glow);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.sub-toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    nav { padding: 16px 20px; }

    .view-header { padding: 40px 0 28px; }

    .upload-card { padding: 24px 20px; }

    .scanning-container { padding: 60px 20px; }

    .results-header {
        flex-direction: column;
        padding: 40px 0 24px;
    }

    .summary-bar { grid-template-columns: 1fr; }

    .result-top { flex-direction: column; align-items: flex-start; }

    .result-meta { flex-direction: column; align-items: flex-start; }

    .result-url { max-width: 100%; }

    .modal-content { width: 95%; max-height: 90vh; }

    .modal-header, .modal-body, .modal-footer { padding-left: 20px; padding-right: 20px; }

    .modal-footer { flex-direction: column; }

    .modal-footer .btn-primary,
    .modal-footer .btn-secondary { width: 100%; text-align: center; }
}
