
:root {
    --vicses-orange: #F58220;
    --vicses-orange-hover: #d97a1c;
    --vicses-red: #EF3E33;
    --vicses-green: #00645E;
    --vicses-charcoal: #415363;
    --vicses-charcoal-darker: #354452;
    --vicses-charcoal-light: #5a6875;
    --vicses-light-gray: #e9ecef;
    --emergency-red: rgba(239, 62, 51, 0.5);
    --non-emergency-green: rgba(0, 100, 94, 0.5);
    --phone-link-green: #a0e8a0;
}

/* Global Scrollbar Styling */
html {
    scrollbar-width: auto; /* Changed from thin to auto for wider bars in Firefox */
    scrollbar-color: var(--vicses-orange) var(--vicses-charcoal-darker);
}

::-webkit-scrollbar {
    width: 16px; /* Increased from 12px to 16px */
}

::-webkit-scrollbar-track {
    background: var(--vicses-charcoal-darker);
}

::-webkit-scrollbar-thumb {
    background-color: var(--vicses-orange);
    border-radius: 10px;
    border: 3px solid var(--vicses-charcoal-darker);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--vicses-orange-hover);
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Roboto', sans-serif; margin: 0; background-color: var(--vicses-charcoal); color: var(--vicses-light-gray); }

.header-brand {
    background-color: var(--vicses-orange); padding: 15px 25px; display: flex;
    align-items: center; box-shadow: 0 4px 8px rgba(0,0,0,0.3); position: relative; overflow: hidden;
}
.header-brand::after {
    content: ''; position: absolute; top: -40%; right: -200px; width: 700px; height: 200%;
    opacity: 0.3; transform: rotate(-25deg);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><path fill="white" d="M0 0h20v20H0zM20 20h20v20H20z"/></svg>');
    z-index: 1;
}
.logo-container {
    background-color: white; padding: 8px; border-radius: 4px;
    margin-right: 25px; position: relative; z-index: 2;
}
.logo-container img { height: 70px; width: auto; display: block; }
.header-brand h1 { color: white; font-size: 2.8em; margin: 0; font-weight: bold; position: relative; z-index: 2; }
.rfa-container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 25px; }
.sticky-controls-header {
    position: sticky; top: 0; z-index: 10;
    background-color: var(--vicses-charcoal); padding-top: 15px; padding-bottom: 20px;
}
.filter-container { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-container label { font-weight: bold; font-size: 1em; color: var(--vicses-light-gray); }
#searchInput, #unitFilter {
    padding: 10px; font-size: 16px; background-color: var(--vicses-charcoal-darker);
    color: white; border: 1px solid var(--vicses-light-gray); border-radius: 4px;
}
#searchInput { flex-grow: 1; }
#searchInput::placeholder { color: #ccc; }
#unitFilter { cursor: pointer; }
#clearBtn {
    background-color: var(--vicses-charcoal-darker); color: var(--vicses-light-gray); 
    border: 1px solid var(--vicses-light-gray); padding: 10px 15px;
    border-radius: 4px; font-size: 16px; cursor: pointer; font-weight: bold;
}
#clearBtn:hover { background-color: var(--vicses-charcoal-light); }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { border: 1px solid var(--vicses-charcoal-darker); padding: 12px 8px; text-align: left; word-break: break-word; }
th:nth-child(1), td:nth-child(1) { min-width: 10.5%; max-width: 14%; width: 14%; white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { min-width: 5%; max-width: 8.5%; width: 8.5%; white-space: nowrap; }
table thead { position: sticky; top: 73px; z-index: 9; background-color: var(--vicses-orange); }
th { background-color: var(--vicses-orange); color: white; font-weight: bold; font-size: 1.1em; position: relative; }
th.sortable { cursor: pointer; padding-right: 25px; }
th.sortable .sort-arrow { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: 0.6; }
th.sortable[data-sort-dir="asc"] .sort-arrow, th.sortable[data-sort-dir="desc"] .sort-arrow { opacity: 1; }
tbody tr { background-color: var(--vicses-charcoal-darker); }
tbody tr:hover { background-color: var(--vicses-charcoal-light) !important; }
tr.non-emergency-row { background-color: var(--non-emergency-green) !important; }
tr.emergency-row { background-color: var(--emergency-red) !important; font-weight: bold; }
mark { background-color: #FCBC86; color: black; padding: 1px 2px; border-radius: 3px; }
.event-link { color: #90cfff; text-decoration: underline; cursor: pointer; font-weight: bold; }
.event-link:hover { color: #ffffff; }
.phone-link { color: var(--phone-link-green); text-decoration: underline; font-weight: bold; cursor: pointer; }
.phone-link:hover { color: #c0f0c0; }
.modal-overlay, .phone-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; }
.modal-overlay { background-color: rgba(0, 0, 0, 0.75); display: flex; justify-content: center; align-items: center; }
.phone-modal-overlay { background-color: transparent; }
.event-modal { 
    background-color: var(--vicses-charcoal); 
    border-radius: 8px; 
    width: 90%; 
    max-width: 900px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); 
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 20px; 
    border-bottom: 1px solid #6c757d; 
    background-color: var(--vicses-orange);
    border-top-left-radius: 8px; 
    border-top-right-radius: 8px;
    flex-shrink: 0;
}
.modal-header h2 { margin: 0; font-size: 1.3em; color: white; }
.modal-close { background: none; border: none; color: white; font-size: 1.8em; line-height: 1; cursor: pointer; padding: 0 5px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

.modal-message { 
    padding: 15px; 
    margin-bottom: 10px; 
    background-color: var(--vicses-charcoal-darker); 
    border-radius: 4px;
    border-left: 6px solid var(--vicses-orange);
}
.modal-message-followup { 
    margin-left: 30px;
}
.modal-message-meta { 
    display: flex; 
    align-items: center; 
    gap: 10px;
    font-size: 0.9em; 
    color: #adb5bd; 
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.time-diff { 
    font-weight: bold; 
    color: var(--vicses-orange); 
}
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}
.badge-unit { 
    background-color: transparent; 
    color: var(--vicses-light-gray);
    border: 1px solid var(--vicses-light-gray);
}
.badge-emergency { background-color: var(--vicses-red); color: white; }
.badge-non-emergency { background-color: var(--vicses-green); color: white; }
.badge-administrative { background-color: #6c757d; color: white; }
.modal-message-text { color: var(--vicses-light-gray); line-height: 1.5; }
.hidden { display: none; }
#phoneChoiceModal { position: absolute; background-color: var(--vicses-charcoal-darker); border: 1px solid var(--vicses-light-gray); border-radius: 5px; box-shadow: 0 3px 10px rgba(0,0,0,0.5); padding: 5px; display: flex; flex-direction: column; }
#phoneChoiceModal a { color: var(--vicses-light-gray); text-decoration: none; padding: 8px 12px; border-radius: 3px; white-space: nowrap; }
#phoneChoiceModal a:hover { background-color: var(--vicses-orange); color: white; }
.footer-container { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; padding: 0 5px; }
.results-counter, .last-updated { font-style: italic; color: #ccc; }
#backToTopBtn {
    display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99;
    border: none; background-color: var(--vicses-orange); color: white; cursor: pointer;
    padding: 12px; border-radius: 10px; font-size: 20px; line-height: 1;
    opacity: 0.8; transition: opacity 0.3s;
}
#backToTopBtn:hover { opacity: 1; }
@media (max-width: 768px) {
    .header-brand { flex-direction: column; align-items: flex-start; gap: 10px; }
    .rfa-container { padding: 15px; }
    .sticky-controls-header, table thead { position: static; }
    .sticky-controls-header { padding: 0; margin-bottom: 20px; }
    table { border: none; table-layout: auto; } thead { display: none; }
    tr { display: block; margin-bottom: 15px; border: 2px solid var(--vicses-orange); border-radius: 5px; background-color: var(--vicses-charcoal-darker) !important; }
    td { display: block; text-align: right; border: none; border-bottom: 1px solid var(--vicses-charcoal); position: relative; padding-left: 115px; }
    td:last-child { border-bottom: none; }
    td::before {
        content: attr(data-label); position: absolute; left: 8px; width: 100px;
        padding-right: 10px; white-space: nowrap; text-align: left;
        font-weight: bold; color: var(--vicses-orange);
    }
    th:nth-child(1), td:nth-child(1),
    th:nth-child(2), td:nth-child(2) {
      min-width: 0; max-width: none; width: auto; white-space: normal;
    }
    .footer-container { flex-direction: column; align-items: flex-start; gap: 5px; }
    .modal-message-followup { margin-left: 15px; }
}
