/* General Styling (Red Theme - High Contrast) */
:root {
   --primary-color: #ffffff;
    --primary-color-dark: #f0f0f0;
    --red-theme-bg: #c02425;
    --red-theme-dark: #0031b8;
    --text-on-red: #ffffff;
    --text-on-white: #212529; /* ປັບສີຕົວໜັງສືເທິງພື້ນຂາວໃຫ້ເຂັ້ມຂຶ້ນ (ເກືອບດຳ) */
    --border-color: #dee2e6;
    --card-bg-color: #ffffff;
    --label-color: #495057; /* ສີສຳລັບ label ຂອງຟອມ */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Noto Sans Lao', sans-serif;
    background-color: var(--red-theme-bg);
    color: var(--text-on-red);
    line-height: 1.6;
}

/* View & Page Management */
.view { display: block; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#app-container { max-width: 500px; margin: 0 auto; padding: 20px 15px 80px 15px; }
header { text-align: center; margin-bottom: 25px; }
header h1 { color: var(--primary-color); font-size: 2em; text-shadow: 1px 1px 2px rgba(0,0,0,0.2); }
header p { color: var(--primary-color-dark); font-size: 1.1em; }
/* *** ເພີ່ມ Style ນີ້ເຂົ້າໄປໃໝ່ທັງໝົດ *** */
/* Style ສະເພາະ Header ຂອງໜ້າຫຼັກ */
.main-header {
    display: flex; /* ໃຊ້ Flexbox ເພື່ອຈັດອົງປະກອບໃຫ້ຢູ່ລຽນກັນ */
    align-items: center; /* ຈັດໃຫ້ທຸກຢ່າງຢູ່ເຄິ່ງກາງຕາມແນວຕັ້ງ */
    gap: 15px; /* ໄລຍະຫ່າງລະຫວ່າງໂລໂກ້ກັບຂໍ້ຄວາມ */
    text-align: left; /* ປ່ຽນການຈັດຂໍ້ຄວາມເປັນດ້ານຊ້າຍ */
}

.header-logo-img {
    height: 50px; /* ກຳນົດຄວາມສູງຂອງໂລໂກ້ */
    width: 50px;  /* ກຳນົດຄວາມກວ້າງ */
    object-fit: contain; /* ໃຫ້ຮູບພໍດີກັບກອບໂດຍບໍ່ເສຍອັດຕາສ່ວນ */
    background-color: rgba(255, 255, 255, 0.2); /* ເພີ່ມພື້ນຫຼັງໃຫ້ໂລໂກ້ເບິ່ງເດັ່ນຂຶ້ນ */
    border-radius: 8px; /* ເຮັດໃຫ້ຂອບມົນ */
    padding: 5px;
}

.header-text h1 {
    font-size: 1.8em; /* ປັບຂະໜາດຫົວຂໍ້ໃຫ້ພໍດີ */
    margin-bottom: -5px; /* ດຶງຂໍ້ຄວາມລຸ່ມຂຶ້ນມາເລັກນ້ອຍ */
}

.header-text p {
    font-size: 1em;
    opacity: 0.9;
}
/* Cards */
.card {
    background-color: var(--card-bg-color);
    color: var(--text-on-white);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}
.card h3 { margin-bottom: 5px; color: var(--label-color); font-size: 1em; }
.card p { font-size: 1.5em; font-weight: bold; color: var(--red-theme-dark); }
.summary-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 20px; }

/* Actions and Forms */
.actions, .report-filters, #settings-form {
    margin-bottom: 25px;
    background: var(--card-bg-color);
    color: var(--text-on-white); /* << ຮັບປະກັນວ່າຕົວໜັງສືໃນກ່ອງຂາວເປັນສີເຂັ້ມ */
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.actions h2, #settings-form h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--red-theme-dark); /* << ຫົວຂໍ້ໃນກ່ອງຂາວເປັນສີແດງເຂັ້ມ */
}
#settings-form h3 {
    text-align: left;
    border-bottom: 2px solid var(--red-theme-dark);
    padding-bottom: 5px;
}
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Style for file input */
#settings-form label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--label-color);
}
input[type="file"] {
    color: var(--text-on-white);
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}
/* Style for Backup/Restore Section */
.settings-section {
    margin-top: 30px; /* ເພີ່ມໄລຍະຫ່າງຈາກຟອມດ້ານເທິງ */
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.1); /* ເພີ່ມພື້ນຫຼັງໂປ່ງໃສເລັກນ້ອຍໃຫ້ເບິ່ງเด่นขึ้น */
    border-radius: 8px;
    text-align: center;
}

.settings-section h3 {
    color: var(--primary-color); /* ຫົວຂໍ້ເປັນສີຂາວ */
    margin-bottom: 10px;
}

.settings-section .note {
    color: var(--primary-color-dark); /* << ປັບສີຂໍ້ຄວາມ 'note' ເປັນສີຂາວອ່ອນ */
    font-size: 0.9em;
    margin-bottom: 15px;
    line-height: 1.5;
}
/* Buttons */
.btn { padding: 12px 15px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; font-size: 1em; cursor: pointer; transition: background-color 0.3s, color 0.3s; width: 100%; }
.btn-primary { background-color: var(--red-theme-dark); color: var(--text-on-red); border: none; }
.btn-primary:hover { background-color: #801718; }
.btn-secondary { background-color: #6c757d; color: #fff; border: none; }
.btn-secondary:hover { background-color: #5a6268; }

input[type="text"], input[type="number"], input[type="password"], input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    margin-top: 5px; /* ປັບໄລຍະຫ່າງຈາກ label */
    color: var(--text-on-white);
}
.checkout-form { display: flex; gap: 10px; align-items: center;}
.checkout-form input { margin-top: 0; }
.note { font-size: 0.8em; color: #666; text-align: center; margin-top: 15px;}

/* Current Tickets List */
/* Current Tickets List (ເວີຊັ່ນປັບປຸງ) */
.current-tickets h3 { text-align: center; margin-bottom: 10px; color: var(--primary-color); }

/* Current Tickets List (ເວີຊັ່ນປັບປຸງ) */
.current-tickets h3 { text-align: center; margin-bottom: 10px; color: var(--primary-color); }

.ticket-item {
    display: grid; 
    grid-template-columns: auto 1fr auto; 
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.9);
    color: var(--text-on-white);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 5px solid var(--theme-accent-color, #0031b8);
}
.ticket-item.car {
    border-left-color: #ffc107;
}

.ticket-item .vehicle-icon {
    font-size: 1.8em;
}

.ticket-item .ticket-info {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.ticket-item .ticket-info .license-plate {
    font-weight: bold;
    font-size: 1.1em;
    color: #000;
}

.ticket-item .ticket-info .ticket-details {
    font-size: 0.8em;
    color: #666;
}

.ticket-item .checkout-action-btn {
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
}
.ticket-item.car {
    border-left-color: #ffc107; /* ສີສຳລັບລົດໃຫຍ່ (ສີເຫຼືອງ) */
}

.ticket-item .vehicle-icon {
    font-size: 1.8em; /* ຂະໜາດໄອຄອນລົດ */
}

.ticket-item .ticket-info {
    display: flex;
    flex-direction: column; /* ຈັດຂໍ້ມູນເປັນແຖວຕັ້ງ */
    line-height: 1.4;
}

.ticket-item .ticket-info .license-plate {
    font-weight: bold;
    font-size: 1.1em;
    color: #000;
}

.ticket-item .ticket-info .ticket-details {
    font-size: 0.8em;
    color: #666;
}

.ticket-item .checkout-action-btn {
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 6px;
    white-space: nowrap; /* ບໍ່ໃຫ້ຂໍ້ຄວາມຕັດຂຶ້ນແຖວໃໝ່ */
}
/* Navigation Bar */
#nav-bar { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--red-theme-dark); display: flex; justify-content: space-around; box-shadow: 0 -2px 5px rgba(0,0,0,0.2); z-index: 1000; }
.nav-btn { background: none; border: none; color: rgba(255, 255, 255, 0.7); padding: 15px 10px; font-size: 0.9em; flex-grow: 1; cursor: pointer; transition: all 0.3s; border-top: 3px solid transparent; }
.nav-btn.active { color: #ffffff; border-top: 3px solid #ffffff; font-weight: bold; background-color: rgba(0,0,0,0.1); }

/* Login View */
#login-view { height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.login-box { background: var(--card-bg-color); color: var(--text-on-white); padding: 40px; border-radius: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); max-width: 350px; width: 90%; }
.login-box img { width: 100px; height: 100px; object-fit: contain; margin-bottom: 20px; }
.login-box h2 { margin-bottom: 10px; color: var(--red-theme-dark); }
.login-box p { margin-bottom: 20px; }
.login-box input { margin-bottom: 15px; text-align: center; }
.error-message { color: var(--red-theme-dark); margin-top: 10px; font-size: 0.9em; min-height: 1em; }
/* Login Footer Styling */
.login-footer {
    position: absolute; /* ຕັ້ງຕຳແໜ່ງໂດຍອ້າງອີງຈາກໜ້າຈໍ */
    bottom: 20px;     /* ໃຫ້ຢູ່ຫ່າງຈາກຂอบລຸ່ມ 20px */
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.6); /* ສີຂາວໂປ່ງໃສ */
    font-size: 0.8em;
}

.login-footer p {
    margin: 0;
    line-height: 1.5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); /* ເພີ່ມເງົາให้អានງ່າຍຂຶ້ນ */
}
/* Report & Settings - High Contrast Adjustments */
.date-range-selector { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: center; margin-bottom: 15px; }
.date-range-selector label {
    font-size: 0.9em;
    color: var(--label-color); /* << ປ່ຽນສີ label ໃຫ້ເຂັ້ມຂຶ້ນ */
    font-weight: 500;
}
.filter-buttons { display: flex; gap: 10px; justify-content: center; }
.filter-buttons .btn { padding: 8px 15px; font-size: 0.9em; }

/* Report Table */
.report-table {
    width: 100%;
    overflow-x: auto;
    background-color: var(--card-bg-color); /* << ເພີ່ມພື້ນຫຼັງຂາວໃຫ້ຕາຕະລາງ */
    padding: 10px;
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-on-white); /* << ຮັບປະກັນວ່າຕົວໜັງສືໃນຕາຕະລາງເປັນສີເຂັ້ມ */
}
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: var(--red-theme-dark); color: var(--text-on-red); }
tbody tr:nth-child(even) { background-color: #f8f9fa; } /* ປ່ຽນສີແຖວຄູ່ໃຫ້ອ່ອນລົງ */

/* Modal & Print (ບໍ່ປ່ຽນແປງ) */
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal-content { background-color: #fefefe; color: var(--text-on-white); margin: auto; padding: 20px; border: 1px solid #888; width: 320px; border-radius: 5px; }
.modal-actions { margin-top: 20px; display: flex; justify-content: space-between; gap: 10px; }
#printable-receipt { font-family: 'Courier New', Courier, monospace; color: #000; font-size: 12px; }
.receipt-header { text-align: center; margin-bottom: 10px; }
.receipt-header img { max-width: 100px; max-height: 50px; margin-bottom: 5px; }
.receipt-divider { border-top: 1px dashed #000; margin: 10px 0; }
.receipt-info p { margin: 4px 0; font-size: 13px; }
.receipt-info strong { min-width: 80px; display: inline-block; }
/* *** Style ສຳລັບຈັດກາງ QR Code *** */
.receipt-qrcode-container {
    display: flex;
    justify-content: center; /* ຈັດໃຫ້ຢູ່ເຄິ່ງກາງຕາມແນວນອນ */
    align-items: center;
    margin: 15px 0; /* ເພີ່ມໄລຍະຫ່າງເທິງ-ລຸ່ມ */
}

/* ຮັບປະກັນວ່າ div ທີ່ຢູ່ຂ້າງໃນ QR Code ບໍ່ມີ margin ແປກໆ */
.receipt-qrcode-container > div {
    display: flex;
    justify-content: center;
    align-items: center;
}
.receipt-footer { text-align: center; margin-top: 10px; font-size: 11px; }
@media print { body * { visibility: hidden; } #printable-receipt, #printable-receipt * { visibility: visible; } #printable-receipt { position: absolute; left: 0; top: 0; width: 100%; } }
/* Style for Reprint button in report table */
.reprint-btn {
    padding: 5px 10px;
    font-size: 0.9em;
    line-height: 1;
}
/* QR Code Scanner Style */
#qr-reader {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* ເພື່ອໃຫ້ຂອບມົນມີຜົນກັບວິດີໂອ */
}
/* Chart Container */
.chart-container {
    background-color: var(--card-bg-color); /* << ເພີ່ມແຖວນີ້ */
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    height: 300px;
}
