/*
 * cockpit-contract-review.css
 * ===========================
 *
 * Plain-language: the styles for the contract upload zone + the
 * inline side-by-side review screen. BEM-style class names with
 * the cockpit-contract-review-- prefix so the walkthrough engine
 * can target them precisely.
 *
 * Design contract:
 *   - The review is INLINE on the deal-detail page, not a modal.
 *     The manager scrolls between the contract text and the deal
 *     context freely.
 *   - The source pane is monospace (so quoted spans line up with
 *     the highlight rectangles). The fields pane stays in the
 *     default sans for readability.
 *   - Six highlight colors cycle so adjacent fields are visually
 *     distinct on the source pane. Hover state intensifies the
 *     matching highlight on the source side.
 */

.cockpit-contract-review {
    font-family: var(--cockpit-font-family, system-ui, -apple-system,
                    sans-serif);
    color: #1f2937;
}

/* ---------- Upload zone ---------- */

.cockpit-contract-review__upload {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
}

.cockpit-contract-review__upload-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #111827;
}

.cockpit-contract-review__dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}
.cockpit-contract-review__dropzone:hover,
.cockpit-contract-review__dropzone:focus {
    border-color: #6366f1;
    background-color: #f5f7ff;
    outline: none;
}
.cockpit-contract-review__dropzone--active {
    border-color: #4f46e5;
    background-color: #eef2ff;
}

.cockpit-contract-review__dropzone-helper {
    margin: 0 0 16px 0;
    color: #4b5563;
    font-size: 14px;
}

.cockpit-contract-review__upload-button {
    background: #4f46e5;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 120ms ease;
}
.cockpit-contract-review__upload-button:hover {
    background-color: #4338ca;
}

.cockpit-contract-review__progress {
    margin-top: 16px;
}
.cockpit-contract-review__progress-bar {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #4f46e5 0%, #818cf8 50%,
                                 #4f46e5 100%);
    background-size: 200% 100%;
    animation: cockpit-contract-review-shimmer 1.4s linear infinite;
}
@keyframes cockpit-contract-review-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.cockpit-contract-review__progress-label {
    margin: 8px 0 0 0;
    color: #4b5563;
    font-size: 13px;
}

.cockpit-contract-review__error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

/* ---------- Review screen ---------- */

.cockpit-contract-review__root {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
}

.cockpit-contract-review__header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
    margin-bottom: 16px;
}
.cockpit-contract-review__title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #111827;
}
.cockpit-contract-review__summary {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.cockpit-contract-review__helper {
    background: #f3f4f6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    margin: 0 0 16px 0;
}
.cockpit-contract-review__helper.error {
    background: #fef2f2;
    color: #991b1b;
}

.cockpit-contract-review__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
}
@media (max-width: 1024px) {
    .cockpit-contract-review__body {
        grid-template-columns: 1fr;
    }
}

.cockpit-contract-review__source h3,
.cockpit-contract-review__fields h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.cockpit-contract-review__source-text {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #1f2937;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.cockpit-contract-review__trimmed-badge {
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    font-family: var(--cockpit-font-family, system-ui, sans-serif);
}

/* Highlight cycle — six tones so adjacent fields don't collide. */
.cockpit-contract-review__highlight {
    border-radius: 3px;
    padding: 0 2px;
    cursor: help;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}
.cockpit-contract-review__highlight.color-0 { background: #fef3c7; }
.cockpit-contract-review__highlight.color-1 { background: #dbeafe; }
.cockpit-contract-review__highlight.color-2 { background: #d1fae5; }
.cockpit-contract-review__highlight.color-3 { background: #fce7f3; }
.cockpit-contract-review__highlight.color-4 { background: #ede9fe; }
.cockpit-contract-review__highlight.color-5 { background: #fee2e2; }
.cockpit-contract-review__highlight.hover {
    box-shadow: 0 0 0 2px #6366f1;
    background-color: #c7d2fe;
}

.cockpit-contract-review__fields-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cockpit-contract-review__field-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.cockpit-contract-review__field-card:hover {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px #eef2ff;
}
.cockpit-contract-review__field-card.tier-green {
    border-left: 3px solid #10b981;
}
.cockpit-contract-review__field-card.tier-amber {
    border-left: 3px solid #f59e0b;
}
.cockpit-contract-review__field-card.tier-red {
    border-left: 3px solid #ef4444;
}
.cockpit-contract-review__field-card.financial {
    background: #fffbeb;
}
.cockpit-contract-review__field-card.decision-accepted {
    background: #ecfdf5;
}
.cockpit-contract-review__field-card.decision-rejected {
    background: #fef2f2;
    opacity: 0.7;
}

.cockpit-contract-review__field-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.cockpit-contract-review__field-label {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}
.cockpit-contract-review__chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cockpit-contract-review__chip.tier-green {
    background: #d1fae5;
    color: #065f46;
}
.cockpit-contract-review__chip.tier-amber {
    background: #fef3c7;
    color: #92400e;
}
.cockpit-contract-review__chip.tier-red {
    background: #fee2e2;
    color: #991b1b;
}

.cockpit-contract-review__field-value {
    margin-bottom: 8px;
}
.cockpit-contract-review__field-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}
.cockpit-contract-review__field-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px #eef2ff;
}

.cockpit-contract-review__field-quote {
    margin: 8px 0;
    padding: 8px 12px;
    background: #f9fafb;
    border-left: 3px solid #9ca3af;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    font-size: 13px;
    color: #4b5563;
    quotes: '«' '»';
}

.cockpit-contract-review__field-noquote {
    margin: 8px 0;
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}

.cockpit-contract-review__financial-hint {
    margin: 6px 0 0 0;
    font-size: 12px;
    color: #92400e;
}

.cockpit-contract-review__field-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.cockpit-contract-review__field-accept,
.cockpit-contract-review__field-reject {
    flex: 1;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 120ms ease;
}
.cockpit-contract-review__field-accept {
    background: #ffffff;
    color: #065f46;
    border: 1px solid #10b981;
}
.cockpit-contract-review__field-accept:hover,
.cockpit-contract-review__field-accept.active {
    background: #10b981;
    color: #ffffff;
}
.cockpit-contract-review__field-reject {
    background: #ffffff;
    color: #991b1b;
    border: 1px solid #ef4444;
}
.cockpit-contract-review__field-reject:hover,
.cockpit-contract-review__field-reject.active {
    background: #ef4444;
    color: #ffffff;
}

.cockpit-contract-review__empty {
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

/* ---------- Footer actions ---------- */

.cockpit-contract-review__footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cockpit-contract-review__spacer {
    flex: 1;
}
.cockpit-contract-review__refresh,
.cockpit-contract-review__reject-all,
.cockpit-contract-review__cancel {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 120ms ease;
}
.cockpit-contract-review__refresh:hover,
.cockpit-contract-review__cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.cockpit-contract-review__reject-all:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}
.cockpit-contract-review__primary {
    background: #4f46e5;
    color: #ffffff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 120ms ease;
}
.cockpit-contract-review__primary:hover:not(:disabled) {
    background: #4338ca;
}
.cockpit-contract-review__primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
