/* Modal trigger button */
.modal-button {
    padding: 12px 24px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.modal-button:hover {
    background-color: #357abd;
    transform: translateY(-1px);
}

.modal-button:active {
    transform: translateY(0);
}

/* Modal container */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
}

/* Modal background with image support */
.modal-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(8px);
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

/* Modal content wrapper */
.modal-content {
    position: relative;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 40px;
    width: 70%;
    max-width: 700px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: scale(0.95);
    opacity: 0;
    overflow-y: auto;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease-out,
                background-color 0.3s ease;
}

/* Custom scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.5);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Typography */
.modal-content h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.modal-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Close button */
.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.close-button:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.close-button::before,
.close-button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #333;
    transform-origin: center;
    transition: background-color 0.2s ease;
}

.close-button::before {
    transform: rotate(45deg);
}

.close-button::after {
    transform: rotate(-45deg);
}

/* Animation states */
.modal.opening {
    display: flex;
    opacity: 0;
}

.modal.opening .modal-content {
    transform: scale(0.9);
    opacity: 0;
}

.modal.open {
    opacity: 1;
}

.modal.open .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .modal-content {
        width: 90%;
        padding: 30px;
    }
    
    .close-button {
        top: 15px;
        right: 15px;
    }
}

@media screen and (max-height: 600px) {
    .modal-content {
        margin: 20px 0;
        max-height: calc(100vh - 40px);
    }
}

@media screen and (max-width: 768px) { /* Adjust this breakpoint as needed */
    .service-description,
    .service-list {
        display: none; /* Hide description and list on small screens */
    }
}

/* Focus handling for accessibility */
.modal:focus,
.modal-content:focus {
    outline: none;
}

/* Prevent background scroll when modal is open */
body.modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px);
}

/* Active state for modal button */
.modal-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}