* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    min-height: 100vh; 
    padding-top: 4em;
}

header {
//    background-color: #007bff;
    background-color: #ff9914;
    color: white;
    text-align: center;
    padding: 1rem;
//    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 3;
}

header h1 {
    font-size: larger;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 3em;
}

#location-section {
    text-align: center;
    margin-bottom: 1rem;
}

#getLocationBtn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#getLocationBtn:hover {
    background-color: #218838;
}

#stop-input {
    background-color: white;
//    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 2rem;

}

#stop-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#stop-form label {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

#stop-form input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

#stop-form button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#stop-form button:hover {
    background-color: #0056b3;
}

#results, #nearby-stops-results, #nearby-market-results {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    scroll-margin-top: 5rem;  // adjusted for fixed top nav, init 1rem
}

.hidden {
    display: none;
}

#loading {
    text-align: center;
    padding: 1rem;
    color: #007bff;
    font-weight: bold;
}

#error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

#stoperror {
    color: #721c24;
    text-align: center;
}

#no-results {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    font-style: italic;
}

.arrival-item, .nearby-item, .stopdetail-item, .nearby-market-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.arrival-item:hover {
    background-color: #f8f9fa;
}

.arrival-item:last-child, .nearby-item:last-child, .nearby-market-item:last-child {
    border-bottom: none;
}

.arrival-time, .stop-descript {
    font-weight: bold;
    font-size: 1.1rem;
    color: #007bff;
    min-width: 80px;
    text-align: center;
}

.arrival-route, .stop-route {
    font-weight: bold;
    color: #28a745;
    min-width: 50px;
    text-align: center;
    font-size: larger;
}

.market-name {
    color: #007bff;
    font-size: large;
    font-weight: bold;
}

.arrival-destination {
    flex: 1;
    text-align: left;
    margin-left: 1rem;
}

.imme {
    color: #ff0c2a;
    text-align: center;
}

.notimme {
    text-align: center;
}

#spacer-list {
    padding-bottom: 2em;
}

.stop-road {
    color: grey;
    font-size: smaller;
    text-align: right;
    font-weight: normal;
}

.stop-descript {
    text-align: right;
}

#stop-detail {
    padding-bottom: 1em;
}

.details-list {
    display: flex;
    justify-content: space-between;
}

.details-list-descript {
    font-weight: bold;
    font-size: 1.1rem;
    color: #007bff;
    min-width: 80px;
    text-align: left;

}

.refresh-list {
    position: absolute;
    right: 3rem;
    font-size: x-large;
    margin-top: 7px;
    z-index: 0;
}

.openmart {
    color: green;
    font-size: x-large;
    margin-left: 1rem;
}

.closedmart {
    color: red;
    font-size: x-large;
    margin-left: 1rem;
}

@media (max-width: 320px) {
    main {
        padding: 0.5rem;
    }

    .arrival-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .arrival-time {
        font-size: 1rem;
    }

    .arrival-route {
        font-size: 0.9rem;
    }

    #stop-form {
        gap: 0.5rem;
    }

    #stop-form input,
    #stop-form button {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
//    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);          /* nice glassmorphism */
//    border-top: 1px solid #ddd;
//    z-index: 9999;
}


/* ------------- Bottom Nav ------------- */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);          /* nice glassmorphism */
    border-top: 1px solid #ddd;
    z-index: 9999;
    font-family: system-ui, sans-serif;
}

#bottom-nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    justify-content: space-around;
}

#bottom-nav li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    text-decoration: none;
    color: #333;
    font-size: 0.85rem;
    transition: color 0.2s;
}

#bottom-nav li a:hover,
#bottom-nav li a.active {
    color: #0078d7;            /* adjust to your brand color */
}

#bottom-nav li a span {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

/* ------------- Responsive tweak for smaller screens ------------- */
@media (max-width: 320px) {
    #bottom-nav li a { font-size: 0.75rem; }
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background-color: var(--app-bg, #ff9914);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background-color: var(--app-bg, #ff9914);
    z-index: -1;
    pointer-events: none;
}

