*, *::before, *::after {
    box-sizing: border-box;
}

/* --- ADDED: Disable native pull-to-refresh --- */
html, body {
    overscroll-behavior-y: contain;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    overflow-x: hidden; /* Added to prevent all horizontal scrolling */
}

/* --- ADDED: Pull to Refresh Indicator Styles --- */
#pull-to-refresh-indicator {
    position: fixed;
    top: -50px; /* Initially hidden above the viewport */
    left: 0;
    right: 0;
    height: 50px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 1080; /* Increased to appear over the header */
    transition: top 0.2s ease-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #333;
    font-weight: bold;
}

.ptr-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #ced4da;
    border-top-color: #007bff;
    border-radius: 50%;
    transition: transform 0.3s;
}

#pull-to-refresh-indicator.refreshing .ptr-spinner {
    animation: spin 1s linear infinite;
}
/* --- END: Pull to Refresh Indicator Styles --- */

header {
    background-color: #007bff;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1010;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.desktop-user-nav .user-info {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}
.user-info .header-link {
    color: #fff;
    text-decoration: underline;
}
.header-btn {
    background-color: transparent;
    border: 1px solid white;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}
.header-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

/* --- Notification Area --- */
.notification-area {
    position: relative;
    display: inline-block;
}
.notification-btn {
    position: relative;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    border: 2px solid white;
}
.notification-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 350px;
    z-index: 1020;
    overflow: hidden;
}
.notification-panel.open {
    display: block;
}
.notification-panel-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notification-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.notification-actions button {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
    padding: 0;
}
.notification-actions button:hover {
    text-decoration: underline;
}
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}
.notification-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s;
}
.notification-item.unread {
    background-color: #f8f9fa;
    cursor: pointer;
}
.notification-item.unread:hover {
    background-color: #e9ecef;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item-title {
    font-weight: bold;
    margin-bottom: 5px;
    pointer-events: none; /* Make sure click goes to parent */
}
.notification-item-body {
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95rem;
    pointer-events: none; /* Make sure click goes to parent */
}
.notification-item-time {
    font-size: 0.8rem;
    color: #888;
    align-self: flex-end;
    pointer-events: none; /* Make sure click goes to parent */
}
.notification-list .no-notifications {
    padding: 2rem;
    text-align: center;
    color: #777;
}
/* --- End Notification Area --- */

.controls-bar {
    padding: 1rem;
    background-color: #f8f9fa;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.view-toggle button, .desktop-filters-btn, #toggle-filters-btn-mobile, .refresh-data-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 0 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.view-toggle button:hover, .desktop-filters-btn:hover, #toggle-filters-btn-mobile:hover, .refresh-data-btn:hover {
    background-color: #5a6268;
}

.view-toggle button.active, .desktop-filters-btn.active, #toggle-filters-btn-mobile.active {
    background-color: #007bff;
    font-weight: bold;
}

/* --- New Filter Modal --- */
.filter-modal {
    display: none; /* Hidden by default */
    position: fixed;
    /* FIX: Increased z-index to ensure it appears over the mobile nav header */
    z-index: 1070;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.filter-modal.open {
    display: flex;
}

.filter-panel {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.filter-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

#close-filters-btn {
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    line-height: 1;
}

.filter-content {
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.filter-section {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
}

.filter-section:not(:last-child) {
    border-bottom: 1px solid #eee;
}


.filter-section > label {
    font-weight: bold;
    color: #333;
    padding-left: 5px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    width: 100%;
}

.filter-btn {
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 20px;
    background-color: #808080;
    color: #e6e6e6;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    font-size: 0.95em;
}
.filter-btn:hover {
    background-color: #707070;
}

.filter-btn.selected {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}


.filter-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    text-align: right;
    flex-shrink: 0;
    background-color: #f8f9fa;
}

#apply-filters-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}
#apply-filters-btn:hover {
    background-color: #0056b3;
}

/* --- End Filter Modal --- */

main {
    padding: 0 20px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.loader-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 50px;
    color: #555;
    font-size: 1.2em;
}

.loader-spinner {
    border: 8px solid #e0e0e0;
    border-top: 8px solid #007bff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1.5s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.park-section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    padding: 20px;
}

.park-section h2, .park-table-section h2 {
    color: #0056b3;
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    position: relative;
    user-select: none;
    padding-right: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.park-header-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.park-hours {
    font-size: 0.75rem;
    font-weight: 500;
    color: #495047;
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 10px;
    margin-left: 10px;
    white-space: nowrap;
}

/* --- Park Header Accordion Styles --- */
.park-section h2::after, .park-table-section h2::after {
    content: '▲';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}

.park-section.collapsed h2::after, .park-table-section.collapsed h2::after {
    transform: translateY(-50%) rotate(180deg);
}

.park-section.collapsed .rides-grid,
.park-table-section.collapsed > table {
    display: none;
}
/* --- End Accordion Styles --- */

.rides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* --- UPDATED CARD STYLES --- */
.ride-item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    overflow: hidden; /* Prevent children from breaking out */
}

.ride-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.ride-item-main {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.ride-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.ride-title {
    margin: 0;
    font-size: 1.1em;
    /* Key fix for preventing overflow */
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0; /* This is the magic property */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ride-wait-time {
    font-weight: bold;
    font-size: 1.1em;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.ride-wait-time .distance-info {
    font-size: 0.8em;
    font-weight: normal;
    color: #555;
    margin-top: 2px;
}

.low-wait .ride-wait-time { background-color: #d4edda; color: #155724; }
.medium-wait .ride-wait-time { background-color: #fff3cd; color: #856404; }
.high-wait .ride-wait-time { background-color: #f8d7da; color: #721c24; }
.no-wait-info .ride-wait-time { background-color: #e2e3e5; color: #383d41; }
.closed .ride-wait-time, .down .ride-wait-time, .refurbishment .ride-wait-time {
    background-color: transparent;
    color: inherit;
}
.show-times .ride-wait-time {
    background-color: #d1ecf1;
    color: #0c5460;
    font-size: 0.9em;
    white-space: normal;
    text-align: right;
    line-height: 1.4;
    flex-shrink: 1;
    flex-direction: row;
    flex-wrap: wrap;
}


/* Status border colors */
.ride-item.operating { border-left: 5px solid #28a745; }
.ride-item.closed { border-left: 5px solid #dc3545; background-color: #ffebeb; }
.ride-item.down { border-left: 5px solid #ffc107; background-color: #fff8e1; }
.ride-item.refurbishment { border-left: 5px solid #6c757d; background-color: #e9ecef;}

.set-alert-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    margin-left: 10px;
}

.set-alert-btn:hover {
    background-color: #0056b3;
}

.set-alert-btn.alert-is-set {
    background-color: #ffc107;
    color: #333;
}
.set-alert-btn.alert-is-set:hover {
    background-color: #e0a800;
}

/* --- Log Visit Button --- */
.log-visit-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: #17a2b8; /* info blue/teal */
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    margin-left: 10px;
}
.log-visit-btn:hover {
    background-color: #138496;
}

.log-visit-btn-table {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #17a2b8;
    background-color: white;
    color: #17a2b8;
    cursor: pointer;
    margin-left: 5px;
}
.log-visit-btn-table:hover {
    background-color: #e2f4f7;
}

.park-section h2 .log-park-visit-btn, 
.park-table-section h2 .log-park-visit-btn {
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    background-color: #17a2b8;
    padding: 4px 10px;
    border-radius: 10px;
    margin-left: 10px;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}
.park-section h2 .log-park-visit-btn:hover,
.park-table-section h2 .log-park-visit-btn:hover {
    background-color: #138496;
}


/* --- MODAL STYLES (including PWA modal) --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 1090; /* High z-index to cover everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    -webkit-tap-highlight-color: transparent;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    text-align: center;
    position: relative;
}

/* Log Modal Form Styles */
#log-visit-form {
    text-align: left;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
#log-visit-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
#log-visit-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #555;
    font-size: 0.9em;
}
#log-visit-form input,
#log-visit-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}
#log-visit-form .status-message {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: bold;
    min-height: 1.2em;
}


#pwa-install-modal .modal-content {
    text-align: left;
    padding: 30px;
}

#pwa-install-modal h2 {
    text-align: center;
    margin-top: 0;
}

#pwa-install-modal p {
    line-height: 1.6;
    margin-bottom: 20px;
}

#install-instructions {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

#install-instructions p {
    margin: 0 0 10px 0;
}

#install-instructions strong {
    color: #0056b3;
}

.close-btn {
    color: #6c757d;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover, .close-btn:focus { color: black; }

.wait-time-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.wait-time-btn {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #e0e0e0; 
    color: #000000;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.wait-time-btn:hover { 

    background-color: #474849;
    border-color: #999;

}

.wait-time-btn:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    text-decoration: line-through;
}

.wait-time-btn.selected {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.modal-content button, .danger-btn, .modal-action-btn {
    padding: 12px 25px;
    font-size: 1.1em;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

.modal-content form button[type="submit"] { background-color: #28a745; }
.modal-content form button[type="submit"]:disabled { background-color: #999; cursor: not-allowed; }
.danger-btn { background-color: #dc3545; }
.danger-btn:hover { background-color: #c82333; }
.modal-action-btn { background-color: #007bff; }
.modal-action-btn:hover { background-color: #0056b3; }

.modal-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 25px 0;
}

.alert-option-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}


/* Table View Styles */
#table-parks-container { max-width: 1200px; margin: 0 auto 20px; }
.park-table-section { background-color: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 15px; padding: 20px; overflow-x: auto;}
.park-table-section table { width: 100%; border-collapse: collapse; }
.park-table-section th, .park-table-section td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e0e0e0; }
.park-table-section th { background-color: #007bff; color: white; font-weight: bold; cursor: pointer; position: relative; }
.park-table-section th:hover { background-color: #0056b3; }
.park-table-section th .sort-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.8em; }
.park-table-section tbody tr:nth-child(even) { background-color: #f8f8f8; }
.park-table-section tbody tr:hover { background-color: #eef; }
.set-alert-btn-table {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #007bff;
    background-color: white;
    color: #007bff;
    cursor: pointer;
}
.set-alert-btn-table.alert-is-set {
    background-color: #ffc107;
    border-color: #e0a800;
    color: #333;
}


/* Manage All Alerts Modal Styles */
#all-alerts-list {
    margin-top: 20px;
    margin-bottom: 30px;
    text-align: left;
}
.alert-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
}
.alert-list-item.global-alert-item {
    background-color: #f8f9fa;
    border-left: 4px solid #17a2b8;
}
.alert-list-item:last-child { border-bottom: none; }
.alert-item-name { font-weight: bold; }
.alert-item-condition { color: #555; }
.alert-item-controls button {
    margin-left: 8px;
    padding: 4px 8px;
    font-size: 0.9em;
    border-radius: 4px;
    cursor: pointer;
}
.alert-item-controls .edit-btn { border: 1px solid #007bff; background: #fff; color: #007bff; }
.alert-item-controls .delete-btn { border: 1px solid #dc3545; background: #fff; color: #dc3545; }

/* Settings Modal Styles */
#settings-content {
    margin-top: 20px;
    text-align: left;
}
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}
.setting-item:last-child {
    border-bottom: none;
}
.setting-item label {
    font-size: 1.1em;
    color: #333;
}
.setting-item input[type="checkbox"] {
    transform: scale(1.5); /* Make checkbox bigger */
    cursor: pointer;
}
.setting-item-child {
    padding-left: 25px;
    padding-top: 15px;
}
.setting-item-child > label {
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}


footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: #777;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

/* --- Refresh Controls --- */
.refresh-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.last-updated-display {
    font-size: 0.85em;
    color: #6c757d;
    text-align: center;
    line-height: 1.2;
}

.refresh-data-btn svg {
    transition: transform 0.3s ease;
}

.refresh-data-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

#manual-refresh-btn-mobile, 
#manual-refresh-btn-desktop {
    width: 38px;
    height: 38px;
    padding: 8px;
    margin: 0;
}

/* Auth Page Styles */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; box-sizing: border-box; }
.auth-form { width: 100%; max-width: 400px; padding: 30px; background-color: white; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.auth-form h2 { text-align: center; color: #0056b3; margin-top: 0; margin-bottom: 25px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: bold; color: #555; }
.form-group input { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; transition: border-color 0.3s; }
.form-group input:focus { outline: none; border-color: #007bff; }
.auth-form button[type="submit"] { width: 100%; padding: 12px; border: none; border-radius: 5px; background-color: #007bff; color: white; font-size: 1.1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s; }
.auth-form button[type="submit"]:hover { background-color: #0056b3; }
.form-footer { text-align: center; margin-top: 20px; font-size: 0.9em; }
.form-footer a { color: #007bff; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }
.message-area { padding: 10px; margin-bottom: 15px; border-radius: 5px; text-align: center; font-weight: bold; }
.message-area.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message-area.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}
.auth-divider span {
    background-color: white;
    padding: 0 10px;
    position: relative;
    z-index: 1;
    color: #6c757d;
    font-weight: bold;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #dee2e6;
    z-index: 0;
}
.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    padding: 10px;
    border: 1px solid #dadce0;
    border-radius: 5px;
    background-color: #fff;
    color: #3c4043;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s;
    font-family: 'Roboto', sans-serif; /* Recommended by Google */
}
.google-login-btn:hover {
    background-color: #f8f9fa;
    border-color: #c6c9ce;
}
.google-login-btn svg {
    flex-shrink: 0;
}



/* --- Hamburger and Nav Menu --- */
.hamburger-menu {
    display: none; 
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}
.hamburger-menu span {
    width: 30px;
    height: 3px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s linear;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    background: #0056b3;
    height: 100%;
    padding: 2rem;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%);
    width: 80%;
    max-width: 300px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
}
.mobile-nav.open { transform: translateX(0); }
.mobile-user-info {
    padding-bottom: 1rem;
    text-align: center;
}
.user-email-mobile {
    display: block;
    margin-bottom: 1rem;
    font-weight: bold;
    color: #fff;
    word-wrap: break-word;
}
.mobile-nav-link {
    font-size: 1.2rem;
    padding: 1rem 0.5rem;
    font-weight: bold;
    color: #FFF;
    text-decoration: none;
    transition: color 0.3s linear;
    display: block;
}
.mobile-nav-link:hover { color: #00c040; }
.mobile-nav-divider {
    border: 0;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin: 0;
}
#mobile-install-link {
    display: none; /* Hidden by default, shown by JS if app is installable */
}
.close-nav-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}

/* --- Mobile Sort Controls --- */
.mobile-sort-controls {
    display: none; /* Hidden by default */
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.mobile-sort-controls .sort-label {
    font-size: 0.9em;
    color: #555;
    font-weight: bold;
    margin-right: 5px;
}
.mobile-sort-controls .sort-btn, .desktop-controls .sort-btn {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
}
.mobile-sort-controls .sort-btn.active, .desktop-controls .sort-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
.mobile-sort-controls .sort-direction-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    line-height: 1;
}

.mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mobile-bottom-bar {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 10px;
    align-items: center;
}

#toggle-filters-btn-mobile {
    flex-grow: 1;
    max-width: 170px;
}

.mobile-bottom-bar .refresh-container {
    flex: 1;
    display: flex;
    justify-content: center;
}
.mobile-bottom-bar #toggle-filters-btn-mobile {
    flex: 1;
}

.refresh-location-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1;
}
.refresh-location-btn:hover {
    background-color: #0056b3;
}

.sort-btn .refresh-icon {
    display: none;
    width: 14px;
    height: 14px;
    margin-left: 6px;
}

.sort-btn.active[data-sort="nearest"] .refresh-icon {
    display: inline-block;
}

.sort-btn.locating .refresh-icon {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.mobile-controls-wrapper {
    display: none;
    align-items: center;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

.desktop-controls {
    display: none;
    align-items: center;
    gap: 10px;
}

/* --- Responsive adjustments --- */
@media (max-width: 600px) {
    main {
        padding-left: 0;
        padding-right: 0;
    }
    
    .park-section {
        border-radius: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .park-section h2, .park-table-section h2 {
        padding-left: 15px;
        padding-right: 30px;
    }

    .rides-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .ride-item {
        padding: 12px;
    }
    .ride-title {
        font-size: 1.05em;
    }
    .ride-wait-time {
        font-size: 1.05em;
    }

    /* Mobile specific card styling for expand/collapse */
    .ride-item .ride-item-details {
        display: none;
    }
    
    .ride-item.expanded .ride-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    
    .ride-item.expanded .ride-item-details {
        display: flex;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-sizing: border-box;
        padding: 2rem;
        overflow-y: auto;
    }
}


@media (max-width: 820px) {
    .hamburger-menu {
        display: flex;
    }
    .desktop-user-nav {
        display: none;
    }
    .view-toggle, .desktop-controls {
        display: none;
    }
    .mobile-controls-wrapper {
        display: flex;
    }
    .mobile-sort-controls {
        display: flex;
    }
    .controls-bar {
        padding: 0.75rem 1rem;
        gap: 1rem;
        justify-content: space-between;
    }
    header {
        padding: 1rem;
    }
    .header-left {
        flex-grow: 1;
        min-width: 0; /* Prevent flex item from overflowing */
    }
    .header-content-wrapper {
        flex-grow: 1;
        text-align: center;
    }
    header h1 {
        font-size: 1.2rem;
        white-space: normal; /* Allow title to wrap */
        display: inline-block;
    }
    
    /* Responsive Table Styles */
    .park-table-section {
        overflow-x: hidden;
    }
    .park-table-section thead {
        display: none;
    }
    .park-table-section tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    .park-table-section td {
        display: block;
        text-align: right;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
    }
    .park-table-section td:last-child {
        border-bottom: 0;
    }
    .park-table-section td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: bold;
        text-align: left;
    }
}

@media (min-width: 821px) {
    .hamburger-menu {
        display: flex;
    }
    
    .mobile-controls-wrapper {
        display: none !important;
    }

    .desktop-controls {
        display: flex;
    }
    
    .desktop-controls .sort-btn {
        padding: 10px 20px;
    }

    /* Style the nav menu as a dropdown on desktop */
    .mobile-nav {
        transform: none;
        display: none; /* Hide by default on desktop */
        position: absolute;
        top: 60px; /* Position below the header */
        left: 1rem;
        width: 280px;
        height: auto;
        background: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 8px;
        padding: 0.5rem;
    }

    .mobile-nav.open {
        display: block; /* Show it when open */
        transform: none; /* Override mobile transform */
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }


    /* Adjust link colors for the light background */
    .mobile-nav .mobile-nav-link,
    .mobile-nav .user-email-mobile,
    .mobile-nav .user-info a {
        color: #333;
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }

    .mobile-nav .mobile-nav-link:hover {
        color: #007bff;
        background-color: #f0f0f0;
        border-radius: 4px;
    }
    
    .mobile-nav .mobile-nav-divider {
        border-color: #eee;
    }

    /* Hide the mobile-specific elements on desktop */
    .mobile-nav .close-nav-btn {
        display: none;
    }
}


/* --- ADDED: Log History Panel Styles --- */
.log-history-panel {
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    width: 100%;
    max-width: 480px;
    height: 100%;
    background-color: #f0f2f5;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2);
    z-index: 1060; /* Above nav, below modals */
    transition: right 0.4s ease-in-out;
    display: flex;
    flex-direction: column;
}
.log-history-panel.open {
    right: 0;
}
.log-history-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.log-history-header h2 {
    margin: 0;
    font-size: 1.25rem;
}
.log-history-panel .close-btn {
    position: static;
    font-size: 2rem;
}
#log-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}
#log-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#log-filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    background-color: #e2e8f0;
    padding: 4px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
#log-filter-controls .filter-btn {
    flex-grow: 1;
    padding: 6px 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background-color: transparent;
    color: #4a5568;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
#log-filter-controls .filter-btn.active-filter {
    background-color: #ffffff;
    color: #1a202c;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.log-entry {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background-color: #ffffff;
    transition: box-shadow 0.2s;
}
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}
.log-title { font-weight: bold; font-size: 1.1rem; color: #333; }
.log-subtitle { font-size: 0.9rem; color: #666; }
.log-details { font-size: 0.95rem; color: #333; padding-bottom: 0.75rem; border-bottom: 1px solid #eee; }
.log-details strong { color: #111; }
.log-notes { margin-top: 0.75rem; font-size: 0.9rem; color: #444; white-space: pre-wrap; word-break: break-word; }

.log-actions { display: flex; align-items: center; gap: 8px; }
.log-actions button { background: none; border: none; cursor: pointer; padding: 0.25rem; color: #6c757d; }
.log-actions button:hover { color: #007bff; }
.log-actions .edit-btn:hover { color: #28a745; }
.log-actions .delete-btn:hover { color: #dc3545; }

/* --- FIX: Added rule to define SVG icon size --- */
.log-actions button svg {
    width: 20px;
    height: 20px;
    pointer-events: none; /* Ensures the click event is registered on the button */
}


.inline-edit-container {
    background-color: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}
.inline-edit-form {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.inline-edit-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.inline-edit-form label { display: block; margin-bottom: 0.25rem; font-weight: 500; color: #555; font-size: 0.9em; }
.inline-edit-form input, .inline-edit-form textarea, .inline-edit-form .choices__inner {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; 
    background-color: #fff;
}
.inline-edit-form .choices__list--dropdown { z-index: 50; }
.inline-edit-form input[readonly] { background-color: #e9ecef; cursor: not-allowed; }