/* General Styles */

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 75rem;
    text-align: center;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

.app-header {
    margin-bottom: 1.5rem;
}

#app-name {
    font-size: 2.5rem;
    margin-bottom: 1.25rem;
}

#weather {
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
    margin-left: auto;
    margin-right: auto;

    /* ~15px in rem */
    padding: 0.9375rem;

    /* ~1px in rem */
    border: 0.0625rem solid #ddd;

    /* ~8px in rem */
    border-radius: 0.5rem;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;

    /* ~400px in rem */
    max-width: 25rem;
    box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
    min-height: 7.5rem;
}

#weather h2 {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

#weather p {
    font-size: 0.9rem;
    margin: 0.125rem 0;
    text-align: left;
}

/*this is only for USER*/
.weather-icon {
    /* Icon size */
    /* ~40px */
    width: 2.5rem;
    height: 2.5rem;
}

.weather-info {
    text-align: center;
}

.weather-info h2 {
    font-size: 1.2rem;
    margin: 0;
}

.weather-info p {
    font-size: 0.9rem;
}

.loading-spinner {
    /* Spinner width */
    width: 2rem;
    /* Spinner height */
    height: 2rem;
    border: 0.25rem solid rgba(0, 0, 0, 0.1);

    /* Top border for the spinning effect */
    border-top: 0.25rem solid #007bff;

    /* Circular shape */
    border-radius: 50%;

    /* Infinite spinning animation */
    animation: spin 1s linear infinite;

    display: block;
    margin: auto;
}

/* CSS Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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

.location-input-container {
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;

    /* ~5px spacing between input and button */
    gap: 0.3125rem;
}

.location-input {
    width: 50%;
    padding: 0.625rem;

    /* ~16px */
    font-size: 1rem;
    border: 0.0625rem solid #ccc;

    /* ~5px */
    border-radius: 0.3125rem;
    outline: none;
}

.location-input:focus {
    border-color: #007bff;
}

.add-location-button {
    /* ~20px horizontal padding */
    padding: 0 1.25rem;
    font-size: 1rem;
    color: white;
    background-color: #28a745;
    border: none;
    border-radius: 0.3125rem;
    cursor: pointer;
    text-align: center;

    /* ~42px */
    height: 2.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.add-location-button:hover {
    background-color: #218838;
    transform: scale(1.05);
}

.add-location-button:active {
    transform: scale(0.95);

    /* ~0px 2px 4px */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
}

/* Green focus outline for add location button */
.add-location-button:focus-visible {
    outline: 0.125rem solid #28a745;
    outline-offset: 0.125rem;
}

/* Saved Locations Section */
.saved-locations-container {
    margin-top: 1.25rem;
    text-align: center;
}

.saved-locations-container h3 {
    font-size: 1.5rem;
    margin-bottom: 0.9375rem;
}

/*Visualize locations Section*/
.map-div {
    text-align: center;
    margin-bottom: 1rem;
}

#open-canvas-btn {
    /* Hide the button initially */
    display: none;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 0.3125rem;
    padding: 0.625rem 5rem;
    font-size: 1rem;
    cursor: pointer;
    margin: 0.3125rem;

    /* Smooth hover effect */
    transition: background-color 0.3s ease, transform 0.2s ease;

    /* Subtle shadow */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    text-align: center;
}

#open-canvas-btn:hover {
    background-color: #138496;
    /* Darker shade for hover effect */
    transform: scale(1.05);
    /* Slight enlarge on hover */
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    /* Enhance shadow on hover */
}

#open-canvas-btn:active {
    /* Slight shrink on click */
    transform: scale(0.95);

    /* Even darker shade for active state */
    background-color: #117a8b;

    /* Adjust shadow */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
}

/* Focus state for accessibility */
#open-canvas-btn:focus-visible {
    /* Visible focus outline */
    outline: 0.125rem solid #138496;

    /* Space between outline and button */
    outline-offset: 0.125rem;
}

/* Location List Layout */
.locations-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(21.875rem, 1fr));
    gap: 0.9375rem;
    padding: 0;
    margin: 0 auto;
    list-style: none;
    justify-content: center;
}

/* Individual Location Card */
.weather-info-location {
    border: 0.0625rem solid #ddd;
    border-radius: 0.5rem;
    background-color: white;
    box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
    padding: 0.9375rem;
    display: flex;
    flex-direction: column;
    text-align: left;
    justify-content: space-between;
}

.weather-info-location:hover {
    transform: scale(1.03);
}

/* Layout for content within the card */
.weather-info-location-content {
    display: flex;
    justify-content: space-between;
    gap: 0.9375rem;
    align-items: center;
}

/* Left Section: Basic Info */
.location-details {
    flex: 1;
    text-align: left;
}

.location-details h5 {
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;

    /* ~5px - Gap between name and weather icon*/
    gap: 0.3125rem;
}

.location-details .weather-icon {
    width: 2rem;
    /* ~32px */
    height: 2rem;
}

/* Weather details for the saved locations */
.saved-location-weather-info {
    font-size: 0.83rem;
}

.distance {
    font-size: 0.9rem;
    color: #007bff;
    font-weight: bold;
    margin-top: 0;
}

/* Right Section: Travel Times */
.travel-times {
    flex: 1;
    text-align: left;
}

.travel-time-list {
    list-style: none;
    padding: 0;
    margin: 0.625rem 0;
}

.travel-time-list li {
    margin: 0.3125rem 0;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.travel-time-list li i {
    margin-right: 0.5rem;
}

/* Delete Button */
.delete-btn {
    padding: 0.625rem 0.9375rem;
    font-size: 0.9rem;
    color: white;
    background-color: #dc3545;
    border: none;
    border-radius: 0.3125rem;
    cursor: pointer;
    margin-top: 0.9375rem;
}

.delete-btn:hover {
    background-color: #c82333;
    transform: scale(1.05);
}

.delete-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
}

/* Focus Outline for Delete Button */
.delete-btn:focus-visible {
    outline: 0.125rem solid #dc3545;
    /* Red focus outline for delete button */
    outline-offset: 0.125rem;
    /* Space between outline and button */
}

@media (max-width: 600px) {

    .container {
        margin-top: 1.25rem;
    }

    #app-name {
        font-size: 1.5rem;
        margin-bottom: 0.3125rem;
    }

    /* Weather Section */
    #weather {
        padding: 0.625rem;
        border: 0.0625rem solid #ddd;
        border-radius: 0.5rem;
        background-color: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        max-width: 18.75rem;
        margin: 1.25rem auto;
        box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
        min-height: 4.6875rem;
    }

    .saved-locations-container h3 {
        font-size: 1rem;
    }

    .locations-list {
        grid-template-columns: 1fr;
    }

    .weather-info {
        text-align: center;
    }

    .weather-info-location {
        padding: 0.625rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .weather-info-location-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .weather-info-location:hover {
        transform: scale(1.01);
    }

    .location-details h5 {
        font-size: 1rem;
        gap: 0.125rem;
    }

    .delete-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;

        /* Align to the row */
        margin-top: 0;

        /* Push to the far right */
        margin-left: auto;

        /* Ensure it stays in the row */
        align-self: flex-end;
    }

    .travel-times p {
        font-size: 0.8rem;
    }

    .travel-time-list li {
        font-size: 0.8rem;
    }

    .location-name {
        font-size: 0.1rem;
    }

    .saved-location-weather-info {
        font-size: 0.7rem;
    }

    .distance {
        font-size: 0.8rem;
    }

    .location-input-container {
        margin: 0.625rem 0;

        display: flex;

        /* Make the input field take up available space */
        flex: 1;
        align-items: center;
        justify-content: center;

        /* Spacing between input and button */
        gap: 0;
    }

    .location-input {
        flex: 1;
        /* Make the input field take up available space */
        width: 100%;
        /*height: 30px; !* Match height with the input field *!*/
    }

    .location-input::placeholder {
        font-size: 0.9rem;
    }

    .sr-only {
        display: none;
        font-size: 0.75rem;
    }

    .add-location-button {
        width: auto;
        /* Ensure button remains smaller */
        font-size: 0.8rem;
        /*height: 29px; !* Match height with the input field *!*/
    }

    #open-canvas-btn {
        padding: 0.5rem 4rem;
        font-size: 0.875rem;
        margin: 0.25rem;
    }
}

/*Mobile M*/
@media (max-width: 375px) {

    .container {
        margin-top: 1.2rem;
    }

    .add-location-button {
        width: 6rem;
        /* Ensure button remains smaller */
        font-size: 0.65rem;
    }

    #open-canvas-btn {
        padding: 0.5rem 3rem;
        font-size: 0.85rem;
        margin: 0;
    }
}

/*Mobile S*/
@media (max-width: 320px) {

    .container {
        margin-top: 1rem;
    }

    .location-input::placeholder {
        font-size: 0.8rem;
    }

    .add-location-button {
        width: 4rem;
        /* Ensure button remains smaller */
        font-size: 0.55rem;
    }

    #open-canvas-btn {
        padding: 0.5rem 2rem;
        font-size: 0.8rem;
        margin: 0;
    }
}