/* --- General Styles --- */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: white;
    /* Darker gray for contrast */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

body.no-scroll {
    overflow: hidden;
    /* For expanded box, preventing main page scroll */
}

/* --- Admin Panel (Keep if needed, otherwise remove) --- */

.admin-div {
    position: absolute;
    /* Consider if absolute positioning is truly necessary */
    display: flex;
    margin: 100px 20px 20px;
    /* Simplify margin */
    padding: 10px 0;
    z-index: 100;
    border-radius: 26px;
    background: #555;
    border: 2px solid #007bff;
    /* Simplify border */
    justify-content: center;
}

.admin-page {
    text-decoration: none;
    background: #555;
    color: oldlace;
}

/* --- Container & Menu --- */

.container {
    transition: transform 0.6s ease;
}

.container.menu-open {
    transform: translateX(200px);
}

.container.menu-open #myLinks {
    display: block;
}

.container.menu-open .header .logo {
    margin-left: 10px;
    /* Space for the open menu */
}

.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 998;
    cursor: pointer;
    background: rgb(0, 0, 0);

    /* Keep display block, but start fully transparent */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* When menu opens, fade in the backdrop */
.menu-backdrop.menu-open {
    opacity: 0.5;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.container.menu-open+.menu-backdrop {
    /* Show backdrop when menu is open */
    display: block;
}

.menu button {
    /*  Login button in the menu */
    position: fixed;
    bottom: 30px;
    width: calc(100% - 40px);
    right: 20px;
}

.footer {
    position: fixed;
    bottom: -15px;
    /*  Consider removing negative margin */
    color: #fff;
    font-size: 10px;
    text-align: center;
    /*Added text align center*/
}

/* --- Main Section --- */

.main {
    position: relative;
    /* Important for positioning child elements */
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
    top: 10vw;
    /*  Consider if this offset is necessary */
    justify-content: center;
    /* Horizontally center the boxes */
    align-items: center;
    /* Vertically center items, esp. useful if heights vary */
}

/* --- Box Styles --- */

.box {
    width: 90%;
    height: 100px;
    background-color: white;
    color: #000;
    /* Ensure text is black */
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease-in-out, top 0.5s ease-in-out;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border: 1px solid #ccc;
    /* Add border for definition */
}

.box.expanded h3 {
    font-size: 24px;
    color: #333;
    margin-top: 11vh;
}

/* Hover effect *only* when NOT expanded */
.box:not(.expanded):hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
}

.box.expanded {
    position: absolute;
    width: 100vw;
    margin-top: -7vh;
    height: 110vh;
    border-radius: 0;
    box-shadow: none;
    z-index: 10;
    left: 0;
    background-color: #ffffff !important;
    /* Force solid white when expanded */
    /*  top: 0;  REMOVE THIS.  JavaScript will handle positioning. */
}

/* Hide other boxes when one is expanded */
.main.box-expanded .box:not(.expanded) {
    opacity: 0;
    transform: translateY(100vh) scale(0.9);
    pointer-events: none;
}

.box-content {
    opacity: 0;
    visibility: hidden;
    text-align: center;
    transition: all 0.3s ease-in-out;
    display: flex;
    /* Make .box-content a flex container */
    flex-direction: column;
    /* Stack children vertically */
    margin-top: 50vh;
    align-items: center;
    /* Center horizontally */
    width: 100%;
    /* Ensure it fills the box */
    height: 100%;
}

.box.expanded .box-content {
    opacity: 1;
    visibility: visible;
}

.bus-item {
    display: table-row;
    width: 90%;
    margin-top: 10px;
    padding: 10px;
}

/* --- Back Button --- */

.back-btn {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    background: #ff4b4b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 11;
    /* Ensure it's above the expanded box */
}

.expanded .back-btn {
    display: block;
    /* Show when expanded */
}

/* --- Dropdown Styles --- */

.dropdown-container {
    position: relative;
    width: 80%;
    /*  Consistent width */
    margin: 10px 0;
    /*  Spacing */
}

.dropdown-input,
.search-input {
    /*  Combine common styles */
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    display: block;
    /*For search input*/
}

.dropdown-menu,
.result-list {
    position: absolute;
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    /*  Hidden by default */
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    list-style: none;
    /* For result list */
    padding: 0;
    /* For result list */
    margin-top: 10px;
    /*For result list*/
}

.dropdown-item,
.result-list li {
    /*  Style list items similarly */
    padding: 8px;
    cursor: pointer;
    text-align: left;
}

.dropdown-item:hover,
.result-list li:hover {
    background: #f0f0f0;
}

.expanded .search-input,
.expanded .result-list {
    display: block;
}

/* --- Search Button --- */

.btn {
    padding: 10px 20px;
    background: blue;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 5px;
}

.btn:disabled {
    background: gray;
    cursor: not-allowed;
}

/* --- Result Display --- */
.bus-item {
    display: block;
    /* Use block for easy left-alignment */
    width: 100%;
    /* Control width */
    margin: 10px -10px;
    /* Center horizontally (auto left/right margins) */
    padding: 10px;
    text-align: left;
    /* Left-align the text within */
    border-top: 1px solid #eee;
    /* Subtle separator */
}

/* ---  Hide Title on Expand --- */
.box h3 {
    position: absolute;
    top: 13px;
    /*Consistent positioning */
    font-size: 20px;
    transition: all 0.3s ease;
    margin: 0;
    /*Remove margin*/
    color: black;
    /*Removed # symbol*/
}

/* --- Responsive Styles --- */

@media (max-width: 600px) {
    .box {
        width: 95%;
        /*  Full width on small screens */
    }
}

/* --- Box Background Colors (Optional - Keep if needed) --- */

#privateBus {
    background-color: #e0f2fe;
    /* Light Blue */
}

#publicBus {
    background-color: #ffedd5;
    /* Light Orange */
}

#travelAgency {
    background-color: #fee2e2;
    /* Light Red */
}

/* Public Bus items */
.BusServices {
    max-height: 650px;
    /* Adjust based on your layout */
    overflow-y: auto;
    /* Enables vertical scrolling */
    overflow-x: hidden;
    /* Hides horizontal scrolling */
    scrollbar-width: thin;
    /* For Firefox */
    scrollbar-color: #888 #00000000;
    /* Scrollbar styling for Firefox */
}

/* Custom scrollbar for WebKit browsers (Chrome, Edge, Safari) */
.BusServices::-webkit-scrollbar {
    width: 8px;
    /* Width of scrollbar */
}

.BusServices::-webkit-scrollbar-thumb {
    background-color: #888;
    /* Color of the scroll thumb */
    border-radius: 4px;
    /* Round corners */
}

.BusServices::-webkit-scrollbar-track {
    background: #00000000;
    /* Background of scrollbar track */
}

/* Public Bus item box background */
.item {
    width: 500px;
    height: 150px;
    border: 1px solid #000;
    border-radius: 10px;
    margin: 10px;
}

#item-1 {
    background-color: #00000040;
}

#item-2 {
    background-color: #00000020;
}

#item-3 {
    background-color: #00000040;
}

#item-4 {
    background-color: #00000020;
}

#item-5 {
    background-color: #00000040;
}

/* Public Bus items */
.travelServices {
    max-height: 650px;
    /* Adjust based on your layout */
    overflow-y: auto;
    /* Enables vertical scrolling */
    overflow-x: hidden;
    /* Hides horizontal scrolling */
    scrollbar-width: thin;
    /* For Firefox */
    scrollbar-color: #888 #00000000;
    /* Scrollbar styling for Firefox */
}

/* Custom scrollbar for WebKit browsers (Chrome, Edge, Safari) */
.travelServices::-webkit-scrollbar {
    width: 8px;
    /* Width of scrollbar */
}

.travelServices::-webkit-scrollbar-thumb {
    background-color: #888;
    /* Color of the scroll thumb */
    border-radius: 4px;
    /* Round corners */
}

.travelServices::-webkit-scrollbar-track {
    background: #00000000;
    /* Background of scrollbar track */
}

/* Scrollable Bus Results */
#direct-bus-data,
#connected-bus-data {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #888 #00000000;
    margin-top: 10px;
}

#direct-bus-data::-webkit-scrollbar,
#connected-bus-data::-webkit-scrollbar {
    width: 8px;
}

#direct-bus-data::-webkit-scrollbar-thumb,
#connected-bus-data::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

#direct-bus-data::-webkit-scrollbar-track,
#connected-bus-data::-webkit-scrollbar-track {
    background: #00000000;
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-bar-container {
    width: 300px;
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid #ccc;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* --- Entry Animations (Disabled while loading screen is off) --- */
.main {
    opacity: 1;
    /* Was 0, set to 1 so content is visible */
    transition: opacity 0.8s ease-out;
}

.main.visible {
    opacity: 1;
}

.box {
    opacity: 1;
    /* Was 0, set to 1 so boxes are visible */
    transform: translateY(0);
    /* Was translateY(30px), removed offset */
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.box.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delays */
.box:nth-child(1) {
    transition-delay: 0.1s;
}

.box:nth-child(2) {
    transition-delay: 0.2s;
}

.box:nth-child(3) {
    transition-delay: 0.3s;
}

/* --- Error Toast --- */
.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #ff4b4b;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* --- Menu Styles --- */
#myLinks {
    position: fixed;
    top: 0;
    left: -200px;
    /* Start off-screen */
    width: 200px;
    height: 100vh;
    background-color: #333;
    color: white;
    z-index: 1000;
    transition: transform 0.6s ease;
    padding-top: 60px;
    display: block;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
}

#myLinks a {
    padding: 10px 15px;
    text-decoration: none;
    font-size: 18px;
    color: #f1f1f1;
    display: block;
    transition: 0.3s;
}

#myLinks a:hover {
    color: #fff;
    background-color: #555;
}

#myLinks.hidden {
    display: none;
}

/* Ensure container moves with menu */
.container.menu-open {
    transform: translateX(200px);
}