/* Global Modal Styles - Shared across site */

.modal {
    /* display controlled by Alpine x-show */
    position: fixed;
    inset: 0;
    z-index: 2000; /* High enough to clear everything */
    overflow: hidden;
}

[x-cloak] { display: none !important; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    max-width: min(800px, 96vw);
    margin: 4rem auto;
    background: var(--paper, #fff);
    color: var(--ink, #333);
    border-radius: 18px;
    border: 2px solid var(--line-strong, #ccc);
    box-shadow: var(--shadow-2, 0 10px 25px rgba(0,0,0,0.1));
    padding: 1.5rem 1.75rem 1.75rem;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Modal Sizes */
.modal-dialog.max-w-900 { max-width: min(900px, 96vw); }
.modal-dialog.max-w-95vw { max-width: 95vw; }
.modal-dialog.max-w-700 { max-width: min(700px, 96vw); }
.modal-dialog.max-w-500 { max-width: min(500px, 96vw); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--line-strong, #ccc);
    flex-shrink: 0;
}

.modal-header h2, .modal-header h3 {
    margin: 0;
    color: var(--charcoal, #222);
    font-family: var(--font-serif, serif);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.modal-close {
    background: transparent;
    color: var(--ink, #333);
    border: 1.5px solid var(--line-strong, #ccc);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    transition: all 200ms ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--ink, #333);
    transform: scale(1.05);
}

.modal-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light, #eee);
    flex-shrink: 0;
}

body.modal-open {
    overflow: hidden;
}

/* Specific Modal Adjustments */
.kg-modal-body {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.json-preview-wrap, .csv-preview-wrap, .html-preview-wrap {
    background: #fdfdfd;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #eee;
    font-family: monospace;
    white-space: pre-wrap;
    font-size: 0.9rem;
}
