/* ========================
   Modal Component Styles
   ======================== */

/* Base Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.modal--open {
    opacity: 1;
    visibility: visible;
}

.modal--closing {
    opacity: 0;
    visibility: hidden;
}

/* Backdrop */
.modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Container */
.modal__container {
    position: relative;
    background-color: var(--color-pure-white);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.2s ease-in-out;
}

.modal--open .modal__container {
    transform: translateY(0);
}

.modal--closing .modal__container {
    transform: translateY(20px);
}

/* Size Variants */
.modal--small .modal__container {
    max-width: 400px;
    width: 90%;
}

.modal--medium .modal__container {
    max-width: 600px;
    width: 90%;
}

.modal--large .modal__container {
    max-width: 800px;
    width: 90%;
}

.modal--full .modal__container {
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    width: calc(100vw - 48px);
}

/* Header */
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(205, 210, 228, 0.66);
    flex-shrink: 0;
}

.modal__header--no-title {
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: none;
}

.modal__title {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 20px;
    line-height: normal;
    color: var(--color-blu);
    margin: 0;
    flex: 1;
    padding-right: 16px;
}

/* Close Button */
.modal__close-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-blu);
    border-radius: 50%;
    transition: background-color 0.15s ease-in-out;
    flex-shrink: 0;
}

.modal__close-btn:hover {
    background-color: rgba(48, 66, 97, 0.1);
}

.modal__close-btn:focus {
    outline: 2px solid var(--color-blu);
    outline-offset: 2px;
}

.modal__close-btn:focus:not(:focus-visible) {
    outline: none;
}

.modal__close-btn svg {
    width: 20px;
    height: 20px;
}

/* Body */
.modal__body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    flex: 1;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    line-height: 22px;
    color: var(--color-blu);
}

.modal__body p {
    margin: 0 0 12px;
}

.modal__body p:last-child {
    margin-bottom: 0;
}

.modal__body strong {
    font-weight: 700;
}

.modal__body ul,
.modal__body ol {
    margin: 0 0 12px;
    padding-left: 24px;
}

.modal__body ul:last-child,
.modal__body ol:last-child {
    margin-bottom: 0;
}

.modal__body li {
    margin: 0 0 4px;
}

.modal__body li:last-child {
    margin-bottom: 0;
}

/* Footer */
.modal__footer {
    height: 60px;
    min-height: 60px;
    padding: 0 24px;
    border-top: 1px solid rgba(205, 210, 228, 0.66);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 12px;
}

/* Copy Button */
.modal__copy-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--color-blu);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.modal__copy-btn:hover {
    background-color: #3d5278;
}

.modal__copy-btn:active {
    transform: scale(0.98);
}

.modal__copy-btn:focus {
    outline: 2px solid var(--color-blu);
    outline-offset: 2px;
}

.modal__copy-btn:focus:not(:focus-visible) {
    outline: none;
}

.modal__copy-btn svg {
    width: 16px;
    height: 16px;
}

/* Generic Action Button */
.modal__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    background-color: var(--color-blu);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.modal__action-btn:hover {
    background-color: #3d5278;
}

.modal__action-btn:active {
    transform: scale(0.98);
}

.modal__action-btn:focus {
    outline: 2px solid var(--color-blu);
    outline-offset: 2px;
}

.modal__action-btn:focus:not(:focus-visible) {
    outline: none;
}

.modal__action-btn--secondary {
    background-color: transparent;
    color: var(--color-blu);
    border: 1px solid var(--color-blu);
}

.modal__action-btn--secondary:hover {
    background-color: rgba(48, 66, 97, 0.1);
}

/* ========================
   Responsive Adjustments
   ======================== */
@media (max-width: 640px) {
    .modal__container {
        border-radius: 16px;
        max-height: calc(100vh - 32px);
    }

    .modal--small .modal__container,
    .modal--medium .modal__container,
    .modal--large .modal__container {
        width: calc(100vw - 24px);
        max-width: none;
    }

    .modal--full .modal__container {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        width: calc(100vw - 24px);
        border-radius: 16px;
    }

    .modal__header {
        padding: 16px 20px 12px;
    }

    .modal__title {
        font-size: 18px;
    }

    .modal__body {
        padding: 16px 20px 20px;
    }

    .modal__footer {
        height: 56px;
        min-height: 56px;
        padding: 0 20px;
    }
}

