/* ============================================
   BaseModal Component Styling
   ============================================ */

:root {
    --modal-bg: #ffffff;
    --modal-backdrop: rgba(0, 0, 0, 0.4);
    --modal-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --modal-border-radius: 12px;
    --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.c-base-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--modal-backdrop);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.c-base-modal__dialog {
    position: relative;
    width: 100%;
    background-color: var(--modal-bg);
    border-radius: var(--modal-border-radius);
    box-shadow: var(--modal-shadow);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: translateY(0);
    transition: var(--modal-transition);
}

/* SIZES */
.c-base-modal--sm .c-base-modal__dialog { max-width: 400px; }
.c-base-modal--md .c-base-modal__dialog { max-width: 550px; }
.c-base-modal--lg .c-base-modal__dialog { max-width: 800px; }
.c-base-modal--xl .c-base-modal__dialog { max-width: 1140px; }
.c-base-modal--full .c-base-modal__dialog { 
    max-width: 95vw; 
    height: 95vh;
}

/* HEADER */
.c-base-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.c-base-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color, #20213D);
    line-height: 1.2;
}

.c-base-modal__close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c-base-modal__close:hover {
    color: var(--secondary-color, #20213D);
    transform: rotate(90deg);
}

/* BODY */
.c-base-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

/* FOOTER */
.c-base-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
    border-bottom-left-radius: var(--modal-border-radius);
    border-bottom-right-radius: var(--modal-border-radius);
}

/* TRANSITIONS */
.modal-fade-enter-active,
.modal-fade-leave-active {
    transition: opacity 0.3s ease;
}

.modal-fade-enter-from,
.modal-fade-leave-to {
    opacity: 0;
}

.modal-fade-enter-active .c-base-modal__dialog {
    animation: modal-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-fade-leave-active .c-base-modal__dialog {
    animation: modal-out 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
}

/* RESPONSIVENESS */
@media (max-width: 640px) {
    .c-base-modal {
        padding: 0;
        align-items: flex-end; /* Bottom sheet behavior on mobile */
    }
    
    .c-base-modal__dialog {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 95vh;
    }

    .modal-fade-enter-active .c-base-modal__dialog {
        animation: modal-slide-up 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .modal-fade-leave-active .c-base-modal__dialog {
        animation: modal-slide-down 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes modal-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    @keyframes modal-slide-down {
        from { transform: translateY(0); }
        to { transform: translateY(100%); }
    }
}
