@import "variables.css";

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0s 0.4s linear;
    visibility: hidden;
    opacity: 0;
    font-family: inherit;
}

#loading-overlay.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s ease, visibility 0s 0s linear;
}

.loading-spinner {
    border: 5px solid #e0e0e0;
    border-top: 5px solid #0078A8;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

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

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

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

@keyframes data-loader-progress {
    0% {
        left: -35%;
        right: 100%;
    }

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

@keyframes data-loader-progress {
    0% {
        left: -35%;
        right: 100%;
    }

    60% {
        left: 100%;
        right: -90%;
    }

    100% {
        left: 100%;
        right: -90%;
    }
}

#data-loading-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(0, 120, 168, 0.2);
    z-index: 1;
    /* Sits at the bottom of the search bar */
    transition: opacity 0.3s ease, visibility 0s 0.3s linear;
    visibility: hidden;
    opacity: 0;
    overflow: hidden;
}

#data-loading-overlay.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s 0s linear;
}

.data-loader-bar {
    position: relative;
    width: 100%;
    height: 100%;
}

.data-loader-bar::before {
    content: '';
    position: absolute;
    height: 100%;
    background-color: #0078A8;
    animation: data-loader-progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

#loading-overlay p {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

/* --- Accessibility & Focus Styles --- */
:focus {
    outline: none;
}

/* Custom focus ring for keyboard users. It won't show on mouse click. */
:focus-visible {
    outline: 2px solid #0078A8;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 120, 168, 0.2);
    border-radius: 4px;
    /* Consistent rounding */
    transition: outline 0.1s ease, outline-offset 0.1s ease, box-shadow 0.1s ease;
}

/* Remove focus ring from body if it ever gets focus */
body:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Adjustments for specific components to integrate with the new focus style */
.add-place-nav-btn.primary:focus-visible {
    box-shadow: 0 0 0 4px rgba(0, 120, 168, 0.2), 0 4px 8px rgba(0, 0, 0, 0.1);
}

.list-view-item:focus-visible {
    background-color: #e6f3ff;
    box-shadow: none;
    /* Already has an outline */
}

.suggestion-category-btn:focus-visible,
#add-place-modal-close:focus-visible,
#suggest-edit-modal-close:focus-visible,
.form-offer-item:focus-visible {
    outline-offset: 0;
    box-shadow: none;
}

.action-icon:focus-visible {
    outline: none;
    box-shadow: none;
    color: #c0d8f0;
    transform: scale(1.15);
}

#list-view-no-results:focus-visible {
    box-shadow: none;
}

/* Passed Event Strikethrough */
.passed-event-text {
    text-decoration: line-through;
    opacity: 0.7;
}

.passed-event-item .list-view-item-date {
    text-decoration: line-through;
    opacity: 0.7;
}

.visually-hidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap;
}
