/* CSS for the modal window and overlay - ADA/WCAG 2.1 AA Compliant */

/* Screen reader only text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay-kfc,
    .modal-container-kfc,
    .modal-option-btn-kfc,
    .modal-close-kfc {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-container-kfc {
        border: 3px solid #000000;
    }
    
    .modal-option-btn-kfc {
        border: 2px solid #FFFFFF;
    }
    
    .modal-close-kfc {
        border: 2px solid #333333;
    }
}

/* Dark transparent overlay covering the entire screen */
.modal-overlay-kfc {
    position: fixed; /* Fixes the overlay on the screen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Increased for better contrast */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Initially invisible */
    visibility: hidden; /* Hidden to avoid interaction interference */
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; /* Transition for the fade effect */
    z-index: 1000; /* Ensures it's above other elements */
    touch-action: none; /* Prevents scrolling on iOS when the modal is open */
    -webkit-overflow-scrolling: touch;
    -webkit-transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    -moz-transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    -ms-transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    -o-transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Class to show the overlay */
.modal-overlay-kfc.is-visible {
    opacity: 1; /* Makes the overlay visible */
    visibility: visible; /* Shows the overlay */
}

/* Modal window container */
.modal-container-kfc {
    background-color: #F8F3D7;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 90%; /* Maximum width for small devices */
    width: 400px; /* Preferred width */
    transform: translateY(-20px); /* Slightly shifted up initially */
    opacity: 0; /* Initially invisible */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; /* Transition for the slide and fade effect */
    position: relative; /* To position the close button */
    max-height: 90vh; /* Maximum height to avoid overflow */
    overflow-y: auto; /* Allows scrolling if content is too long */
    -webkit-overflow-scrolling: touch;
    -webkit-transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    -moz-transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    -ms-transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    -o-transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Class to show the modal content */
.modal-overlay-kfc.is-visible .modal-container-kfc {
    transform: translateY(0); /* Returns to original position */
    opacity: 1; /* Makes the content visible */
}

/* Modal close button */
.modal-close-kfc {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 35px;
    cursor: pointer;
    color: #333;
    padding: 0 5px;
    border-radius: 4px;
    line-height: 1;
    /* Accessibility styles */
    outline: 2px solid transparent; /* Hides the default outline */
    outline-offset: 2px; /* Space between the outline and the border */
    transition: outline-color 0.2s ease-in-out; /* Transition for the outline */
    -webkit-transition: outline-color 0.2s ease-in-out;
    -moz-transition: outline-color 0.2s ease-in-out;
    -ms-transition: outline-color 0.2s ease-in-out;
    -o-transition: outline-color 0.2s ease-in-out;
    transition: outline-color 0.2s ease-in-out;
}

.modal-close-kfc:hover,
.modal-close-kfc:focus {
    color: #d9534f;
    outline-color: #007bff; /* Shows a visible outline on focus */
}

/* Modal content title */
.modal-content-kfc h2 {
    margin-top: 0 !important;
    color: #e80077 !important;
    font-weight: 600 !important;
    font-size: 22px !important;
}

.modal-content-kfc p {
    line-height: 1.6;
    color: #555;
}

/* Modal trigger buttons/links: no styles applied, inherit from theme */

/* Modal options container */
.modal-options-kfc {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.modal-options-kfc {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

/* Modal option buttons */
.modal-option-btn-kfc {
    background-color: #E80077 !important;
    color: #fff !important;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    transition: background-color 0.3s ease;
    display: block;
    font-family: inherit;
    margin-bottom: 5px;
    -webkit-transition: background-color 0.3s ease;
    -moz-transition: background-color 0.3s ease;
    -ms-transition: background-color 0.3s ease;
    -o-transition: background-color 0.3s ease;
    transition: background-color 0.3s ease;
}

.modal-option-btn-kfc:hover,
.modal-option-btn-kfc:focus {
    background-color: #c00066 !important;
    color: #fff !important;
    text-decoration: none !important;
}

.modal-option-btn-kfc:visited {
    color: #fff !important;
}

@media (max-width: 900px) {
    .modal-container-kfc {
        width: 98%;
        max-width: 98vw;
        padding: 18px;
    }
    .modal-content-kfc h2 {
        font-size: 1.2em;
    }
}

@media (max-width: 600px) {
    .modal-container-kfc {
        width: 100vw;
        min-width: 0;
        max-width: 100vw;
        padding: 10px;
        border-radius: 0;
    }
    .modal-content-kfc h2 {
        font-size: 1em;
    }
    .modal-option-btn-kfc {
        padding: 12px 8px;
        font-size: 15px;
        border-radius: 6px;
    }
}

@media (max-width: 400px) {
    .modal-container-kfc {
        padding: 4px;
    }
    .modal-content-kfc h2 {
        font-size: 0.95em;
    }
    .modal-option-btn-kfc {
        padding: 8px 2px;
        font-size: 14px;
    }
}

/* Ensuring compatibility on iOS and Safari with some properties */
/* There are no CSS properties strictly required for iOS/Safari for a modal,
   since general properties like position: fixed and z-index work well.
   -webkit-overflow-scrolling: touch is useful for scroll inside the modal. */
