:root {
    --bg-color: #FFF8E7; 
    --primary: #8E44AD;   
    --primary-dark: #6C3483; 
    --secondary: #FFC107; 
    --secondary-dark: #F39C12;
    --success: #2ECC71;   
    --success-dark: #27AE60;
    --danger: #E74C3C;    
    --danger-dark: #C0392B;
    --text-main: #2C3E50;
    --radius-xl: 25px;
    --radius-md: 15px;
    --nav-height: 70px;
}

* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

body { 
    font-family: 'Fredoka', sans-serif; 
    background-color: var(--bg-color);
    background-image: radial-gradient(#F5E6CC 2px, transparent 2px); 
    background-size: 20px 20px;
    margin: 0; padding: 0; color: var(--text-main);
    overflow-x: hidden;
    padding-bottom: var(--nav-height); /* Space for bottom nav */
}

/* --- UTILITIES --- */
.hidden { display: none !important; }
.flex { display: flex; }
.wrap { flex-wrap: wrap; }
.gap-10 { gap: 10px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success-dark); }
.text-danger { color: var(--danger); }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mb-2 { margin-bottom: 10px; }
.relative { position: relative; }
.label-bold { font-weight: 700; display: block; }

/* --- ANIMATIONS (SLIDE LEFT/RIGHT) --- */
.slide-in-right {
    animation: slideRight 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.slide-in-left {
    animation: slideLeft 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes slideRight {
    0% { transform: translateX(20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes slideLeft {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* --- BUTTONS --- */
button {
    cursor: pointer; border: none; font-weight: 600; color: white; 
    transition: all 0.1s; border-radius: var(--radius-md);
    font-family: 'Fredoka', sans-serif; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-3d { box-shadow: 0px 5px 0px 0px rgba(0,0,0,0.2); margin-bottom: 5px; }
button:active { transform: translateY(4px); box-shadow: 0px 1px 0px 0px rgba(0,0,0,0.2) !important; margin-bottom: 1px; }

.btn-primary { background: var(--primary); box-shadow: 0px 5px 0px var(--primary-dark); }
.btn-success { background: var(--success); box-shadow: 0px 5px 0px var(--success-dark); }
.btn-danger { background: var(--danger); box-shadow: 0px 5px 0px var(--danger-dark); }
.btn-warning { background: var(--secondary); color: #5d4037; font-weight: 700; box-shadow: 0px 5px 0px var(--secondary-dark); }
.btn-outline { background: white; border: 2px solid #ddd; color: #777; box-shadow: 0px 4px 0px #ccc; }
.btn-sm { padding: 8px 12px; font-size: 12px; }
.btn-lg { padding: 18px; font-size: 16px; }

.btn-primary:active { box-shadow: 0px 1px 0px var(--primary-dark); }
.btn-success:active { box-shadow: 0px 1px 0px var(--success-dark); }
.btn-danger:active { box-shadow: 0px 1px 0px var(--danger-dark); }
.btn-warning:active { box-shadow: 0px 1px 0px var(--secondary-dark); }
.btn-outline:active { box-shadow: 0px 1px 0px #ccc; }
button:disabled { background-color: #E0E0E0 !important; color: #999 !important; box-shadow: none !important; transform: none !important; cursor: not-allowed; }

/* --- FORMS --- */
select, input, textarea {
    width: 100%; padding: 15px; margin: 10px 0; border-radius: var(--radius-md);
    border: 2px solid #EEE; background: #FAFAFA; font-size: 16px;
    font-family: 'Fredoka', sans-serif; color: #555;
    box-shadow: inset 0px 3px 6px rgba(0,0,0,0.05);
}
select:focus, input:focus { border-color: var(--primary); outline: none; background: white; }

/* --- LOGIN SCREEN --- */
#login-screen { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-box {
    background: white; padding: 40px 30px; border-radius: var(--radius-xl); 
    width: 90%; max-width: 400px; text-align: center;
    box-shadow: 0px 10px 0px rgba(0,0,0,0.1), 0px 20px 40px rgba(0,0,0,0.2);
}
.login-logo { font-size: 50px; color: var(--secondary); margin-bottom: 10px; text-shadow: 2px 4px 0 rgba(0,0,0,0.1); }
.form-group { text-align: left; margin-bottom: 15px; }
.form-group label { font-size:14px; font-weight:700; color:#888; margin-left:5px; }
.toggle-pass { position:absolute; right:15px; top:42px; font-size:12px; color:var(--primary); cursor:pointer; font-weight:700; }

/* --- APP LAYOUT --- */
.app-header {
    background: var(--primary); padding: 15px 20px; position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom-left-radius: 20px; border-bottom-right-radius: 20px;
    box-shadow: 0px 5px 20px rgba(142, 68, 173, 0.4);
}
.brand { font-size: 20px; font-weight: 700; color: white; }
#user-display { font-weight:normal; font-size:12px; opacity: 0.8; margin-left: 5px; }

.main-content { padding: 20px; max-width: 800px; margin: 0 auto; min-height: calc(100vh - 80px); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.section-header h3 { margin: 0; font-size: 22px; color: var(--primary); font-weight: 800; }

/* --- BOTTOM NAVIGATION --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height);
    background: var(--primary);
    display: flex; justify-content: space-around; align-items: center;
    box-shadow: 0px -5px 20px rgba(0,0,0,0.1); z-index: 900;
    border-top-left-radius: 25px; border-top-right-radius: 25px;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    text-decoration: none; color: rgba(255,255,255,0.5);
    text-align: center; font-size: 11px;
    font-weight: 600; flex: 1; display: flex; flex-direction: column; align-items: center;
    transition: 0.3s;
}
.nav-item i { font-size: 22px; margin-bottom: 4px; transition: 0.2s; }
.nav-item.active { color: white; }
.nav-item.active i { transform: translateY(-3px); text-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* --- CAR CARDS --- */
#cars-container { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 15px; }
.car-card {
    background: white; border-radius: var(--radius-xl); padding: 15px; 
    width: calc(50% - 8px); box-sizing: border-box; position: relative;
    border: 2px solid transparent; box-shadow: 0px 8px 0px #E0E0E0, 0px 8px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s; margin-bottom: 10px;
}
.car-card:hover { transform: translateY(-2px); }
.car-card.standby-card { border: 2px solid #90CAF9; box-shadow: 0px 6px 0px #64B5F6; }
.car-card.active-session.is-paid:not(.is-paused) { background: #E8F5E9; border: 2px solid var(--success); box-shadow: 0px 6px 0px var(--success-dark); }
.car-card.active-session.is-unpaid:not(.is-paused) { background: #FFF8E1; border: 2px solid var(--secondary); box-shadow: 0px 6px 0px var(--secondary-dark); }
.car-card.active-session.is-paused { background: #FCE4EC; border: 2px solid #F06292; box-shadow: 0px 6px 0px #C2185B; }
.car-card.ended { background: #FFEBEE; border: 2px solid var(--danger); box-shadow: 0px 6px 0px var(--danger-dark); animation: shake 0.5s infinite; }

.paused-badge {
    background: #F06292; color: white; padding: 5px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 800; text-align: center; margin: 5px 0;
    animation: pulse 1s infinite; letter-spacing: 1px;
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }
@keyframes shake { 0% { transform: rotate(0deg); } 25% { transform: rotate(1deg); } 75% { transform: rotate(-1deg); } 100% { transform: rotate(0deg); } }

.car-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; border-bottom: 2px dashed rgba(0,0,0,0.1); padding-bottom: 5px; }
.car-number { font-size: 26px !important; font-weight: 900 !important; color: #2C3E50; letter-spacing: -1px; text-shadow: 1px 1px 0px rgba(0,0,0,0.1); }
.timer-display { font-size: 28px; font-weight: 800; color: #333; text-align: center; margin: 10px 0; background: rgba(255,255,255,0.5); border-radius: 10px; padding: 5px; } 
.control-row { display: flex; gap: 8px; margin-top: 8px; }
.control-row button { padding: 8px; font-size: 12px; margin: 0; flex: 1; border-radius: 10px; } 
.info-row { font-size: 11px; font-weight: 500; color: #777; display: flex; justify-content: space-between; margin-top: 8px; border-top: 2px dashed rgba(0,0,0,0.1); padding-top: 5px; } 
.car-menu-dropdown {
    position: absolute; top: 35px; right: 10px; background: white;
    border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 50; 
    min-width: 130px; overflow: hidden; border: 2px solid #eee;
}
.car-menu-dropdown div { padding: 10px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #eee; font-weight: 600; }

/* --- QUEUE & INFO --- */
.info-banner { background: #E3F2FD; color: #1565C0; padding: 15px; border-radius: 12px; font-size: 13px; margin-bottom: 20px; border: 1px solid #BBDEFB; }
.queue-item { 
    background: white; padding: 15px; border-radius: var(--radius-md); margin-bottom: 12px; 
    display: flex; justify-content: space-between; align-items: center; 
    box-shadow: 0 4px 0 #eee; border: 2px solid #f4f4f4;
} 
.queue-item button { padding: 6px 10px; font-size: 11px; margin-left: 5px; width: auto; border-radius: 8px; box-shadow: none; border-bottom: 3px solid rgba(0,0,0,0.1); }
.queue-item button:active { transform: translateY(2px); border-bottom: 1px solid; }

/* --- REPORT & HISTORY TABLE (FIXED) --- */
.filter-box { margin-bottom: 20px; background:white; padding:15px; border-radius:15px; box-shadow:0 4px 0 #eee; }
.summary-card { background: white; padding: 20px; border-radius: 20px; margin-bottom: 20px; box-shadow: 0 5px 0 #e0e0e0; border: 2px solid #f5f5f5; color: var(--text-main); }
.summary-card b { font-size: 24px; color: var(--primary); }

.report-table { width: 100%; border-collapse: separate; border-spacing: 0 5px; margin-top: 10px; font-size: 13px; }
.report-table th { background: #eee; padding: 10px; text-align: left; color: #555; font-weight: 700; }
.report-table td { background: white; padding: 12px; border: 1px solid #f0f0f0; }

.btn-detail { background: none; border: none; color: var(--primary); font-weight: bold; cursor: pointer; text-decoration: underline; font-size: 12px; box-shadow: none; }
.detail-row { display: none; animation: slideDown 0.3s ease-out; }
.detail-row.show { display: table-row; }
.detail-content { background: #F9F9F9; padding: 10px; border-radius: 10px; border: 1px dashed #ccc; margin: 5px 0 15px 0; overflow-x: auto; }

/* TABEL SUB (DETAIL) YANG DIPERBAIKI (RESPONSIVE) */
.sub-table { 
    width: 100%; 
    font-size: 11px; 
    border-collapse: collapse; 
    table-layout: fixed; /* Mencegah kolom melebar */
}
.sub-table th { background: #e0e0e0; padding: 6px 4px; color: #333; text-align: center; white-space: nowrap; }
.sub-table td { 
    background: transparent; 
    border-bottom: 1px solid #ddd; 
    padding: 6px 4px; 
    text-align: center; 
    vertical-align: middle;
    word-wrap: break-word; 
}
/* Lebar Kolom */
.col-unit { width: 35px; }
.col-dur { width: 45px; }
.col-time { width: 65px; }
.col-price { width: 55px; }
.col-cashier { width: 45px; }
.col-action { width: 35px; }

/* Hide Trash Button for Non-Admin in History */
.user-view-mode .btn-delete-history { display: none !important; }

/* --- ADMIN PANEL & PROFILE --- */
.admin-panel-grid { display: flex; flex-direction: column; gap: 20px; }
.admin-card { background: white; padding: 20px; border-radius: var(--radius-xl); box-shadow: 0 5px 0 #eee; }
.card-title { font-size: 18px; font-weight: 700; color: var(--text-main); margin-bottom: 15px; border-bottom: 2px dashed #eee; padding-bottom: 10px; }
.role-badge { display: inline-block; padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; margin-left: 5px; }
.role-badge.admin { background: #e3f2fd; color: #1976d2; }
.role-badge.staff { background: #fce4ec; color: #d81b60; }
.price-input-group { margin-bottom: 15px; }
.price-input-group label { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.price-input-group input { margin: 0; padding: 10px; }

/* --- ADMIN NAVIGATION (BARU) --- */
.admin-sub-nav {
    display: flex;
    background: white;
    padding: 5px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 0 #eee;
    justify-content: space-between;
}
.sub-nav-btn {
    flex: 1;
    background: transparent;
    color: #777;
    padding: 10px 5px;
    font-size: 12px;
    border-radius: 10px;
    box-shadow: none;
    margin: 0 2px;
    border: 2px solid transparent;
}
.sub-nav-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 0 var(--primary-dark);
    font-weight: 700;
}
.admin-sub-view { display: none; }
.admin-sub-view.active { display: block; animation: slideDown 0.3s ease; }

/* --- MODALS --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(44, 62, 80, 0.7); display: flex; justify-content: center; align-items: flex-end; 
    z-index: 1001; backdrop-filter: blur(2px);
}
.modal-content {
    background: #FFF; width: 100%; max-width: 500px; border-radius: 30px 30px 0 0;
    padding: 30px; box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-bottom: 40px;
}
.pay-btn, .dur-btn { padding: 15px; flex: 1; font-size: 14px; text-align: center; border-radius: 12px; }
.modal-btn-group { display: flex; gap: 15px; margin-top: 25px; }
.modal-btn-group button { flex: 1; padding: 15px; font-size: 16px; border-radius: 15px; }
.alert-icon { font-size:40px; color:var(--secondary); margin-bottom:10px; }
.confirm-msg { font-size:16px; line-height:1.5; color:#555; margin-bottom:20px; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Tambahan untuk profil modern */
.profile-card {
    transition: box-shadow 0.2s;
}
.profile-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
}


