/* =========================================================
   Stroon Modal System - CSS
   Unified modal/popup styles
   ========================================================= */

/* Backdrop */
.stroon-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--stroon-z-modal, 3500);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--stroon-transition-normal, 250ms ease),
        visibility var(--stroon-transition-normal, 250ms ease);
}

.stroon-modal-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Body lock when modal is open */
body.stroon-modal-open {
    overflow: hidden;
}

/* Modal container */
.stroon-modal {
    position: relative;
    background: var(--stroon-panel, #161b22);
    border: 1px solid var(--stroon-line, rgba(255, 255, 255, 0.1));
    border-radius: var(--stroon-radius-lg, 16px);
    box-shadow: var(--stroon-shadow-popup, 0 12px 48px rgba(0, 0, 0, 0.6));
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: opacity var(--stroon-transition-normal, 250ms ease),
        transform var(--stroon-transition-normal, 250ms ease);
}

.stroon-modal.is-open {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Modal sizes */
.stroon-modal--sm {
    width: 90%;
    max-width: 360px;
}

.stroon-modal--md {
    width: 90%;
    max-width: 520px;
}

.stroon-modal--lg {
    width: 90%;
    max-width: 720px;
}

.stroon-modal--xl {
    width: 90%;
    max-width: 960px;
}

.stroon-modal--full {
    width: 96%;
    max-width: none;
    height: 94vh;
}

/* Modal inner */
.stroon-modal__inner {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    overflow: hidden;
}

/* Header */
.stroon-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--stroon-gap-md, 16px) var(--stroon-gap-lg, 24px);
    border-bottom: 1px solid var(--stroon-line, rgba(255, 255, 255, 0.1));
    flex-shrink: 0;
}

.stroon-modal__title {
    margin: 0;
    font-size: var(--stroon-font-size-lg, 16px);
    font-weight: 600;
    color: var(--stroon-ink, #e6edf3);
}

.stroon-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--stroon-radius-sm, 6px);
    background: transparent;
    color: var(--stroon-ink-dim, rgba(230, 237, 243, 0.72));
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--stroon-transition-fast, 150ms ease),
        color var(--stroon-transition-fast, 150ms ease);
}

.stroon-modal__close:hover {
    background: var(--stroon-soft-2, rgba(255, 255, 255, 0.1));
    color: var(--stroon-ink, #e6edf3);
}

/* Body */
.stroon-modal__body {
    padding: var(--stroon-gap-lg, 24px);
    overflow-y: auto;
    flex: 1;
    color: var(--stroon-ink, #e6edf3);
}

/* Confirm/Alert content */
.stroon-modal__message {
    margin: 0 0 var(--stroon-gap-lg, 24px);
    font-size: var(--stroon-font-size-md, 14px);
    line-height: 1.5;
    color: var(--stroon-ink-dim, rgba(230, 237, 243, 0.72));
}

.stroon-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--stroon-gap-sm, 8px);
}

/* Buttons */
.stroon-modal__btn {
    padding: var(--stroon-gap-sm, 8px) var(--stroon-gap-md, 16px);
    border: 1px solid var(--stroon-line-2, rgba(255, 255, 255, 0.15));
    border-radius: var(--stroon-radius-sm, 6px);
    background: var(--stroon-panel-2, #21262d);
    color: var(--stroon-ink, #e6edf3);
    font-size: var(--stroon-font-size-sm, 12px);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--stroon-transition-fast, 150ms ease),
        border-color var(--stroon-transition-fast, 150ms ease);
}

.stroon-modal__btn:hover {
    background: var(--stroon-panel-3, #2d333b);
    border-color: var(--stroon-line-2, rgba(255, 255, 255, 0.15));
}

.stroon-modal__btn--confirm {
    background: var(--stroon-accent, #7e3ff2);
    border-color: var(--stroon-accent, #7e3ff2);
    color: #fff;
}

.stroon-modal__btn--confirm:hover {
    background: var(--stroon-accent-hover, #9562f5);
    border-color: var(--stroon-accent-hover, #9562f5);
}

.stroon-modal__btn--danger {
    background: var(--stroon-danger, #ff6b6b);
    border-color: var(--stroon-danger, #ff6b6b);
    color: #fff;
}

.stroon-modal__btn--danger:hover {
    background: #ff5252;
    border-color: #ff5252;
}

.stroon-modal__btn--cancel {
    background: transparent;
    border-color: var(--stroon-line-2, rgba(255, 255, 255, 0.15));
}

.stroon-modal__btn--cancel:hover {
    background: var(--stroon-soft-2, rgba(255, 255, 255, 0.1));
}

/* Loading */
.stroon-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--stroon-gap-md, 16px);
    padding: var(--stroon-gap-lg, 24px) 0;
}

.stroon-modal__loading p {
    margin: 0;
    color: var(--stroon-ink-dim, rgba(230, 237, 243, 0.72));
}

.stroon-modal__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--stroon-line, rgba(255, 255, 255, 0.1));
    border-top-color: var(--stroon-accent, #7e3ff2);
    border-radius: 50%;
    animation: stroon-spin 0.8s linear infinite;
}

@keyframes stroon-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .stroon-modal {
        max-height: 96vh;
        border-radius: var(--stroon-radius-md, 10px);
    }

    .stroon-modal__header,
    .stroon-modal__body {
        padding: var(--stroon-gap-md, 16px);
    }

    .stroon-modal--sm,
    .stroon-modal--md,
    .stroon-modal--lg,
    .stroon-modal--xl {
        width: 94%;
    }
}
