/* Modal Window Styles */
.create-address-page,
.select-address-page {

    background-color: rgba(255, 255, 255, 0.7);
}

#universalModal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    transition: background-color 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

#universalModal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
}

#universalModal.d-block {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Content Styling */
#universalModal .modal-dialog {
    position: relative;
    width: auto;
    margin: auto;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#universalModal .modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow: hidden;
}

#universalModal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

#universalModal .modal-header .modal-title {
    margin: 0;
    line-height: 1.5;
    font-size: 1.25rem;
    font-weight: 500;
}

#universalModal .modal-header .btn-close {
    padding: 0.25rem 0.25rem;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 1rem;
}

#universalModal .modal-header .btn-close:hover,
#universalModal .modal-header .btn-close:focus {
    opacity: 0.75;
    text-decoration: none;
}

#universalModal .modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
}

#universalModal .modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
    gap: 0.5rem;
}

#universalModal .modal-footer .btn {
    margin: 0;
}

/* Spinner loader */
#universalModal .spinner-border {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

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

/* Form styles in modal */
#universalModal .form-control,
#universalModal .form-select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#universalModal .form-control:focus,
#universalModal .form-select:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Text alignment helper */
#universalModal .text-center {
    text-align: center !important;
}

/* Padding helper */
#universalModal .p-5 {
    padding: 3rem !important;
}

#universalModal .mb-3 {
    margin-bottom: 1rem !important;
}

#universalModal .mb-0 {
    margin-bottom: 0 !important;
}

/* Alert styles */
#universalModal .alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

#universalModal .alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

#universalModal .alert-danger hr {
    border-top-color: #f1b0b7;
}

#universalModal .bg-danger {
    background-color: #dc3545 !important;
}

#universalModal .text-white {
    color: #fff !important;
}

#universalModal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Buttons */
#universalModal .btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#universalModal .btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

#universalModal .btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

#universalModal .btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

#universalModal .btn-secondary:hover {
    color: #fff;
    background-color: #5c636a;
    border-color: #565e64;
}

/* Responsive */
@media (max-width: 576px) {
    #universalModal {
        padding: 0.5rem;
    }

    #universalModal .modal-dialog {
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    #universalModal .modal-content {
        max-height: calc(100vh - 1rem);
        border-radius: 0;
    }

    #universalModal .modal-header {
        padding: 0.75rem;
    }

    #universalModal .modal-body {
        padding: 0.75rem;
    }

    #universalModal .modal-footer {
        padding: 0.75rem;
    }
}
