/**
 * Action Menu Modal Styling
 * Provides multiple themes and customization options for action buttons
 */

/* === ACTION MENU MODAL === */
.filemaker-action-menu-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    margin: 50px auto;
    position: relative;
    z-index: 10001;
}

/* === PIPELINE RESULT MODAL === */
.filemaker-pipeline-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    margin: 50px auto;
    position: relative;
    z-index: 10001;
    max-height: 80vh;
    overflow-y: auto;
}

.filemaker-pipeline-modal .filemaker-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.filemaker-pipeline-modal .filemaker-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.filemaker-pipeline-modal .filemaker-modal-body {
    padding: 25px;
}

.filemaker-pipeline-modal .filemaker-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filemaker-pipeline-modal .filemaker-modal-close:hover {
    color: #dc3545;
}

/* === PIPELINE RESULTS TABLE === */
.filemaker-pipeline-results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filemaker-pipeline-results-table thead {
    background: #f8f9fa;
}

.filemaker-pipeline-results-table th,
.filemaker-pipeline-results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.filemaker-pipeline-results-table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filemaker-pipeline-results-table td {
    color: #212529;
    font-size: 14px;
}

.filemaker-pipeline-results-table tbody tr:hover {
    background: #f8f9fa;
}

.filemaker-pipeline-results-table tbody tr:last-child td {
    border-bottom: none;
}

.filemaker-action-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.filemaker-action-menu-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.filemaker-action-menu-body {
    padding: 25px;
}

.filemaker-action-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

/* === ACTION BUTTONS CONTAINER === */
.filemaker-action-buttons {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

/* Two-column layout for more than 3 buttons */
.filemaker-action-buttons:has(.filemaker-action-btn:nth-child(4)) {
    grid-template-columns: 1fr 1fr;
}

/* === BASE ACTION BUTTON STYLES === */
.filemaker-action-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #495057;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.filemaker-action-btn:hover {
    border-color: #007cba;
    background: #f8f9fa;
    color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
}

.filemaker-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 124, 186, 0.2);
}

/* Icon styling */
.filemaker-action-btn .dashicons {
    margin-right: 12px;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* === THEME VARIATIONS === */

/* Primary Theme - Blue accent */
.filemaker-action-buttons.theme-primary .filemaker-action-btn:hover {
    border-color: #007cba;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
}

/* Success Theme - Green accent */
.filemaker-action-buttons.theme-success .filemaker-action-btn:hover {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

/* Warning Theme - Orange accent */
.filemaker-action-buttons.theme-warning .filemaker-action-btn:hover {
    border-color: #ffc107;
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

/* Danger Theme - Red accent */
.filemaker-action-buttons.theme-danger .filemaker-action-btn:hover {
    border-color: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

/* Info Theme - Cyan accent */
.filemaker-action-buttons.theme-info .filemaker-action-btn:hover {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

/* Dark Theme - Dark accent */
.filemaker-action-buttons.theme-dark .filemaker-action-btn:hover {
    border-color: #343a40;
    background: linear-gradient(135deg, #343a40 0%, #23272b 100%);
    color: white;
}

/* === SIZE VARIATIONS === */

/* Small/Compact buttons */
.filemaker-action-buttons.size-small .filemaker-action-btn,
.filemaker-action-buttons.size-compact .filemaker-action-btn {
    padding: 10px 15px;
    font-size: 14px;
    min-height: 45px;
}

.filemaker-action-buttons.size-small .filemaker-action-btn .dashicons,
.filemaker-action-buttons.size-compact .filemaker-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

/* Large buttons */
.filemaker-action-buttons.size-large .filemaker-action-btn {
    padding: 20px 25px;
    font-size: 16px;
    min-height: 80px;
}

.filemaker-action-buttons.size-large .filemaker-action-btn .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    margin-right: 15px;
}

/* === LAYOUT VARIATIONS === */

/* Horizontal layout */
.filemaker-action-buttons.layout-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filemaker-action-buttons.layout-horizontal .filemaker-action-btn {
    justify-content: center;
    text-align: center;
}

/* Icon-only layout */
.filemaker-action-buttons.layout-icons-only {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.filemaker-action-buttons.layout-icons-only .filemaker-action-btn {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 15px 10px;
    font-size: 12px;
    min-height: 80px;
}

.filemaker-action-buttons.layout-icons-only .filemaker-action-btn .dashicons {
    margin-right: 0;
    margin-bottom: 8px;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* === INDIVIDUAL BUTTON STYLING BY ACTION TYPE === */

/* Form actions - Blue */
.filemaker-action-btn[data-action-key*="edit"],
.filemaker-action-btn[data-action-key*="form"] {
    border-left: 4px solid #007cba;
}

/* View actions - Green */
.filemaker-action-btn[data-action-key*="view"],
.filemaker-action-btn[data-action-key*="show"] {
    border-left: 4px solid #28a745;
}

/* Print/Export actions - Orange */
.filemaker-action-btn[data-action-key*="print"],
.filemaker-action-btn[data-action-key*="export"],
.filemaker-action-btn[data-action-key*="download"] {
    border-left: 4px solid #ffc107;
}

/* Delete/Danger actions - Red */
.filemaker-action-btn[data-action-key*="delete"],
.filemaker-action-btn[data-action-key*="remove"] {
    border-left: 4px solid #dc3545;
}

/* Analytics/Report actions - Purple */
.filemaker-action-btn[data-action-key*="check"],
.filemaker-action-btn[data-action-key*="report"],
.filemaker-action-btn[data-action-key*="analytics"] {
    border-left: 4px solid #6f42c1;
}

/* === RESPONSIVE DESIGN === */
@media screen and (max-width: 768px) {
    .filemaker-action-menu-modal {
        margin: 20px auto;
        width: 95%;
    }
    
    .filemaker-action-menu-header,
    .filemaker-action-menu-body {
        padding: 15px 20px;
    }
    
    .filemaker-action-buttons {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    .filemaker-action-btn {
        padding: 12px 15px;
        font-size: 14px;
        min-height: 50px;
    }
}

@media screen and (max-width: 480px) {
    .filemaker-action-menu-header h3 {
        font-size: 16px;
    }
    
    .filemaker-action-btn {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 45px;
    }
    
    .filemaker-action-btn .dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }
}

/* === ANIMATION EFFECTS === */

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filemaker-action-buttons.animate-fade .filemaker-action-btn {
    animation: fadeInUp 0.3s ease forwards;
}

.filemaker-action-buttons.animate-fade .filemaker-action-btn:nth-child(1) { animation-delay: 0.1s; }
.filemaker-action-buttons.animate-fade .filemaker-action-btn:nth-child(2) { animation-delay: 0.2s; }
.filemaker-action-buttons.animate-fade .filemaker-action-btn:nth-child(3) { animation-delay: 0.3s; }
.filemaker-action-buttons.animate-fade .filemaker-action-btn:nth-child(4) { animation-delay: 0.4s; }
.filemaker-action-buttons.animate-fade .filemaker-action-btn:nth-child(5) { animation-delay: 0.5s; }

/* Slide in animation */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filemaker-action-buttons.animate-slide .filemaker-action-btn {
    animation: slideInUp 0.4s ease-out forwards;
}

.filemaker-action-buttons.animate-slide .filemaker-action-btn:nth-child(1) { animation-delay: 0.05s; }
.filemaker-action-buttons.animate-slide .filemaker-action-btn:nth-child(2) { animation-delay: 0.1s; }
.filemaker-action-buttons.animate-slide .filemaker-action-btn:nth-child(3) { animation-delay: 0.15s; }
.filemaker-action-buttons.animate-slide .filemaker-action-btn:nth-child(4) { animation-delay: 0.2s; }
.filemaker-action-buttons.animate-slide .filemaker-action-btn:nth-child(5) { animation-delay: 0.25s; }

/* Zoom in animation */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.filemaker-action-buttons.animate-zoom .filemaker-action-btn {
    animation: zoomIn 0.3s ease-out forwards;
}

.filemaker-action-buttons.animate-zoom .filemaker-action-btn:nth-child(1) { animation-delay: 0.05s; }
.filemaker-action-buttons.animate-zoom .filemaker-action-btn:nth-child(2) { animation-delay: 0.1s; }
.filemaker-action-buttons.animate-zoom .filemaker-action-btn:nth-child(3) { animation-delay: 0.15s; }
.filemaker-action-buttons.animate-zoom .filemaker-action-btn:nth-child(4) { animation-delay: 0.2s; }
.filemaker-action-buttons.animate-zoom .filemaker-action-btn:nth-child(5) { animation-delay: 0.25s; }

/* Ripple effect */
.filemaker-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 124, 186, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.filemaker-action-btn:active::before {
    width: 300px;
    height: 300px;
}

/* ===========================================
   Result Actions (Pipeline Result Row Actions)
   =========================================== */

/* Actions column in result table */
.filemaker-pipeline-results-table .fm-actions-column {
    width: 120px;
    text-align: center;
    white-space: nowrap;
}

/* Single action button */
.fm-result-action-btn.button {
    font-size: 12px;
    padding: 4px 10px;
    height: auto;
    line-height: 1.4;
    text-align: center;
    justify-content: center;
}

.fm-result-action-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 3px;
    color: inherit;
}

/* Also apply to dashicons inside i tags */
.fm-result-action-btn i.dashicons {
    font-style: normal;
    color: inherit;
}

/* Actions dropdown container */
.fm-result-actions-dropdown {
    position: relative;
    display: inline-block;
}

.fm-result-actions-toggle {
    padding: 4px 8px !important;
    min-width: 32px;
}

.fm-result-actions-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* Dropdown menu */
.fm-result-actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
}

.fm-result-actions-dropdown.open .fm-result-actions-menu {
    display: block;
}

.fm-result-actions-menu .fm-result-action-btn {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.fm-result-actions-menu .fm-result-action-btn:last-child {
    border-bottom: none;
}

.fm-result-actions-menu .fm-result-action-btn:hover {
    background: #f5f5f5;
    color: #007cba;
}

.fm-result-actions-menu .fm-result-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
    color: #666;
}

.fm-result-actions-menu .fm-result-action-btn:hover .dashicons {
    color: #007cba;
}

/* Pipeline modal sizing for result tables */
.pipeline-table-modal {
    max-width: 90%;
    width: auto;
    min-width: 500px;
}

.pipeline-table-modal .filemaker-modal-body {
    max-height: 70vh;
    overflow: auto;
}

/* ================================================
   DIFF VIEWER STYLES
   ================================================ */

.fm-diff-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100001;
}

.fm-diff-viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.fm-diff-viewer-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Header - matching Clause Library style */
.fm-diff-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #1A56A3;
    border-radius: 8px 8px 0 0;
}

.fm-diff-viewer-header h3 {
    margin: 0;
    color: #fff !important;
    font-size: 18px;
    font-weight: 600;
}

.fm-diff-icon {
    display: none;
}

/* Close button - simple style like Clause Library */
.fm-diff-viewer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.fm-diff-viewer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Subheader - matching Schema Editor toolbar */
.fm-diff-viewer-subheader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: #2667C1;
    color: #fff;
    border-bottom: 1px solid #1A56A3;
}

.fm-diff-version-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-diff-old-badge,
.fm-diff-new-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.fm-diff-old-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #856404;
}

.fm-diff-new-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #155724;
}

.fm-diff-date {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.fm-diff-arrow {
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
}

.fm-diff-viewer-summary {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.fm-diff-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.fm-diff-stat .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.fm-diff-stat-changed {
    background: #fff3cd;
    color: #856404;
}

.fm-diff-stat-added {
    background: #d4edda;
    color: #155724;
}

.fm-diff-stat-removed {
    background: #f8d7da;
    color: #721c24;
}

.fm-diff-viewer-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.fm-diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fm-diff-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    z-index: 1;
}

.fm-diff-field-col {
    width: 25%;
}

.fm-diff-old-col,
.fm-diff-new-col {
    width: 37.5%;
}

.fm-diff-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.fm-diff-table tbody td {
    padding: 10px 15px;
    vertical-align: top;
    word-break: break-word;
}

.fm-diff-field-name {
    font-weight: 500;
    color: #333;
    background: #fafafa;
}

/* Row states */
.fm-diff-row-changed .fm-diff-cell-old {
    background: #fff3cd;
}

.fm-diff-row-changed .fm-diff-cell-new {
    background: #d4edda;
}

.fm-diff-row-added .fm-diff-cell-new {
    background: #d4edda;
}

.fm-diff-row-added .fm-diff-cell-empty {
    background: #f5f5f5;
    color: #999;
}

.fm-diff-row-removed .fm-diff-cell-old {
    background: #f8d7da;
}

.fm-diff-row-removed .fm-diff-cell-empty {
    background: #f5f5f5;
    color: #999;
}

.fm-diff-row-unchanged {
    opacity: 0.7;
}

.fm-diff-row-hidden {
    display: none;
}

/* Value formatting */
.fm-diff-null {
    color: #999;
    font-style: italic;
}

.fm-diff-bool-true {
    color: #28a745;
    font-weight: 500;
}

.fm-diff-bool-false {
    color: #dc3545;
    font-weight: 500;
}

.fm-diff-number {
    color: #007bff;
    font-family: monospace;
}

.fm-diff-array,
.fm-diff-object {
    color: #6c757d;
    font-family: monospace;
    font-size: 12px;
    cursor: help;
}

.fm-diff-date-value {
    color: #6f42c1;
}

.fm-diff-string {
    color: #333;
}

/* Unchanged toggle */
.fm-diff-unchanged-toggle td {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
}

.fm-diff-show-unchanged {
    background: transparent;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    font-size: 12px;
    transition: all 0.2s;
}

.fm-diff-show-unchanged:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.fm-diff-show-unchanged .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Footer - matching Clause Library style */
.fm-diff-viewer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #bdc3c7;
    border-radius: 0 0 8px 8px;
}

/* Footer buttons - consistent with Schema Editor */
.fm-diff-viewer-footer .button,
.fm-diff-restore-btn,
.fm-diff-close-btn {
    padding: 6px 16px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 14px !important;
    height: 34px !important;
    line-height: 1 !important;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fm-diff-restore-btn {
    background: #dc3545 !important;
    color: #fff !important;
}

.fm-diff-restore-btn:hover {
    background: #c82333 !important;
}

.fm-diff-restore-btn .dashicons {
    margin-right: 6px;
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.fm-diff-close-btn {
    background: #6C8FC1 !important;
    color: #fff !important;
    margin-left: auto;
}

.fm-diff-close-btn:hover {
    background: #5A7BAD !important;
}

/* Expandable nested elements */
.fm-diff-expandable {
    display: inline-block;
    width: 100%;
}

.fm-diff-expand-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.fm-diff-expand-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.fm-diff-expand-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform 0.15s;
}

.fm-diff-array-badge,
.fm-diff-object-badge {
    font-family: monospace;
    color: #6c757d;
}

.fm-diff-expand-content {
    margin-top: 8px;
    padding: 10px;
    background: #fafafa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.fm-diff-array-item {
    padding: 6px 8px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.fm-diff-array-item:last-child {
    border-bottom: none;
}

.fm-diff-array-index {
    font-family: monospace;
    font-size: 11px;
    color: #999;
    min-width: 30px;
    flex-shrink: 0;
}

.fm-diff-object-field {
    padding: 4px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fm-diff-field-key {
    font-weight: 500;
    color: #495057;
    min-width: 100px;
}

.fm-diff-truncated {
    cursor: help;
}

/* =========================================
   Schema Editor Modal Styles
   Based on Clause Library V2 Design System
   ========================================= */

/* Color Variables (matching Clause Library) */
.fm-schema-editor-modal {
    --schema-primary: #1A56A3;
    --schema-primary-hover: #144580;
    --schema-secondary: #2667C1;
    --schema-light-bg: #E8F0F8;
    --schema-border: #bdc3c7;
    --schema-text: #1A56A3;
    --schema-text-muted: #7f8c8d;
    --schema-success: #155724;
    --schema-warning: #856404;
}

.fm-schema-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fm-schema-editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fm-schema-editor-container {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header - matches Clause Library */
.fm-schema-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--schema-primary);
    color: #fff;
}

.fm-schema-editor-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff !important;
}

.fm-schema-icon {
    display: none; /* Remove emoji icon */
}

/* Close button - simple style like Clause Library */
.fm-schema-editor-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.fm-schema-editor-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Toolbar - secondary blue like panel headers */
.fm-schema-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--schema-secondary);
    color: #fff;
}

.fm-schema-collection-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fm-schema-collection-selector label {
    font-weight: 500;
    color: #fff;
    font-size: 14px;
}

.fm-schema-select {
    min-width: 220px;
    padding: 6px 12px;
    border: 1px solid var(--schema-border);
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    height: 34px;
}

/* Buttons - matching Clause Library style, same height as select */
.fm-schema-load-btn,
.fm-schema-save-btn,
.fm-schema-cancel-btn {
    padding: 6px 16px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 14px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px !important;
    line-height: 1 !important;
    box-sizing: border-box;
}

.fm-schema-load-btn {
    background: #fff !important;
    color: var(--schema-primary) !important;
}

.fm-schema-load-btn:hover {
    background: var(--schema-light-bg) !important;
}

.fm-schema-load-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fm-schema-save-btn {
    background: var(--schema-primary) !important;
    color: #fff !important;
}

.fm-schema-save-btn:hover {
    background: var(--schema-primary-hover) !important;
}

.fm-schema-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fm-schema-cancel-btn {
    background: #6C8FC1 !important;
    color: #fff !important;
}

.fm-schema-cancel-btn:hover {
    background: #5A7BAD !important;
}

.fm-schema-load-btn .dashicons,
.fm-schema-save-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.fm-schema-server-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

/* Body */
.fm-schema-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #f5f5f5;
}

.fm-schema-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--schema-text-muted);
}

.fm-schema-empty-state .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
    color: var(--schema-primary);
}

.fm-schema-empty-state p {
    margin: 0;
    font-size: 14px;
}

.fm-schema-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--schema-text-muted);
}

.fm-schema-loading .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    color: var(--schema-primary);
}

/* Spin animation */
.fm-spin {
    animation: fm-spin 1s linear infinite;
}

@keyframes fm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Legend - simplified */
.fm-schema-legend {
    display: flex;
    gap: 24px;
    padding: 12px 20px;
    background: var(--schema-light-bg);
    border-bottom: 1px solid var(--schema-border);
    font-size: 13px;
    color: var(--schema-text);
}

.fm-schema-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Fields Table */
.fm-schema-fields-container {
    background: #fff;
}

.fm-schema-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.fm-schema-fields-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 2px solid var(--schema-border);
    font-weight: 600;
    color: var(--schema-text);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.fm-schema-fields-table th:hover {
    background: var(--schema-light-bg);
}

.fm-schema-fields-table th .sort-indicator {
    margin-left: 4px;
    opacity: 0.4;
}

.fm-schema-fields-table th.sorted .sort-indicator {
    opacity: 1;
}

.fm-schema-fields-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.fm-schema-fields-table tbody tr:hover {
    background: #f8f9fa;
}

/* Column widths - without Type column */
.fm-schema-col-field { width: 40%; }
.fm-schema-col-usage { width: 20%; }
.fm-schema-col-registry { width: 20%; text-align: center; }
.fm-schema-col-gdpr { width: 20%; }

.fm-schema-field-name code {
    font-size: 13px;
    color: var(--schema-text);
    background: var(--schema-light-bg);
    padding: 3px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Nested field styling */
.fm-schema-nested-field {
    background: #fafafa;
}

.fm-schema-nested-field:hover {
    background: #f0f4f8;
}

.fm-schema-nested-indicator {
    color: var(--schema-text-muted);
    margin-right: 4px;
    font-family: monospace;
}

.fm-schema-type-hint {
    font-size: 11px;
    color: var(--schema-text-muted);
    margin-left: 8px;
    font-style: italic;
}

.fm-schema-usage-na {
    color: var(--schema-text-muted);
}

/* Usage bar */
.fm-schema-usage-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.fm-schema-usage-fill-container {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.fm-schema-usage-fill {
    height: 100%;
    background: var(--schema-primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.fm-schema-usage-text {
    font-size: 12px;
    color: var(--schema-text-muted);
    min-width: 40px;
    text-align: right;
}

/* Checkbox styling */
.fm-schema-registry-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--schema-primary);
}

.fm-schema-field-registry {
    text-align: center;
}

/* GDPR select */
.fm-schema-gdpr-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--schema-border);
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}

.fm-schema-gdpr-select:focus {
    border-color: var(--schema-primary);
    outline: none;
}

/* Footer */
.fm-schema-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid var(--schema-border);
}

.fm-schema-footer-left {
    flex: 1;
}

.fm-schema-footer-right {
    display: flex;
    gap: 10px;
}

.fm-schema-status {
    font-size: 13px;
    color: var(--schema-text-muted);
}

.fm-schema-status-modified {
    color: var(--schema-warning);
    font-weight: 500;
}

.fm-schema-status-saved {
    color: var(--schema-success);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .fm-schema-editor-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .fm-schema-editor-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .fm-schema-collection-selector {
        flex-wrap: wrap;
    }
    
    .fm-schema-select {
        flex: 1;
        min-width: 150px;
    }
    
    .fm-schema-legend {
        flex-direction: column;
        gap: 8px;
    }
    
    .fm-schema-fields-table {
        font-size: 13px;
    }
    
    .fm-schema-col-usage {
        display: none;
    }
}
