/**
 * exakt Doc Repository - Shared Fullscreen Metadata Editor styles
 *
 * v2.6.3 - Moved from admin.css so BOTH wp-admin and the frontend dashboard
 * use one editor. 65:35 preview/metadata split, line items panel, GL account
 * recommendation sections. Includes scoped button/zoom/pre styles so the
 * modal renders correctly on the frontend where wp-admin CSS is absent.
 */

.frm-fullscreen-metadata-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
    display: none;
}

.frm-fullscreen-metadata-container {
    width: 96%;
    height: 96%;
    margin: 2% auto;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.frm-fullscreen-metadata-header {
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.frm-fullscreen-metadata-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frm-fullscreen-metadata-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.frm-fullscreen-metadata-close:hover {
    color: #dc3232;
}

/* Body: 65:35 split */
.frm-fullscreen-metadata-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Left: Preview panel (65%) */
.frm-fs-preview-panel {
    flex: 0 0 65%;
    background: #2c2c2c;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.frm-fs-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 5px;
}

/* Zoom buttons (scoped so the frontend gets them without admin.css) */
.frm-fullscreen-metadata-modal .frm-zoom-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frm-fullscreen-metadata-modal .frm-zoom-btn:hover {
    background: white;
    transform: scale(1.1);
}

.frm-fs-preview-scroll {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.frm-fs-preview-pdf-scroll {
    padding: 0;
}

.frm-fs-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    transform-origin: center center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.frm-fs-preview-pdf {
    width: 100%;
    height: 100%;
    border: none;
}

.frm-preview-not-available {
    font-size: 18px;
    color: #999;
    text-align: center;
}

/* Right: Metadata panel (35%) */
.frm-fs-metadata-panel {
    flex: 0 0 35%;
    background: white;
    border-left: 2px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.frm-fs-metadata-header {
    padding: 15px 20px;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.frm-fs-metadata-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.frm-fs-metadata-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.frm-fs-form-field {
    margin-bottom: 18px;
}

.frm-fs-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.frm-fs-form-field label .required {
    color: #dc3232;
    font-weight: bold;
}

.frm-fs-form-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.frm-fs-form-field input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.frm-fs-form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 10px;
}

.frm-fs-form-actions .button {
    flex: 1;
    text-align: center;
}

/* Buttons (scoped) - the frontend has no wp-admin .button styles */
.frm-fullscreen-metadata-modal .button {
    display: inline-block;
    padding: 6px 14px;
    background: #f6f7f7;
    border: 1px solid #c5c5c5;
    border-radius: 4px;
    color: #2c3338;
    font-size: 13px;
    line-height: 1.6;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

.frm-fullscreen-metadata-modal .button:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
}

.frm-fullscreen-metadata-modal .button.button-small {
    padding: 2px 10px;
    font-size: 12px;
}

.frm-fullscreen-metadata-modal .button.button-large {
    padding: 10px 18px;
    font-size: 14px;
}

.frm-fullscreen-metadata-modal .button.button-primary {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.frm-fullscreen-metadata-modal .button.button-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.frm-fullscreen-metadata-modal .button:disabled {
    opacity: 0.6;
    cursor: default;
}

/* OCR/AI sections inside metadata panel */
.frm-fs-ocr-section {
    margin-top: 20px;
    padding: 15px;
    background: #f0f6fc;
    border-radius: 6px;
    border: 1px solid #c8d8e8;
}

.frm-fs-ocr-section.frm-gcv-json-section {
    background: #f5f0ff;
    border-color: #d8c8e8;
}

.frm-fs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.frm-fs-section-header h4 {
    margin: 0;
    font-size: 13px;
    color: #0073aa;
}

.frm-fs-ocr-section.frm-gcv-json-section .frm-fs-section-header h4 {
    color: #6b21a8;
}

.frm-fs-section-header small {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

/* Pre blocks (scoped so the frontend gets them without admin.css) */
.frm-fullscreen-metadata-modal .frm-gcv-admin-pre {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Consolas, Monaco, monospace;
    color: #333;
    margin: 0;
}

.frm-fullscreen-metadata-modal .frm-gcv-json-pre {
    background: #1e1e2e;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 12px;
    font-size: 11px;
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Consolas, Monaco, monospace;
    color: #cdd6f4;
    margin: 0;
}

/* ========================================
   Line Items Panel (fullscreen editor)
   ======================================== */

.frm-fs-line-items-panel {
    border-top: 2px solid #0073aa;
    flex-shrink: 0;
    max-height: 35%;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

.frm-fs-line-items-header {
    padding: 10px 20px;
    background: #f0f0f1;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.frm-fs-line-items-header h3 {
    margin: 0;
    font-size: 15px;
    color: #333;
}

.frm-line-items-count {
    font-weight: normal;
    color: #666;
    font-size: 13px;
}

.frm-fs-line-items-scroll {
    flex: 1;
    overflow: auto;
    padding: 10px 20px;
}

.frm-fs-line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.frm-fs-line-items-table th {
    background: #e9ecef;
    padding: 8px 6px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.frm-fs-line-items-table td {
    padding: 3px 4px;
}

.frm-fs-line-item-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    box-sizing: border-box;
}

.frm-fs-line-item-input:focus {
    border-color: #0073aa;
    outline: none;
}

.frm-line-item-num {
    text-align: center;
    color: #999;
    width: 30px;
    font-size: 12px;
}

.frm-fs-remove-line-item {
    background: none;
    border: none;
    color: #dc3232;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    padding: 0 4px;
}

.frm-fs-remove-line-item:hover {
    color: #a00;
}

.frm-add-line-item-btn {
    margin-top: 8px;
    background: none;
    border: 1px dashed #0073aa;
    color: #0073aa;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.frm-add-line-item-btn:hover {
    background: #f0f6fc;
}

/* ========================================
   Account recommendation sections
   ======================================== */

.frm-fs-account-rec-section {
    margin: 12px 0;
    padding: 10px 12px;
    background: #f0faf5;
    border: 1px solid #5cb85c;
    border-radius: 6px;
}

.frm-fs-account-rec-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.frm-fs-acc-header-display {
    flex: 1;
    min-width: 0;
}

/* Line items account column */
.frm-fs-account-cell {
    min-width: 140px;
    vertical-align: middle;
}

.frm-fs-account-cell .frm-fs-acc-display {
    display: inline;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1200px) {
    .frm-fullscreen-metadata-body {
        flex-direction: column;
    }

    .frm-fs-preview-panel {
        flex: 0 0 50%;
    }

    .frm-fs-metadata-panel {
        flex: 0 0 50%;
        border-left: none;
        border-top: 2px solid #ddd;
    }
}

@media (max-width: 768px) {
    .frm-fullscreen-metadata-container {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }

    .frm-fullscreen-metadata-body {
        flex-direction: column;
    }

    .frm-fs-preview-panel,
    .frm-fs-metadata-panel {
        flex: none;
        height: 50%;
    }

    .frm-fs-metadata-panel {
        border-left: none;
        border-top: 2px solid #ddd;
    }
}
