/* =========================================
   1. VARIABEL & TEMA (PONDASI)
   ========================================= */
:root {
    /* Default: Dark Mode */
    --primary: #6366f1;
    --accent: #8b5cf6;
    --bg-body: radial-gradient(circle at top left, #1e293b, #0f172a);
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --safe: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(0, 0, 0, 0.3);
    --skeleton-bg: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-body: #f0f2f5; /* Abu-abu sangat muda agar kartu putih menonjol */
    --card-bg: #ffffff;
    --text-main: #1e293b; /* Teks utama gelap */
    --text-muted: #475569; /* Teks sekunder lebih gelap agar terbaca jelas */
    --glass: rgba(255, 255, 255, 0.95);
    --input-bg: #f8fafc;
    --skeleton-bg: #e2e8f0;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* =========================================
   2. GLOBAL STYLES
   ========================================= */
body {
    background: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    transition: background 0.4s ease, color 0.4s ease;
}

.main-container { 
    width: 100%; 
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    transition: background 0.4s ease, border 0.4s ease;
}

.accent { color: var(--accent); font-weight: 800; }

/* =========================================
   3. HEADER & TYPOGRAPHY
   ========================================= */
h1 { margin-top: 0; font-size: 2.2rem; text-align: center; }
.subtitle { color: var(--text-muted); margin-bottom: 2rem; text-align: center; }
.header-icon { font-size: 3rem; color: var(--accent); margin-bottom: 1rem; text-align: center; }
.text-muted { color: var(--text-muted) !important; }

/* =========================================
   4. INPUT & TOMBOL
   ========================================= */
.input-group {
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.2rem;
    transition: 0.3s;
}

.input-group:focus-within { 
    border-color: var(--primary); 
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3); 
}

input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    margin-left: 10px;
    outline: none;
    font-size: 1rem;
}

.error-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
}

[data-theme="light"] .error-alert {
    color: #b91c1c; /* Lebih gelap sedikit untuk mode light agar terbaca */
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}

.btn-primary:hover { 
    transform: translateY(-3px); 
    filter: brightness(1.1);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-primary:active { transform: scale(0.95); }

/* =========================================
   5. RESULT & SHAP CHART
   ========================================= */
.hidden { display: none !important; }

.url-display {
    background: var(--input-bg);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.status-box {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-radius: 15px;
}

.status-box.phishing, .status-box.danger { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); color: #ff8080; }
.status-box.aman, .status-box.success, .status-box.legitimate { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--safe); color: #10b981; }
[data-theme="light"] .status-box.aman { color: #065f46; } /* Gelapkan dikit di light mode */

.status-box.warning { 
    background: rgba(245, 158, 11, 0.15); 
    border: 1px solid var(--warning); 
    color: #ffd18a; 
}

[data-theme="light"] .status-box.warning {
    color: #92400e; /* Cokelat tua untuk teks di mode terang */
}

.status-icon { font-size: 2.2rem; }
.label-status { display: block; font-weight: 800; font-size: 1.3rem; letter-spacing: 1px; }

/* SHAP Chart */
.shap-item { margin-bottom: 1.2rem; }
.shap-info { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 8px; }
.feature-label { font-weight: 600; color: var(--text-main); }

.shap-chart-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
    letter-spacing: 0.5px;
}
.shap-chart-header .label-left {
    color: var(--safe);
    display: flex;
    align-items: center;
    gap: 6px;
}
.shap-chart-header .label-right {
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 6px;
}

.shap-bar-track {
    height: 10px;
    background: var(--skeleton-bg);
    position: relative;
    border-radius: 5px;
}

.center-line {
    position: absolute;
    left: 50%;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background-color: rgba(255, 255, 255, 0.4);
    z-index: 5;
    transform: translateX(-50%);
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .center-line {
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

.bar-fill { position: absolute; height: 100%; border-radius: 5px; transition: width 1s ease-out; }
.bar-fill.pos { background: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.bar-fill.neg { background: var(--safe); box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }

/* =========================================
   6. SKELETON LOADING
   ========================================= */
.skeleton-card {
    overflow: hidden;
    position: relative;
}

.skeleton-line {
    background: var(--skeleton-bg);
    margin-bottom: 1rem;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-line.header { height: 30px; width: 60%; }
.skeleton-line.status { height: 60px; width: 100%; }
.skeleton-line.bar { height: 15px; width: 100%; }

/* =========================================
   7. GRID EDUKASI
   ========================================= */
.education-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
}

.edu-card {
    text-align: center;
    padding: 2rem 1.5rem;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.edu-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.edu-card i { font-size: 2.5rem; color: var(--accent); margin-bottom: 1rem; }
.edu-card h4 { margin-bottom: 10px; font-size: 1.2rem; }
.edu-card p { font-size: 0.95rem; line-height: 1.6; }

/* =========================================
   8. THEME TOGGLE SWITCH
   ========================================= */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 1rem;
    gap: 10px;
}

#theme-text { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input { display:none; }

.slider {
    background-color: #ccc;
    bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0;
    transition: .4s; border-radius: 34px;
    display: flex; align-items: center; justify-content: space-around; padding: 0 5px;
}

.slider i { color: white; font-size: 12px; }

.slider:before {
    background-color: white;
    bottom: 4px; content: ""; height: 26px; left: 4px; position: absolute;
    transition: .4s; width: 26px; border-radius: 50%; z-index: 2;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(26px); }

/* =========================================
   9. FOOTER & ANIMATIONS
   ========================================= */
.footer {
    text-align: center;
    padding: 2.5rem 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeInUp 0.8s ease-out; }
.animate-slide-up { animation: fadeInUp 0.6s ease-out; }

/* =========================================
   10. RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .education-grid { grid-template-columns: 1fr; }
    .glass { padding: 1.5rem; }
    h1 { font-size: 1.8rem; }
    .status-box { flex-direction: column; text-align: center; gap: 1rem; }
}