﻿/* ============================================================
   MatterFormsPage.css
   Theme: matches XManagementPro light/blue UI.
   Designed to render inside a tab (max-height: 400px).
   Full-screen overlay breaks out of tab constraints.
   ============================================================ */

/* ── Root (compact tab view) ─────────────────────────────────── */
.mfp-root {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #1e2a45;
}

    .mfp-root * {
        box-sizing: border-box;
    }

/* ── Toolbar ─────────────────────────────────────────────────── */
.mfp-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    border-bottom: 1px solid #d4daea;
}

.mfp-toolbar-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #1e2a45;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mfp-count {
    font-size: 10px;
    font-weight: 600;
    background: #e8f0fd;
    color: #3a6fd8;
    border: 1px solid #c5d8fb;
    border-radius: 10px;
    padding: 1px 7px;
}

.mfp-toolbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────────────────────── */
.mfp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px;
    color: #a0aabf;
    font-size: 12px;
    text-align: center;
}

.mfp-empty-icon {
    font-size: 28px;
    opacity: 0.35;
}

/* ── Form cards list ─────────────────────────────────────────── */
.mfp-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mfp-form-card {
    display: flex;
    align-items: stretch;
    border: 1px solid #d4daea;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color 0.13s, box-shadow 0.13s;
    overflow: hidden;
}

    .mfp-form-card:hover {
        border-color: #5b8dee;
        box-shadow: 0 1px 6px rgba(91,141,238,0.12);
    }

.mfp-form-card-body {
    flex: 1;
    padding: 8px 10px;
    cursor: pointer;
    min-width: 0;
}

.mfp-form-card-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.mfp-form-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e2a45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mfp-form-ver {
    font-size: 10px;
    font-weight: 500;
    color: #a0aabf;
    white-space: nowrap;
    flex-shrink: 0;
}

.mfp-badge-new {
    font-size: 10px;
    font-weight: 600;
    background: #fef3e7;
    color: #c06e1a;
    border: 1px solid #f5cfa0;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.mfp-form-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #6b7a99;
    flex-wrap: wrap;
}

.mfp-contact-name {
    font-weight: 500;
    color: #1e2a45;
}

.mfp-role-badge {
    font-size: 9px;
    font-weight: 600;
    background: #e8f0fd;
    color: #3a6fd8;
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}

.mfp-dot {
    opacity: 0.45;
}

.mfp-form-card-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px;
    border-left: 1px solid #edf0f7;
    background: #f6f8fc;
    flex-shrink: 0;
}

/* ── Full-screen viewer overlay ──────────────────────────────── */
/*
   position:fixed breaks out of any scroll-container constraints.
   z-index: 800 — above modals (typically 500-600) but below any
   critical system alerts.
*/
.mfp-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    flex-direction: column;
    background: #f0f2f8;
}

.mfp-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: linear-gradient(135deg, #2c3e72 0%, #3a5298 100%);
    flex-shrink: 0;
}

.mfp-overlay-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mfp-overlay-ver {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
}

.mfp-overlay-contact {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    gap: 6px;
}

.mfp-close-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.88);
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.13s;
}

    .mfp-close-btn:hover {
        background: rgba(255,255,255,0.22);
        color: #ffffff;
    }

.mfp-overlay-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

    /* XMPFormViewer fills the overlay body completely */
    .mfp-overlay-body > .xfv-root {
        flex: 1;
        min-height: 0;
        border-radius: 0;
        border: none;
    }

/* ── Modals ──────────────────────────────────────────────────── */
.mfp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30,42,69,0.42);
    backdrop-filter: blur(2px);
    z-index: 850;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mfp-modal {
    background: #ffffff;
    border: 1px solid #d4daea;
    border-radius: 8px;
    box-shadow: 0 8px 36px rgba(30,42,69,0.18);
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.mfp-modal-wide {
    max-width: 620px;
}

.mfp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(180deg, #f6f8fc 0%, #edf0f7 100%);
    border-bottom: 1px solid #d4daea;
    font-size: 13px;
    font-weight: 600;
    color: #1e2a45;
    flex-shrink: 0;
}

.mfp-modal-close {
    background: none;
    border: none;
    color: #a0aabf;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.12s;
}

    .mfp-modal-close:hover {
        color: #e05c6a;
    }

.mfp-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.mfp-modal-footer {
    padding: 11px 16px;
    border-top: 1px solid #d4daea;
    background: #f6f8fc;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Group form list (inside Add from Group modal) ────────────── */
.mfp-group-form-list {
    border: 1px solid #d4daea;
    border-radius: 6px;
    overflow: hidden;
}

.mfp-group-list-header {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    padding: 6px 10px;
    background: #f6f8fc;
    border-bottom: 1px solid #d4daea;
    font-size: 10px;
    font-weight: 700;
    color: #6b7a99;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mfp-group-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid #f0f2f8;
}

    .mfp-group-form-row:last-child {
        border-bottom: none;
    }

    .mfp-group-form-row:hover {
        background: #f6f8fc;
    }

.mfp-group-form-name {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #1e2a45;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Form controls ───────────────────────────────────────────── */
.mfp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mfp-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7a99;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mfp-required {
    color: #e05c6a;
}

.mfp-select {
    background: #ffffff;
    border: 1px solid #d4daea;
    border-radius: 5px;
    color: #1e2a45;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 9px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .mfp-select:focus {
        border-color: #5b8dee;
        box-shadow: 0 0 0 3px rgba(91,141,238,0.15);
    }

.mfp-select-sm {
    font-size: 12px;
    padding: 4px 7px;
}

.mfp-error {
    font-size: 11px;
    color: #c0404e;
    background: #fdeef0;
    border: 1px solid #f5b8be;
    border-radius: 4px;
    padding: 6px 10px;
}

.mfp-warn {
    font-size: 12px;
    color: #7a4a00;
    background: #fef3e7;
    border: 1px solid #f5cfa0;
    border-radius: 4px;
    padding: 8px 10px;
    line-height: 1.5;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.mfp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 13px;
    border-radius: 5px;
    border: 1px solid #d4daea;
    background: #f6f8fc;
    color: #1e2a45;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.13s, border-color 0.13s;
    white-space: nowrap;
    user-select: none;
}

    .mfp-btn:hover:not(:disabled) {
        background: #edf0f7;
        border-color: #bcc5d9;
    }

    .mfp-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.mfp-btn-primary {
    background: #5b8dee;
    border-color: #5b8dee;
    color: #ffffff;
}

    .mfp-btn-primary:hover:not(:disabled) {
        background: #3a6fd8;
        border-color: #3a6fd8;
    }

.mfp-btn-danger {
    background: #fdeef0;
    border-color: #f5b8be;
    color: #c0404e;
}

    .mfp-btn-danger:hover:not(:disabled) {
        background: #fbd9dd;
        border-color: #e05c6a;
    }

.mfp-btn-sm {
    padding: 4px 9px;
    font-size: 11px;
}

.mfp-act-btn {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.12s;
}

.mfp-act-open {
    background: #e8f0fd;
    border-color: #c5d8fb;
    color: #3a6fd8;
}

.mfp-act-remove {
    background: #fdeef0;
    border-color: #f5b8be;
    color: #c0404e;
}

.mfp-act-open:hover {
    background: #d5e5fc;
}

.mfp-act-remove:hover {
    background: #fbd9dd;
}
