/* ══════════════════════════════════════════════════════
   Uji Deteksi — Premium Testing Page CSS
   ══════════════════════════════════════════════════════ */

/* ── Page Layout ── */
.test-body {
    background: var(--bg);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ── Navigation ── */
.test-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.test-nav .nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    transition: opacity 0.2s;
}
.test-nav .nav-back:active { opacity: 0.6; }
.test-nav .nav-back-icon { font-size: 1.1rem; }
.test-nav .nav-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* ── Tab Switcher ── */
.tab-switcher {
    display: flex;
    gap: 0;
    margin: 20px 20px 0;
    background: var(--bg3);
    border-radius: 14px;
    padding: 4px;
    border: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tab-btn.active {
    background: var(--bg2);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}
.tab-btn:not(.active):hover {
    color: var(--text);
}
.tab-icon { font-size: 1.1rem; }

/* ── Tab Content ── */
.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Drop Zone ── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg2);
    position: relative;
    overflow: hidden;
}
.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03), rgba(2, 132, 199, 0.03));
    opacity: 0;
    transition: opacity 0.3s;
}
.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}
.drop-zone.drag-over {
    border-color: var(--primary);
    border-style: solid;
    transform: scale(1.01);
}
.drop-zone.has-file {
    border-color: var(--success);
    border-style: solid;
}
.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
    transition: transform 0.3s;
}
.drop-zone.drag-over .drop-zone-icon {
    transform: scale(1.15) translateY(-4px);
}
.drop-zone-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.drop-zone-sub {
    font-size: 0.8rem;
    color: var(--text2);
    margin-bottom: 16px;
}
.drop-zone-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}
.drop-zone-btn:active {
    transform: scale(0.97);
}
.drop-zone input[type="file"] {
    display: none;
}

/* ── Preview Section ── */
.preview-section {
    display: none;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}
.preview-section.visible {
    display: block;
}
.preview-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.preview-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-file-info {
    font-size: 0.72rem;
    color: var(--text2);
    font-family: var(--mono);
}
.preview-media {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #000;
    display: block;
}
.preview-actions {
    display: flex;
    gap: 10px;
    padding: 16px 18px;
}
.btn-detect {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-detect:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-detect:not(:disabled):active {
    transform: scale(0.98);
}
.btn-clear {
    padding: 14px 20px;
    background: var(--bg3);
    color: var(--text2);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-clear:active {
    background: var(--border);
}

/* ── Processing State ── */
.processing-overlay {
    display: none;
    padding: 40px 20px;
    text-align: center;
}
.processing-overlay.visible {
    display: block;
}
.processing-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.processing-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.processing-sub {
    font-size: 0.8rem;
    color: var(--text2);
}

/* ── Progress Bar (Video) ── */
.progress-wrapper {
    display: none;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}
.progress-wrapper.visible {
    display: block;
}
.progress-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.progress-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.progress-percent {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}
.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg3);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    border-radius: 8px;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-detail {
    font-size: 0.72rem;
    color: var(--text2);
    font-family: var(--mono);
}

/* ── Result Section ── */
.result-section {
    display: none;
    margin-top: 20px;
    animation: fadeIn 0.4s ease;
}
.result-section.visible {
    display: block;
}

/* Result Summary Cards */
.result-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
@media (max-width: 480px) {
    .result-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}
.summary-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    transition: transform 0.2s;
}
.summary-card:hover {
    transform: translateY(-2px);
}
.summary-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.summary-num.danger { color: var(--danger); }
.summary-num.warn { color: var(--warn); }
.summary-num.success { color: var(--success); }
.summary-num.primary { color: var(--primary); }
.summary-label {
    font-size: 0.65rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

/* Result Image */
.result-image-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}
.result-image-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.result-image-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--mono);
}
.result-badge.green { background: #DCFCE7; color: var(--success); }
.result-badge.blue { background: #DBEAFE; color: var(--primary); }
.result-image-wrapper {
    width: 100%;
    background: #000;
    position: relative;
}
.result-image-wrapper img,
.result-image-wrapper video {
    width: 100%;
    display: block;
    max-height: 500px;
    object-fit: contain;
}

/* ── Detection Table ── */
.detection-table-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}
.detection-table-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.detection-table-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.detection-table-wrap {
    overflow-x: auto;
    max-height: 360px;
    overflow-y: auto;
}
.det-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    white-space: nowrap;
}
.det-table th {
    background: var(--bg3);
    color: var(--text2);
    font-weight: 600;
    font-size: 0.65rem;
    padding: 10px 14px;
    text-align: left;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.3px;
}
.det-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.det-table tr:hover {
    background: var(--bg3);
}

/* ── No Detection State ── */
.no-detection {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.no-detection-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.no-detection h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.no-detection p {
    font-size: 0.82rem;
    color: var(--text2);
}

/* ── Download Button ── */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-download:active {
    background: var(--border);
}

/* ── Severity Dot in table ── */
.sev-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.sev-dot.high { background: var(--danger); }
.sev-dot.medium { background: var(--warn); }
.sev-dot.low { background: var(--success); }

/* ── Confidence Slider ── */
.confidence-control {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}
.confidence-control label {
    font-size: 0.8rem;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}
.confidence-control label strong {
    color: var(--primary);
    font-family: var(--mono);
}
.confidence-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 6px;
    background: var(--bg3);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}
.confidence-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.conf-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.62rem;
    color: var(--text2);
}

/* ── Misc spacing ── */
.test-footer {
    padding: 24px 20px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text2);
}
