/* Custom Center Modal Styles */
:root {
    --modal-bg: #ffffff;
    --modal-fg: #0f172a;
    --modal-muted: #64748b;
    --modal-border: #e2e8f0;
    --modal-overlay-bg: rgba(15, 23, 42, 0.65);
    --modal-header-default-bg: #2563eb;
    --modal-header-default-fg: #ffffff;
    --modal-radius: 12px;
}

/* Modal Overlay */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--modal-overlay-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Center Modal Card */
.custom-modal-card {
    background: var(--modal-bg);
    width: 540px;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--modal-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.custom-modal-overlay.active .custom-modal-card {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.custom-modal-header {
    background-color: var(--modal-header-default-bg);
    color: var(--modal-header-default-fg);
    padding: 16px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    user-select: none;
}

.custom-modal-header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.custom-modal-header-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.custom-modal-header-icon.hidden {
    display: none;
}

.custom-modal-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-modal-header-close {
    width: 28px;
    height: 28px;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    opacity: 0.85;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.custom-modal-header-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.18);
}

.custom-modal-header-close svg,
.custom-modal-header-close img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Modal Body / Content */
.custom-modal-body {
    padding: 24px 22px;
    color: var(--modal-fg);
    font-size: 1.05rem;
    line-height: 1.6;
    overflow-y: auto;
    flex: 1;
    box-sizing: border-box;
    word-break: break-word;
}

.custom-modal-text {
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: pre-line;
}

/* Modal Footer / Buttons */
.custom-modal-footer {
    padding: 16px 20px 20px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--modal-border);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    box-sizing: border-box;
    flex-wrap: wrap;
}

/* Modal Buttons */
.custom-modal-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    user-select: none;
    min-height: 42px;
    box-sizing: border-box;
}

.custom-modal-btn:hover {
    filter: brightness(0.92);
}

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

.custom-modal-btn-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.custom-modal-btn-text {
    line-height: 1;
}

/* Responsive */
@media screen and (max-width: 560px) {
    .custom-modal-overlay {
        padding: 12px;
    }

    .custom-modal-card {
        width: 100%;
        max-height: 94vh;
    }

    .custom-modal-header {
        padding: 14px 16px;
    }

    .custom-modal-header-title {
        font-size: 1.1rem;
    }

    .custom-modal-body {
        padding: 18px 16px;
        font-size: 0.95rem;
    }

    .custom-modal-footer {
        padding: 12px 16px 16px 16px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .custom-modal-btn {
        width: 100%;
    }
}
