/* Dark Theme & ROHA XR Inspired Styling - MOBILE FIRST */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #202124;
    color: #e8eaed;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    font-size: 14px; /* Base font for mobile */
}

header {
    background-color: #282a2d;
    color: #e8eaed;
    padding: 0.6rem 0;
    border-bottom: 1px solid #3c4043;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
    padding: 0 10px; /* Mobile padding for header content */
}

header h1 { /* #realtorName */
    margin: 0;
    font-size: 1.1em;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    margin-right: 10px;
}

#installAppButton {
    background-color: #007bff; /* EXAMPLE ROHA XR Blue - CHANGE THIS */
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

#installAppButton:hover {
    opacity: 0.85;
}

main {
    padding-top: 15px;
    padding-bottom: 15px;
    /* flex-grow: 1; */ /* MODIFIED: Removed, or set to 0. Let content dictate height. */
    width: 100%;
    box-sizing: border-box;
}

/* MOBILE FIRST: Wrapping grid for tours */
#tourListContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;   /* Crucial for independent card heights */
    column-gap: 10px;
    row-gap: 3px;     /* Adjust this for desired space between rows */
    padding: 0 10px;
    box-sizing: border-box;
}

.tour-card {
    background-color: #2d2e30;
    border: 1px solid #3c4043;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: calc(50% - 5px);
    box-sizing: border-box;
    transition: transform 0.2s ease-in-out;
}

.tour-card:hover {
    transform: translateY(-3px);
}

.tour-card img.thumbnail {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-bottom: 1px solid #3c4043;
}

.tour-card .card-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Keeps title and buttons packed at the top */
}

.tour-card h3 {
    margin-top: 0;
    margin-bottom: 6px;
    color: #e8eaed;
    font-size: 0.85em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.tour-card .buttons-container {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

.tour-card a.launch-button,
.tour-card button.delete-button {
    flex-grow: 1;
    background-color: #007bff;
    color: white;
    padding: 5px 7px;
    text-decoration: none;
    border-radius: 3px;
    text-align: center;
    border: none;
    cursor: pointer;
    font-size: 0.75em;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    font-weight: 500;
}

.tour-card a.launch-button:hover,
.tour-card button.delete-button:hover {
    opacity: 0.85;
}

.tour-card button.delete-button {
    background-color: #4a4c4f;
}

.loading-message, .no-tours-message {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #9aa0a6;
    padding: 30px 0;
    font-size: 1em;
    flex-basis: 100%;
}

footer {
    text-align: center;
    padding: 15px;
    background-color: #282a2d;
    color: #9aa0a6;
    border-top: 1px solid #3c4043;
    font-size: 0.8em;
    margin-top: auto; /* ADDED: This pushes the footer down */
}

/* Modal Styling (no changes) */
.modal {
    position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto; background-color: rgba(0,0,0,0.75); display: flex;
    align-items: center; justify-content: center; padding: 15px; box-sizing: border-box;
}
.modal-content {
    background-color: #3a3b3d; color: #e8eaed; padding: 20px 25px; border: 1px solid #555;
    width: 100%; max-width: 400px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    position: relative; text-align: left; box-sizing: border-box;
}
.modal-content h2 { margin-top: 0; margin-bottom: 15px; font-size: 1.3em; color: #fff; text-align: center; }
.modal-content p { font-size: 0.95em; line-height: 1.6; margin-bottom: 15px; text-align: center; }
.modal-content ol { padding-left: 25px; margin-bottom: 20px; font-size: 0.9em; }
.modal-content ol li { margin-bottom: 10px; line-height: 1.5; }
.modal-content .inline-icon { display: block; width: 48px; height: 48px; margin: 10px auto 15px auto; object-fit: contain; }
.close-button {
    color: #b0b0b0; position: absolute; top: 10px; right: 15px; font-size: 28px;
    font-weight: bold; line-height: 1; padding: 0; background: none; border: none; cursor: pointer;
}
.close-button:hover, .close-button:focus { color: #fff; text-decoration: none; }
#modalOkButton {
    background-color: #007bff;
    color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;
    font-size: 1em; font-weight: 500; display: block; margin: 25px auto 0 auto;
    width: 60%; max-width: 180px; transition: opacity 0.2s ease;
}
#modalOkButton:hover { opacity: 0.85; }


/* --- DESKTOP AND LARGER TABLET STYLES --- */
@media (min-width: 768px) {
    body {
        font-size: 15px;
    }
    .header-content {
        padding: 0 20px;
        max-width: 1600px;
    }
    header h1 {
        font-size: 1.6em;
    }
    #installAppButton {
        font-size: 0.9em;
        padding: 8px 15px;
    }

    main { /* For desktop, if you want main to take available space, re-add flex-grow */
        flex-grow: 1;
    }

    #tourListContainer {
        display: flex;
        flex-wrap: nowrap;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
        height: 270px;
    }
    #tourListContainer::-webkit-scrollbar {
        height: 8px;
        background-color: #202124;
    }
    #tourListContainer::-webkit-scrollbar-thumb {
        background-color: #4a4c4f;
        border-radius: 4px;
    }
    #tourListContainer {
      scrollbar-width: thin;
      scrollbar-color: #4a4c4f #202124;
    }

    .tour-card {
        width: 220px;
        height: 240px;
        flex-shrink: 0;
    }

    .tour-card .card-content {
        flex-grow: 1;
        justify-content: space-between;
        padding: 8px;
    }

    .tour-card img.thumbnail {
        height: 140px;
    }
     .tour-card h3 {
        font-size: 1em;
        margin-bottom: 6px;
        line-height: normal;
    }

    .tour-card .buttons-container {
        margin-top: 6px;
    }

    .tour-card a.launch-button,
    .tour-card button.delete-button {
        font-size: 0.85em;
        padding: 6px 10px;
    }
    .loading-message, .no-tours-message {
        flex-basis: auto;
    }
}