:root {
    --primary: #003366; 
    --accent: #0056b3; 
    --success: #28a745; 
    --danger: #dc3545; 
    --warning: #ffc107; 
    --bg: #f0f4f8; 
    --white: #ffffff; 
    --dark-card: #1e293b;
    --input-bg: #f1f5f9; 
    --text: #1e293b;
}

* { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; 
    padding: 0; 
}

body { 
    background: var(--bg); 
    height: 100vh; 
    overflow: hidden; 
    width: 100%; 
    position: fixed; 
    color: var(--text); 
    transition: background 0.3s, color 0.3s; 
}

body.dark-mode { 
    --bg: #0f172a; 
    --white: #1e293b; 
    --input-bg: #334155; 
    --text: #f1f5f9; 
}

body.dark-mode .card { background: var(--white); color: var(--text); }
body.dark-mode input, body.dark-mode select { color: white !important; background: #475569 !important; }
body.dark-mode .input-label { color: #cbd5e1 !important; }
body.dark-mode h1, body.dark-mode h2, body.dark-mode h4, body.dark-mode p, body.dark-mode .back-link { color: #ffffff !important; }
body.dark-mode .form-container { background: #1e293b !important; }

/* FIX BOX PUTIH PADA TULISAN MASA/TARIKH */
.card small {
    background: transparent !important; /* Paksa buang background putih dari JS */
    color: var(--text) !important;
    opacity: 0.8;
}

.lang-switcher-login {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    z-index: 100;
}

.lang-switcher-login span {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    opacity: 0.4;
    transition: 0.3s;
}

.lang-switcher-login span.active {
    opacity: 1;
    color: var(--primary);
    text-decoration: underline;
}

body.dark-mode .lang-switcher-login { background: rgba(255, 255, 255, 0.1); }
body.dark-mode .lang-switcher-login span { color: #ffffff; }

.profile-img-circle { 
    width: 100px; height: 100px; background: #e2e8f0; border-radius: 50% !important; 
    margin: 0 auto 15px; display: flex; align-items: center; justify-content: center; 
    overflow: hidden; border: 4px solid rgba(0, 51, 102, 0.1); 
}
.profile-img-circle img { width: 100%; height: 100%; object-fit: cover; }

.status-dot { 
    width: 10px; 
    height: 10px; 
    border-radius: 50%; 
    display: inline-block; 
    margin-right: 8px; 
}
.bg-live { background-color: #28a745; box-shadow: 0 0 8px #28a745; animation: pulse-live 2s infinite; }
.bg-pending { background-color: #ffc107; box-shadow: 0 0 8px #ffc107; }
.bg-ended { background-color: #dc3545; box-shadow: 0 0 8px #dc3545; }

@keyframes pulse-live { 0%, 100% { transform: scale(0.95); opacity: 0.7; } 50% { transform: scale(1.05); opacity: 1; } }

#auth-screen { 
    display: flex; 
    justify-content: center;   
    align-items: flex-start; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(135deg, var(--primary), var(--accent)); 
    z-index: 9000; 
    overflow-y: auto;      
    padding: 30px 0;       
    -webkit-overflow-scrolling: touch;
}

.auth-container {
    position: relative;
    width: 90%;
    max-width: 380px;
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    margin: auto; 
    height: auto;            
    max-height: none;        
    display: flex;
    flex-direction: column;
    overflow: visible;       
}

.form-container {
    padding: 30px 25px 40px 25px !important; 
    display: none; 
    flex-direction: column;
    gap: 15px;
}

body.dark-mode .auth-container {
    background: #1e293b;
}


.auth-container::-webkit-scrollbar {
    display: none;
}

.form-container h2 {
    margin-top: 25px; 
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    text-align: center;
}
/* Logic paparan murni */
.active-form { 
    display: flex !important; 
}

#authBox:not(.active) .login-form { display: flex !important; }
#authBox.active .signup-form { display: flex !important; }
/* Forgot form ditukar via JS */

.back-link {
    text-align: center;
    width: 100%;
    cursor: pointer;
    margin-top: 20px;
    font-size: 13px;
    font-weight: bold;
    color: var(--primary);
}

.input-group { position: relative; margin-bottom: 18px; text-align: left; width: 100%; }

.input-label { 
    display: block; 
    font-size: 11px; 
    font-weight: 700; 
    color: #64748b; 
    margin-left: 5px; 
    margin-bottom: 6px; 
    text-transform: uppercase; 
}

input, select { 
    width: 100% !important; 
    padding: 15px; 
    border: 2px solid transparent; 
    border-radius: 12px; 
    background: var(--input-bg); 
    color: var(--primary); 
    font-size: 15px; 
    outline: none; 
    transition: 0.3s; 
}

.toggle-password { 
    position: absolute; 
    right: 15px; 
    top: 38px; 
    cursor: pointer; 
    color: #94a3b8; 
    display: flex; 
    align-items: center; 
    z-index: 10; 
}

.top-header { 
    width: 100%; 
    padding: 45px 20px 10px; 
    display: flex; 
    justify-content: flex-end; 
    align-items: center; 
    position: relative; 
    z-index: 5000; 
}

#fab-back { 
    position: absolute; 
    left: 20px; 
    width: 45px; /* Lebar dan tinggi sama supaya jadi bulat/petak */
    height: 45px; 
    background: var(--primary); 
    border-radius: 12px; /* Gunakan 50% kalau bos mahu dia bulat betul */
    display: none; 
    align-items: center; 
    justify-content: center; 
    border: none; 
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
    z-index: 5500;
    transition: transform 0.2s;
}

#fab-back:active {
    transform: scale(0.9); /* Efek tekan yang lebih murni */
}

.menu-wrapper { position: relative; }

.menu-header { 
    background: var(--accent); 
    color: white; 
    width: 45px; /* Saiz sama dengan butang Back bos */
    height: 45px; 
    border-radius: 12px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: none;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.15);
}

.menu-header:active {
    transform: scale(0.9);
    background: var(--primary);
}

.fold-list { 
    position: absolute; 
    top: 110%; 
    right: 0; 
    width: 180px; 
    list-style: none; 
    background: var(--dark-card); 
    border-radius: 15px; 
    overflow: hidden; 
    display: none; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    z-index: 6000; 
    padding: 0;
}

.menu-wrapper.open .fold-list { display: block; }

.fold-list li a { display: block; padding: 14px 18px; color: #cbd5e1; text-decoration: none; font-size: 13px; }

.dashboard-header { margin-top: 15px; margin-bottom: 30px; } 

.page-title { font-size: 28px; font-weight: 800; color: var(--primary); }

.card { 
    background: var(--white); 
    padding: 20px; 
    border-radius: 25px; 
    margin-bottom: 15px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); 
}

.body-carousel { margin-top: 25px; width: 100%; }

.carousel-scroll { 
    display: flex; 
    gap: 15px; 
    overflow-x: auto; 
    padding: 10px 5px; 
    scrollbar-width: none; 
}

.carousel-scroll::-webkit-scrollbar { display: none; }

.carousel-card { 
    min-width: 260px; 
    background: var(--white); 
    padding: 20px; 
    border-radius: 20px; 
    border-bottom: 5px solid var(--accent); 
}

.scanner-safe-wrapper {
    position: relative; 
    width: 100%; 
    max-width: 320px; 
    aspect-ratio: 1/1;
    margin: 0 auto 10px; 
    background: #000; 
    border-radius: 20px; 
    overflow: hidden; 
    border: 4px solid var(--accent); 
    display: none; 
}

#safe-canvas { width: 100%; height: 100%; object-fit: cover; }

.laser-line {
    position: absolute; 
    top: 5%; 
    left: 0; 
    width: 100%; 
    height: 3px; 
    background: #00ff00; 
    box-shadow: 0 0 15px #00ff00; 
    z-index: 10;
    animation: moveLaser 2s infinite linear;
}

@keyframes moveLaser { 
    0% { top: 5%; } 
    50% { top: 95%; } 
    100% { top: 5%; } 
}

.btn-auth-full { 
    display: block; 
    width: 100%; 
    padding: 16px; 
    border: none; 
    border-radius: 15px; 
    background: var(--primary); 
    color: white; 
    font-weight: bold; 
    cursor: pointer; 
    margin-top: 10px;
    text-align: center; 
}

.switch { position: relative; display: inline-block; width: 45px; height: 24px; }

.switch input { opacity: 0; width: 0; height: 0; }

.slider { 
    position: absolute; 
    cursor: pointer; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background-color: #cbd5e1; /* Warna standard kelabu */
    border-radius: 34px; 
    transition: .4s; 
}

.slider:before { 
    position: absolute; 
    content: ""; 
    height: 18px; 
    width: 18px; 
    left: 3px; 
    bottom: 3px; 
    background-color: white; 
    border-radius: 50%; 
    transition: .4s; 
}

input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(21px); }

#app-content { display: none; height: 100vh; flex-direction: column; overflow: hidden; }

.page { flex: 1; overflow-y: auto; padding: 0 20px 140px; display: none; width: 100%; }

.active-page { display: block; }

.bg-live { background-color: #28a745 !important; }
.bg-pending { background-color: #ffc107 !important; }
.bg-ended { background-color: #dc3545 !important; } 

#page-tempahan h2.page-title {
    margin-top: 20px !important;
    margin-bottom: 25px !important;
}

#page-tempahan .card {
    margin-top: 20px !important; 
    padding: 25px;
    border-radius: 30px;
}

#bDate {
    width: 60% !important;
    min-width: 160px;
    margin-right: auto;
    display: block;
}

#bStart, #bEnd {
    width: 100% !important;
    padding: 12px;
    text-align: center;
    font-size: 15px;
}

#page-tempahan .input-group {
    margin-bottom: 20px;
}

#page-tempahan div[style*="display:flex"] {
    gap: 15px !important; 
}

/* --- UPGRADE UI PROFIL --- */
.profile-info-list {
    margin-top: 25px;
    text-align: left;
    background: var(--input-bg);
    border-radius: 20px;
    padding: 10px 20px;
    transition: 0.3s;
}

.info-row {
    padding: 15px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* Penyesuaian Mod Gelap */
body.dark-mode .info-row {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

body.dark-mode .info-value {
    color: #ffffff;
}

body.dark-mode .info-label {
    color: #94a3b8;
}

/* Styling butang BOOK di tepi kad */
.btn-book-side {
    flex: 1;
    border-radius: 20px;
    background: var(--primary);
    color: white;
    border: none;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.2);
    transition: transform 0.2s;
}

.btn-book-side:active {
    transform: scale(0.95);
    background: var(--accent);
}

/* Styling Kotak Status (Badge) */
.status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 5px;
    text-transform: uppercase;
    border: 1.5px solid; /* Ketebalan kotak */
    display: inline-block;
}

/* Warna Merah: Ended & Rejected */
.badge-red {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: rgba(220, 53, 69, 0.05);
}

/* Warna Hijau: Approved */
.badge-green {
    color: var(--success) !important;
    border-color: var(--success) !important;
    background: rgba(40, 167, 69, 0.05);
}

.login-form {
    display: flex;
}

.login-form p {
    text-align: center;
    width: 100%;
    margin-top: 25px;
}

.signup-form p, .login-form p {
    text-align: center !important;
    width: 100%;
}

.back-link:hover {
    text-decoration: underline;
}

.input-group {
    margin-bottom: 12px;
}

.refresh-container {
    width: 100%;
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: height 0.2s;
    background: transparent;
}

.spinner-murni {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 51, 102, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pusing 0.6s linear infinite;
}

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

/* Bila ditarik, kita tambah class ni guna JS */
.refreshing .refresh-container {
    height: 60px;
    margin-top: 10px;
}
