/* Shadcn-style custom modal system */

body.modal-open {
    overflow: hidden;
}

.custom-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(14px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.custom-modal-overlay.is-open {
    opacity: 1;
}

.custom-modal-surface {
    width: min(100%, 560px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-card {
    width: 100%;
    max-width: 560px;
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 10px);
    box-shadow: 0 32px 80px -24px rgba(0, 0, 0, 0.45);
    padding: 1.25rem;
    transform: translateY(10px) scale(0.98);
    opacity: 0;
    transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

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

.custom-modal-card-sm {
    max-width: 420px;
}

.custom-modal-card-md {
    max-width: 560px;
}

.custom-modal-card-lg {
    max-width: 720px;
}

.custom-modal-card-danger {
    border-color: hsl(var(--destructive) / 0.45);
    box-shadow: 0 32px 80px -24px hsl(var(--destructive) / 0.25);
}

.custom-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.custom-modal-heading-group {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    min-width: 0;
}

.custom-modal-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: calc(var(--radius) + 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    flex: 0 0 auto;
}

.custom-modal-icon.is-danger {
    background: hsl(var(--destructive) / 0.12);
    color: hsl(var(--destructive));
}

.custom-modal-icon svg {
    width: 1.1rem;
    height: 1.1rem;
    stroke-width: 2.25;
}

.custom-modal-heading-copy {
    min-width: 0;
}

.custom-modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.custom-modal-description {
    margin: 0.25rem 0 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.95rem;
    line-height: 1.5;
}

.custom-modal-close {
    margin-top: -0.1rem;
    flex: 0 0 auto;
}

.custom-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    margin-bottom: 1.1rem;
}

.custom-modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.custom-modal-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.custom-modal-helper {
    margin: 0;
    font-size: 0.82rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.45;
}

.custom-modal-input {
    width: 100%;
    min-height: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    padding: 0.65rem 0.8rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.custom-modal-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.custom-modal-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.16);
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .custom-modal-overlay {
        padding: 0.75rem;
    }

    .custom-modal-card {
        padding: 1rem;
        border-radius: calc(var(--radius) + 8px);
    }

    .custom-modal-header {
        gap: 0.75rem;
    }

    .custom-modal-heading-group {
        gap: 0.75rem;
    }

    .custom-modal-footer {
        justify-content: stretch;
    }

    .custom-modal-footer .btn {
        flex: 1 1 140px;
    }
}
