/* General Body and App Container Styles */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --background-color: #f0f2f5;
    --text-color: #333;
    --container-bg: #fff;
    --card-bg: #f9f9f9;
    --border-color: #ddd;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px; /* Removed extra bottom padding */
    display: flex;
    flex-direction: column; /* Allow footer to sit below the container */
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

#app-container {
    width: 100%;
    max-width: 1400px;
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-height: 80vh;
    transition: background-color 0.3s;
}

/* Headings and Text */
h1, h2, h3, h4 {
    color: var(--primary-color);
}

p {
    line-height: 1.6;
}

/* Buttons */
.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin: 5px;
}

.btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-danger { background-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; }
.btn-success { background-color: #28a745; }
.btn-success:hover { background-color: #218838; }
.btn-secondary { background-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-warning { background-color: #ffc107; }
.btn-warning:hover { background-color: #e0a800; }
.btn-info { background-color: #17a2b8; }
.btn-info:hover { background-color: #138496; }


/* Form Inputs */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px; /* Prevents zoom on iOS */
    background-color: var(--container-bg);
    color: var(--text-color);
}

textarea {
    height: 100px;
    resize: vertical;
}

/* Login and Registration Screen */
#login-screen, #register-screen {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#login-screen h2, #register-screen h2 {
    text-align: center;
    margin-bottom: 20px;
}

/* Main Menu / Character Select */
#main-menu-screen .char-selection {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: 20px;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-header .title-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}
.main-header .logo {
    height: 40px;
    width: 40px;
}

.char-type-box {
    flex-basis: 48%;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
}

.char-list li {
    background-color: var(--card-bg);
    margin: 5px 0;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Civilian Play Screen */
.civ-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.dashboard-card h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.vehicle-list li {
    margin-bottom: 10px;
    background-color: var(--card-bg);
    padding: 10px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.vehicle-buttons {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.vehicle-buttons .btn {
    flex-grow: 1;
    margin: 0;
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.vehicle-buttons .btn:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.vehicle-buttons .btn:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-right: none;
}


/* LEO MDT (Mobile Data Terminal) Styles */
#leo-play-screen {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
    padding: 15px;
    border-radius: 8px;
}
#leo-play-screen h1, #leo-play-screen h2, #leo-play-screen h3 {
    color: #16a085 !important;
}
#leo-play-screen .btn {
    background-color: #16a085 !important;
}
#leo-play-screen .btn:hover {
    background-color: #1abc9c !important;
}
#leo-play-screen input, #leo-play-screen select, #leo-play-screen textarea {
    background-color: #2c3e50 !important;
    color: #ecf0f1 !important;
    border: 1px solid #34495e !important;
}

.mdt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2c3e50;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.status-bar {
    background-color: #23233b;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    overflow-x: auto;
}
.status-bar .officer-status {
    white-space: nowrap;
    border-right: 1px solid #4a4a6a;
    padding-right: 15px;
}

.mdt-main {
    display: flex;
    gap: 20px;
}

.mdt-left, .mdt-right {
    flex: 1;
}

.mdt-section {
    background-color: #23233b;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

#bolo-list .bolo-item, .result-item {
    background-color: #2c3e50;
    padding: 10px;
    margin-top: 5px;
    border-radius: 4px;
    border: 1px solid #34495e;
}

#leo-play-screen .btn.flashing {
    background-color: #dc3545 !important;
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 100% { background-color: #e74c3c !important; }
    50% { background-color: #dc3545 !important; }
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--container-bg);
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 100%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-height: 95vh;
    overflow-y: auto;
}

.modal-content-dark {
    background-color: #2c3e50;
    color: #ecf0f1;
}
.modal-content-dark h2 {
    color: #16a085;
}
.modal-content-dark input, .modal-content-dark select, .modal-content-dark textarea {
    background-color: #34495e;
    color: #ecf0f1;
    border: 1px solid #5d6d7e;
}

.modal-content-dark ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #4a4a6a;
}


.modal-content-dark ul li:last-child {
    border-bottom: none;
}

.modal-content-dark .leo-vehicle-button-group {
    display: flex;
    flex-shrink: 0;
    margin-left: 15px;
}

.modal-content-dark .leo-vehicle-button-group .btn {
    margin: 0;
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-content-dark .leo-vehicle-button-group .btn:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.modal-content-dark .leo-vehicle-button-group .btn:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-right: none;
}


.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content-dark .close-btn {
    color: #ecf0f1;
}
.modal-content-dark .close-btn:hover {
    color: #fff;
}

.modal-footer {
    text-align: right;
    margin-top: 20px;
}

/* Footer Styles */
#app-footer {
    position: static; /* FIX: Changed from fixed to static */
    width: 100%;
    max-width: 1400px;
    background-color: #343a40;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 0.9em;
    box-sizing: border-box;
    margin-top: 20px; /* Add space between container and footer */
    border-radius: 8px;
}
#app-footer a { color: #17a2b8; text-decoration: none; font-weight: bold; }
#app-footer a:hover { text-decoration: underline; }

/* --- DARK MODE --- */
body.dark-mode {
    --primary-color: #16a085;
    --primary-hover: #1abc9c;
    --background-color: #121212;
    --text-color: #e0e0e0;
    --container-bg: #1e1e1e;
    --card-bg: #2c3e50;
    --border-color: #34495e;
}
body.dark-mode #app-footer { background-color: #212529; }
body.dark-mode .char-list li { background-color: #34495e; }
body.dark-mode .dashboard-card { border-color: #34495e; }
body.dark-mode .vehicle-list li, body.dark-mode .citation-list li { background-color: #34495e; }
body.dark-mode textarea[readonly] {
    background-color: #2c3e50;
    color: #bdc3c7;
}
body.dark-mode .vehicle-buttons .btn {
    border-right: 1px solid rgba(0, 0, 0, 0.2);
}


.loader {
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #16a085; /* MDT Green */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* --- MOBILE FRIENDLY --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .main-header { flex-direction: column; gap: 10px; }
    .mdt-main, .char-selection, #char-creator-screen .form-columns {
        flex-direction: column;
    }
    /* Make modals full-screen on mobile */
    .modal {
        padding: 0;
        align-items: flex-start;
    }
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    #app-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }
}
