:root {
    --varsys-gold: #FFD231;
    --varsys-dark-gold: #f5c000;
    --text-gray: #8E8E93;
    --text-sub: #8E8E93;
    --card-bg: #FFFFFF;
    --danger-red: #ff3b30;
    --emergency-red: #E31E24;
    --nav-bg: #F9F9F9;
}

/* --- DARK MODE OVERRIDES --- */
body.dark-mode {
    --bg-light: #121212;
    --card-bg: #121212;
    --text-main: #FFFFFF;
    --text-sub: #AEAEB2;
    --nav-bg: #121212;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

body {
    background-color: #1e1e1e;
    display: flex;
    justify-content: center;
    /* FIX: Set strict boundary using 100dvh to prevent body scroll */
    min-height: 100dvh; 
    height: 100dvh;
    overflow: hidden; 
}

.app-shell {
    width: 100%;
    max-width: 430px;
    background-color: var(--card-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    /* FIX: Use 100% of the strictly defined body height */
    height: 100%;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    /* FIX: Added safe area top padding so the header doesn't hide behind mobile status bars */
    padding-top: env(safe-area-inset-top);
}

/* --- HEADER --- */
.profile-header {
    background: linear-gradient(180deg, var(--varsys-gold) 0%, var(--varsys-dark-gold) 100%);
    padding: 25px 20px 35px 25px;
    border-bottom-left-radius: 35px;
    border-bottom-right-radius: 35px;
}

body.dark-mode .profile-header {
    background: linear-gradient(180deg, #2C2C2E 0%, #1C1C1E 100%);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-top h1{
    margin-top: -5px;
    font-size: 1.2rem;
    font-weight: 600;
}

.qr-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

/* --- QR MODAL ANIMATION --- */
#qrIDModal {
    display: flex; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0); 
    backdrop-filter: blur(0px); 
    z-index: 9999;
    align-items: center;
    justify-content: center;
    pointer-events: none; 
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#qrIDModal.active {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 85%;
    max-width: 320px;
    border-radius: 30px;
    padding: 30px;
    text-align: center;
    position: relative;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

#qrIDModal.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.profile-main { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; }
.avatar-container {
    width: 90px; height: 90px; border-radius: 50%; border: 4px solid #fff;
    overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.avatar-container img { width: 100%; height: 100%; object-fit: cover; }

.header-tabs { display: flex; gap: 10px; }
.tab-btn {
    flex: 1; padding: 12px; border-radius: 12px; border: none;
    font-weight: 700; background: #2c2c2e; color: var(--varsys-gold); cursor: pointer;
}
.tab-btn.active { background: #F9F9F9; color: #1c1c1e; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }

/* --- BODY --- */
.profile-body {
    padding: 30px 20px 100px 20px; 
    flex-grow: 1;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
}

.tab-content { display: none; padding: 20px; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

.input-group { margin-bottom: 18px; }
label { font-size: 0.75rem; font-weight: 500; color: var(--text-sub); margin-bottom: 6px; display: block; }
input, textarea {
    width: 100%; background: var(--card-bg); border: 1px solid #efeff4;
    padding: 14px; border-radius: 16px; font-weight: 500; color: var(--text-main);
}
body.dark-mode input, body.dark-mode textarea { border-color: #2C2C2E; }

/* --- VEHICLE CARDS --- */
.vehicle-container { display: flex; flex-direction: column; gap: 15px; margin-top: 10px; }
.vehicle-card {
    background: var(--card-bg, #fff);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 12px;
}
body.dark-mode .vehicle-card { border-color: #2C2C2E; background: #1c1c1e; }

.plate-badge {
    background: #2c2c2e;
    color: #ffca13;
    padding: 5px 12px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 800;
    border: 2px solid #000;
}

.add-vehicle-btn {
    width: 100%;
    margin-top: 25px;
    padding: 15px;
    border-radius: 12px;
    border: 2px dashed #ccc;
    background: transparent;
    color: #888;
    font-weight: 600;
}

/* --- STICKY REPORT BUTTON --- */
.action-container {
    position: fixed; 
    /* FIX: Adjust bottom dynamically so it always floats above the nav bar on all devices */
    bottom: calc(85px + env(safe-area-inset-bottom)); 
    width: 100%; 
    max-width: 450px; 
    padding: 0 20px; 
    z-index: 10;
}

/* Navigation Container */
.report-section {
    margin-top: 10px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.report-section i {
    font-size: 1.4rem;
   color: var(--text-gray);
    animation: bounceUp 2s infinite;
    margin-bottom: -10px;
}

.report-section i:last-of-type {
    margin-bottom: 5px;
}

.report-text {
font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Navigation Container */
nav {
    height: 80px; /* Panatilihin ang base height */
    background: #F9F9F9;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #EDEDED;
    
    /* ITO ANG PINAKAMALAKING PAGBABAGO */
    /* Magdadagdag tayo ng padding para umangat ang nav bar mula sa ilalim */
    padding-bottom: max(50px, env(safe-area-inset-bottom));
    
    /* Dagdagan ang height para magkasya ang padding sa loob */
    height: calc(100px + max(20px, env(safe-area-inset-bottom)));
    
    z-index: 1000;
}

/* Consistent Nav Item */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8E8E93;
    flex: 1;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
}

/* Icons: Consistent Size & Alignment */
.nav-item i {
    font-size: 1.3rem;
    height: 30px; 
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

/* Labels: Consistent Font Size */
.nav-item span {
    font-size: 10px;   /* Fixed font size: saktong-sakto sa mobile */
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    transition: color 0.3s ease;
}


/* --- ACTIVE STATE (Consistent Colors) --- */
.nav-item.active {
    color: #FFCA13; /* Varsys Gold */
}

.nav-item.active i, 
.nav-item.active span {
    color: #FFCA13;
    font-weight: 700;
}

/* --- BADGE: Consistent Position --- */
.badge {
    position: absolute;
    top: 10px;
    right: 20%; 
    background: #FF3B30;
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #F9F9F9;
    z-index: 2;
}

.emergency-wrapper {
    position: relative;
    top: -25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.emergency-btn {
    width: 68px;
    height: 68px;
    text-decoration: none;
    background-color: var(--emergency-red);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    transition: transform 0.2s active;
}

.emergency-btn:active {
    transform: scale(0.9);
}

.emergency-text {
    color: var(--emergency-red);
    font-weight: 800;
    font-size: 0.6rem;
    margin-top: 8px;
    letter-spacing: 0.5px;
    font-family: 'Montserrat', sans-serif;;
}


/* --- PAGE TRANSITION ANIMATION --- */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp { 
    from { transform: translateY(20px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-area {
    animation: slideUpFade 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    will-change: transform, opacity;
}

.page-exit {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-in;
}

/* Dark Mode Overrides */
* {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, filter 0.5s ease !important;
}

body.dark-mode {
    background-color: #121212; 
}

body.dark-mode .app-shell {
    background-color: #121212;
    color: #FFFFFF;
}

body.dark-mode .header-right i.fa-qrcode{
    color:#1e1e1e;
}

body.dark-mode .qr-code-img {
    filter: invert(1) brightness(2); 
    color: #FFFFFF;
}

body.dark-mode header, 
body.dark-mode nav {
    background: #121212;
    border-top: 1px solid #2C2C2E;
}

body.dark-mode .nav-item.active {
    background: #1C1C1E; 
    border-color: #FFCA13;
}

body.dark-mode .nav-item.active span,
body.dark-mode .nav-item.active i {
    color: #FFCA13;
}

body.dark-mode .header-title {
    color: #FFFFFF;
}

body.dark-mode .emergency-placeholder { background: #1c1c1e; border-color: #3a3a3c; }
body.dark-mode .modal-card { background: #1c1c1e; color: white; }