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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(7, 13, 41, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.modal-box {
    background: #0d1b3e;
    border: 1px solid rgba(255, 180, 0, 0.4);
    border-radius: 12px;
    padding: 36px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 180, 0, 0.1);
}

.modal-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd866;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modal-msg {
    font-size: 0.9rem;
    color: #b0bcd4;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-close-btn {
    background: #ffd866;
    color: #0a0f1e;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: #ffe899;
}

html {
    min-height: 100%;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #090d22 0%, #070d29 50%, #0d4a7d 200%);
    background-attachment: fixed;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 20px 60px;
    position: relative;
    overflow-x: hidden;
}

.container {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 1200px;
}

.header-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
}

.logo-link:hover { opacity: 0.8; }

.header-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.main-title {
    font-size: 56px;
    font-weight: 300;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff 0%, #1976d2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0;
}

.subtitle {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 40px;
    color: #b0bec5;
    font-weight: 300;
    text-align: center;
}

.scanner-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 28px;
    align-items: start;
}

.panel-card {
    background: rgba(122, 143, 160, 0.12);
    border: 1px solid rgba(122, 143, 160, 0.28);
    border-radius: 32px;
    padding: 36px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.upload-panel { position: sticky; top: 30px; }

.form-section { margin-bottom: 28px; }

.section-label {
    display: block;
    font-size: 11px;
    letter-spacing: 2.5px;
    margin-bottom: 14px;
    color: #ffffff;
    text-transform: uppercase;
    font-weight: 700;
}

.upload-box {
    position: relative;
    width: 100%;
    min-height: 200px;
    background: rgba(55, 71, 79, 0.55);
    border: 2px dashed rgba(122, 143, 160, 0.4);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
}

.upload-box:not(.has-preview) {
    aspect-ratio: 4/3;
}

.upload-box.has-preview {
    height: auto;
    background: transparent;
    border-style: solid;
    padding: 0;
}

.upload-box:hover,
.upload-box.drag-over {
    border-color: rgba(100, 181, 246, 0.65);
    background: rgba(55, 71, 79, 0.8);
    box-shadow: 0 0 22px rgba(100, 181, 246, 0.12);
}

#imageUpload {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    text-align: center;
    pointer-events: none;
    padding: 20px;
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 12px;
    color: #7a8fa0;
}

.upload-text {
    font-size: 14px;
    color: #b0bec5;
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 11px;
    color: #546e7a;
    letter-spacing: 1px;
}

.image-preview {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 20px;
    display: block;
    pointer-events: none;
}

.hidden { display: none !important; }

.model-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.model-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
    background: rgba(55, 71, 79, 0.8);
    border: 2px solid rgba(122, 143, 160, 0.4);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.model-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #90a4ae;
    border-radius: 50%;
    transition: all 0.3s;
}

.model-toggle input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #64b5f6 0%, #1976d2 100%);
    border-color: rgba(100, 181, 246, 0.7);
}

.model-toggle input[type="checkbox"]:checked::before {
    left: 22px;
    background: #ffffff;
}

.model-toggle-box {
    display: flex;
    flex-direction: column;
}

.model-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #e0e0e0;
}

.model-desc {
    font-size: 11px;
    color: #78909c;
    margin-top: 2px;
}

.scan-button {
    width: 100%;
    padding: 17px 32px;
    background: linear-gradient(135deg, #64b5f6 0%, #1976d2 100%);
    border: none;
    border-radius: 22px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(100, 181, 246, 0.3);
}

.scan-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #90caf9 0%, #1976d2 100%);
    box-shadow: 0 6px 22px rgba(100, 181, 246, 0.55);
    transform: translateY(-2px);
}

.scan-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.results-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.results-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2.5px;
    color: #64b5f6;
}

.results-status {
    font-size: 12px;
    color: #546e7a;
    letter-spacing: 1px;
}

.results-cards {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.result-card {
    background: rgba(122, 143, 160, 0.10);
    border: 1px solid rgba(122, 143, 160, 0.25);
    border-radius: 24px;
    padding: 28px 30px;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s;
}

.result-card.scanning {
    border-color: rgba(100, 181, 246, 0.5);
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.07);
}

.result-card.done-safe {
    border-color: rgba(102, 187, 106, 0.55);
}

.result-card.done-flagged {
    border-color: rgba(239, 83, 80, 0.55);
}

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

.result-model-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-gemini {
    background: rgba(175, 69, 163, 0.18);
    color: #f86bf8;
    border: 1px solid rgba(245, 66, 212, 0.4);
}

.badge-sightengine {
    background: rgba(0, 180, 120, 0.18);
    color: #26c99e;
    border: 1px solid rgba(0, 180, 120, 0.4);
}

.badge-hf {
    background: rgba(255, 167, 38, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 167, 38, 0.35);
}

.result-model-sub {
    font-size: 11px;
    color: #546e7a;
    letter-spacing: 0.5px;
    flex: 1;
}

.result-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(100, 100, 100, 0.4);
    transition: all 0.3s;
    flex-shrink: 0;
}

.result-status-dot.pulsing {
    background: #64b5f6;
    box-shadow: 0 0 8px #64b5f6;
    animation: pulse 1.2s infinite;
}

.result-status-dot.safe {
    background: #66bb6a;
    box-shadow: 0 0 8px rgba(102, 187, 106, 0.6);
}

.result-status-dot.flagged {
    background: #ef5350;
    box-shadow: 0 0 8px rgba(239, 83, 80, 0.6);
}

.result-status-dot.error {
    background: #ffa726;
    box-shadow: 0 0 8px rgba(255, 167, 38, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.result-verdict {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

.result-verdict.verdict-safe {
    background: rgba(102, 187, 106, 0.12);
    border: 1px solid rgba(102, 187, 106, 0.35);
    color: #81c784;
}

.result-verdict.verdict-flagged {
    background: rgba(239, 83, 80, 0.12);
    border: 1px solid rgba(239, 83, 80, 0.35);
    color: #ef9a9a;
}

.result-verdict.verdict-uncertain {
    background: rgba(255, 167, 38, 0.10);
    border: 1px solid rgba(255, 167, 38, 0.3);
    color: #ffb74d;
}

.result-placeholder {
    font-size: 13px;
    color: #37474f;
    font-style: italic;
}

.result-text {
    font-size: 13px;
    line-height: 1.9;
    color: #b0bec5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.hf-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hf-score-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hf-score-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 600;
}

.hf-score-name { color: #cfd8dc; }
.hf-score-val  { color: #64b5f6; }

.hf-score-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(55, 71, 79, 0.8);
    border-radius: 3px;
    overflow: hidden;
}

.hf-score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.7s ease;
}

.hf-score-bar-fill.fill-ai   { background: linear-gradient(90deg, #ef5350, #ff7043); }
.hf-score-bar-fill.fill-real { background: linear-gradient(90deg, #66bb6a, #43a047); }

.spinner-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(100, 181, 246, 0.2);
    border-top-color: #64b5f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.spinner-label {
    font-size: 13px;
    color: #78909c;
    letter-spacing: 1px;
}

@media (max-width: 860px) {
    .scanner-layout {
        grid-template-columns: 1fr;
    }

    .upload-panel {
        position: static;
    }

    .main-title {
        font-size: 40px;
    }
}

@media (max-width: 500px) {
    .panel-card   { padding: 22px 18px; }
    .result-card  { padding: 20px 18px; }
}
