/* Direction Icons and Links */
.get-directions-icon .icon-image {
    margin-right: 18px !important;
}

.get-directions-link {
    margin-left: 18px !important;
}

/* Layout and Structure */
.my-div {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.table-container {
    overflow-y: auto;
}

body {
    padding: 10px;
}

.center {
    text-align: center;
}

.right {
    text-align: right;
}

/* Table Styles */
#inventoryDetailsContainer tbody tr:hover {
    cursor: pointer;
}

.right-justify {
    text-align: right;
    font-weight: bold;
    color: darkred;
    margin-right: 30px;
}

/* UI Elements */
.back-button-margin {
    margin-top: 20px;
}

.logo-container {
    margin-bottom: 20px;
}

/* Fixed Footer Styles */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    font-size: 14px;
    background-color: #f8f8f8;
    border-top: 1px solid #e7e7e7;
    text-align: center;
    z-index: 1000;
    /* Ensure it stays above other content */
}

/* Flex Layout */
html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

main {
    flex: 1;
}

.parent-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    /* Allows scrolling if content is taller */
}

/* Busy Indicator */
#busy-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 9999;
}

/* ONLY CHANGE: Simple table responsive styles */
.table-responsive {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Desktop-specific adjustments */
@media screen and (min-width: 769px) {
    #map {
        height: 250px !important;
    }

    #inventoryDetailsContainer .table-responsive {
        max-height: 300px;
        /* Only set max-height, not fixed height */
    }
}

/* Mobile-specific adjustments */
@media screen and (max-width: 768px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* Original styles */
.text-center {
    text-align: center;
}

.left {
    text-align: left;
}

/* Button group styling */
.button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

/* dont like this
@media screen and (max-width: 480px) {
    .button-group {
        flex-direction: column;
    }
}
*/
/* Disclaimer styling */
.disclaimer {
    margin-top: 10px;
    font-size: smaller;
    color: #666;
    margin-bottom: 60px;
    /* Space for fixed footer */
}

/* Simple scrolling for tables */
.scrollable-table {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 450px;
    /* Adjust as needed */
}

/* Inventory details table needs vertical scroll */
#inventoryDetailsContainer .scrollable-table {
    max-height: 350px;
}

/* Results table might need scrolling with many items */
#resultsContainer .table-container {
    overflow-y: auto;

}

/* Fix for map size */
#map {
    height: 300px !important;
}

/* Keep layout consistent */
#inventoryDetailsContainer,
#resultsContainer {
    display: flex;
    flex-direction: column;
}

/* Ensure buttons are visible */
.button-group,
#backButton {
    position: relative;
    z-index: 5;
}

/* Make the entire body scrollable */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: auto !important;
    /* Override any overflow: hidden */
}

/* Make parent container scrollable */
.parent-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
    /* Space for footer */
}

/* Fix inventory details container */
#inventoryDetailsContainer {
    min-height: min-content;
    /* Ensure it grows with content */
    overflow: visible;
    /* Let content flow naturally */
}

/* Keep footer at bottom without obstructing content */
.footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
}

/* Make sure product image and buttons are visible */
#itemImage {
    max-width: 100%;
    height: auto;
    margin-top: 20px;
    display: block;
}

/* Give space for buttons at bottom */
.button-group {
    margin: 20px 0 40px 0;
}

/* Input field margin/padding */
.input-field {
    margin: 20px 10px;
}

/* Search button spacing */
.text-center {
    margin: 15px 0;
}

/* Better search layout */
#searchContainer {
    padding: 10px;
}

/* Button margin fixes */
#backButton,
.back-button,
.btn.back {
    margin: 15px 0;
    width: 100%;
    max-width: 100%;
}

/* Disclaimer margins */
.disclaimer {
    margin: 15px 0 40px 0;
    padding: 0 10px;
    line-height: 1.4;
    color: #666;
    font-size: 0.9rem;
}

/* Back button styling */
.back,
#backButton {
    display: block;
    text-align: center;
    background-color: #4db6ac;
    color: white;

    border-radius: 4px;
    font-weight: normal;
    width: 100%;
    padding: auto;
    margin: 15px 0;
}

/* Desktop layout for search results - align images right */
@media screen and (min-width: 768px) {

    /* Container for each item */
    #resultsContainer tr,
    #resultsTable tr {
        display: flex;
        align-items: center;
        border-bottom: 1px solid #eee;
        padding: 10px 0;
    }

    /* Product details */
    #resultsContainer tr td:nth-child(2),
    #resultsTable tr td:nth-child(2) {
        flex: 1;
        padding-left: 15px;
    }

    /* Image container */
    #resultsContainer tr td:nth-child(3),
    #resultsTable tr td:nth-child(3) {
        margin-left: auto;
        text-align: right;
        padding-right: 20px;
    }

    /* Button column */
    #resultsContainer tr td:first-child,
    #resultsTable tr td:first-child {
        min-width: 150px;
    }
}

/* Product detail page layout */
.product-detail-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    margin: 20px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.product-info {
    flex: 1;
}

.product-image {
    margin-left: 20px;
    text-align: right;
}

/* Product images - consistent sizing */
#resultsTable img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}

#itemImage {
    max-width: 250px;
    max-height: 250px;
    object-fit: contain;
}

/* Product images on desktop */
@media screen and (min-width: 768px) {

    .product-image img,
    #itemImage {
        max-height: 200px;
        float: right;
        margin-left: 20px;
    }
}

/* Single item page layout - right-align images */
@media screen and (min-width: 768px) {
    .product-row {
        display: flex;
        align-items: center;
        border-bottom: 1px solid #eee;
        padding: 15px 0;
    }

    .product-row .product-info {
        flex: 1;
    }

    .product-row .product-image {
        margin-left: auto;
        text-align: right;
    }

    .product-row .show-locations-btn {
        width: 150px;
        margin-right: 20px;
    }
}

/* Fix for Show Locations button */
.show-locations-btn,
.btn.show-locations {
    width: 150px;
    margin: 10px 0;
    background-color: #4db6ac;
}

/* Add proper spacing around content sections */
#resultsContainer,
#searchContainer,
#inventoryDetailsContainer {
    padding: 10px;
}

#busy-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
}

.dots-container {
    display: flex;
    justify-content: center;
}

.dot {
    width: 12px;
    height: 12px;
    margin: 0 4px;
    background-color: #3498db;
    border-radius: 50%;
    animation: dots 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dots {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* ======= GEOLOCATION STYLES ======= */

/* Location toast styling - integrates with Materialize */
.location-toast {
    border-radius: 4px !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    background-color: #4db6ac !important;
    /* Match your app's color scheme */
}

.location-toast p {
    margin: 0 !important;
    padding: 12px 16px !important;
    color: white !important;
}

.location-toast .toast-action {
    display: flex !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.location-toast .toast-action button {
    flex: 1 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    height: 40px !important;
    line-height: 40px !important;
}

.location-toast .toast-action #allow-location {
    background-color: #26a69a !important;
    /* Materialize teal */
}

.location-toast .toast-action #deny-location {
    background-color: transparent !important;
}

/* Location button - matches your existing button styling */
#locationButton {
    background-color: #4db6ac;
    color: white;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#locationButton i {
    margin-right: 8px;
}

/* Distance column styling - matches your existing right-justify style */
.distance-column {
    font-weight: bold;
    color: #26a69a;
    /* Materialize teal - different from your onHand color */
}

/* User location marker pulse animation */
@keyframes map-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Make location button responsive on small screens */
@media screen and (max-width: 480px) {
    #searchContainer .text-center {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #locationButton {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
}

/* Distance column styling - add this to your styles.css */
.distance-column {
    text-align: right;
    font-weight: bold;
    color: #26a69a;
    /* Materialize teal - different from your onHand color */
    margin-right: 20px;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* Ensure table columns are appropriately sized */
#inventoryDetailsTable th:nth-child(1) {
    width: 60%;
    /* Address column */
}

#inventoryDetailsTable th:nth-child(2) {
    width: 20%;
    /* Distance column */
}

#inventoryDetailsTable th:nth-child(3) {
    width: 20%;
    /* On Hand column */
}

/* Make the table fit nicely on mobile */
@media screen and (max-width: 600px) {
    .get-directions-icon {
        display: inline-block;
        vertical-align: middle;
        margin-right: 5px;
    }

    .get-directions-link {
        display: inline-block;
        vertical-align: middle;
        margin-left: 0 !important;
        font-size: 0.9rem;
        white-space: normal;
        word-break: break-word;
    }

    #inventoryDetailsTable th:nth-child(1) {
        width: 50%;
        /* Slightly narrower on mobile */
    }

    /* Make distance column more compact on mobile */
    .distance-column {
        font-size: 0.9rem;
        margin-right: 5px;
    }
}