/* --- Root Variables & Reset --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gray-100: #f3f4f6;
    --gray-400: #9ca3af;
    --white: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* --- Floating Navbar --- */
.navbar {
    position: fixed;
    top: 25px;
    z-index: 1000;
}

.nav-box {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px;
    border-radius: 50px;
    display: flex;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.nav-link {
    text-decoration: none;
    color: white;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.nav-link.active {
    background: var(--white);
    color: var(--primary);
}

/* --- Main Card --- */
.card {
    background: var(--white);
    width: 100%;
    max-width: 450px;
    padding: 35px;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin-top: 60px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-area {
    border: 2px dashed var(--gray-400);
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-control {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--gray-100);
    border-radius: 12px;
    margin-top: 10px;
}

button {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
}

/* --- Modal Riwayat --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 2000; /* Harus diatas navbar */
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-clear {
    background: #fee2e2;
    color: var(--danger);
    margin-top: 15px;
}

.preview {
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.preview img {
    width: 100%;
    max-width: 300px; /* Batas lebar maksimal */
    height: auto;
    aspect-ratio: 16 / 9; /* Memaksa perbandingan foto tetap sama */
    object-fit: cover; /* Memotong bagian tepi agar mengisi area kotak */
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px solid var(--gray-100);
}

.hidden { display: none !important; }