/*
 * EDITORS.CSS - Shared Modal Editor Styling
 * ==========================================
 * Single source of truth for ALL editor modals in the system.
 * DO NOT duplicate these styles in component <style> blocks.
 *
 * Components using this: ChattelEditor, PropertyEditor, FamilyMemberEditor,
 * AddressEditor, PhoneNumberEditor, EmailAddressEditor, PhotoCropper,
 * ClientDetailsEditor, SocialProfileEditor, DocuSignModal, VaultEntryModal, etc.
 *
 * Form field styles are in forms.css (.firm-form-* classes)
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 * STRUCTURE
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 *   .editor-overlay       - Fixed overlay container (z-index: 99999)
 *   .editor-backdrop      - Dark blur behind modal
 *   .editor-modal         - White modal box (560px default)
 *     .editor-modal.medium  - 680px (FamilyMemberEditor, etc.)
 *     .editor-modal.wide    - 720px (complex editors)
 *     .editor-modal.small   - 420px (phone/email editors)
 *   .editor-header        - Title + close button
 *   .editor-body          - Scrollable content area
 *   .editor-footer        - Action buttons
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 * USAGE
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 * <div class="editor-overlay">
 *     <div class="editor-backdrop" @onclick="Cancel"></div>
 *     <div class="editor-modal">           <!-- or .editor-modal.medium/.wide -->
 *         <div class="editor-header">
 *             <h3>Title</h3>
 *             <button class="editor-close" @onclick="Cancel">
 *                 <i class="fas fa-times"></i>
 *             </button>
 *         </div>
 *         <div class="editor-body">
 *             <div class="form-section">
 *                 <div class="section-title">Section</div>
 *                 <div class="firm-form-row">
 *                     <div class="firm-form-group">...</div>
 *                     <div class="firm-form-group">...</div>
 *                 </div>
 *             </div>
 *         </div>
 *         <div class="editor-footer">
 *             <div class="editor-footer-left">
 *                 <button class="btn-archive">Archive</button>
 *                 <button class="btn-delete">Delete</button>
 *             </div>
 *             <div class="editor-footer-right">
 *                 <button class="btn-cancel">Cancel</button>
 *                 <button class="btn-save">Save</button>
 *             </div>
 *         </div>
 *     </div>
 * </div>
 *
 */

/* ============================================
   OVERLAY & BACKDROP
   ============================================ */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.editor-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

/* ============================================
   MODAL BOX
   ============================================ */
.editor-modal {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 560px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Width variants */
.editor-modal.small {
    width: 420px;
}

.editor-modal.medium {
    width: 680px;
}

.editor-modal.wide {
    width: 720px;
}

/* ============================================
   HEADER
   ============================================ */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.editor-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.editor-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* ============================================
   BODY - Scrollable content area
   ============================================ */
.editor-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================
   FORM SECTIONS - Grouped fields with
   bottom-border separators between sections.
   Scoped to .editor-body to beat SmartForm's
   ::deep .form-section box styling.
   ============================================ */
.editor-body .form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
}

.editor-body .form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.section-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* Small button next to section title */
.section-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f1f5f9;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.section-action-btn:hover {
    background: #e2e8f0;
    color: #1e3a5f;
}

/* Optional label indicator */
.optional {
    font-weight: 400;
    color: #94a3b8;
    font-size: 12px;
}

/* ============================================
   TWO-COLUMN ROW
   ============================================ */
.firm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .firm-form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FOOTER - Action buttons
   ============================================ */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.editor-footer-left {
    display: flex;
    gap: 8px;
}

.editor-footer-right {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* ============================================
   BUTTONS - Standard button classes
   Used by all editors, confirm bars, footers
   ============================================ */
.btn-save {
    padding: 10px 20px;
    border: none;
    background: #1e3a5f;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save:hover:not(:disabled) {
    background: #2d4a6f;
}

.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 10px 20px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-secondary {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-archive {
    padding: 10px 16px;
    border: 1px solid #fcd34d;
    background: #fefce8;
    color: #a16207;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-archive:hover {
    background: #fef9c3;
}

.btn-delete {
    padding: 10px 16px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete:hover {
    background: #fee2e2;
}

.btn-danger {
    padding: 10px 16px;
    border: none;
    background: #dc2626;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    padding: 10px 16px;
    border: none;
    background: #d97706;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
}

.btn-warning:hover {
    background: #b45309;
}

/* ============================================
   CONFIRMATION BAR - Archive/Delete confirm
   Sits in footer-left, replaces action buttons
   ============================================ */
.confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.confirm-bar-warning,
.confirm-bar.warning {
    background: #fefce8;
    border: 1px solid #fcd34d;
    color: #a16207;
}

.confirm-bar-danger,
.confirm-bar.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.confirm-message {
    font-size: 13px;
    font-weight: 500;
}

.confirm-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   TOGGLE BUTTONS (e.g., Item/Collection)
   ============================================ */
.firm-toggle-group {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: white;
}

.firm-toggle-group.small {
    display: inline-flex;
}

.firm-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: none;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.firm-toggle-btn:not(:last-child) {
    border-right: 1px solid #e2e8f0;
}

.firm-toggle-btn:hover:not(.active) {
    background: #f1f5f9;
}

.firm-toggle-btn.active {
    background: #1e3a5f;
    color: white;
}

.firm-toggle-btn i {
    font-size: 16px;
}

/* ============================================
   INFO/NUDGE NOTES
   ============================================ */

/* Yellow nudge (informational, not blocking) */
.type-nudge {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0 4px 0;
    padding: 10px 12px;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 6px;
    font-size: 13px;
    color: #854d0e;
    line-height: 1.4;
}

.type-nudge i {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Light blue hint (collections) */
.collection-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #e0f2fe;
    border-radius: 6px;
    font-size: 13px;
    color: #0369a1;
}

.collection-hint i {
    flex-shrink: 0;
}

/* Dark blue compliance note */
.compliance-note {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 13px;
    color: #0c4a6e;
}

.compliance-note i {
    font-size: 18px;
    color: #0284c7;
    flex-shrink: 0;
    margin-top: 2px;
}

.compliance-note strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.compliance-note p {
    margin: 0;
    line-height: 1.5;
    color: #0369a1;
}

/* Green note (calculated values) */
.calculated-value-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 13px;
    color: #166534;
}

.calculated-value-note i {
    font-size: 14px;
    color: #22c55e;
}

/* Green inherit checkbox */
.inherit-option {
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}

.inherit-option .firm-checkbox {
    color: #166534;
}

/* ============================================
   INPUT VALIDATION STATES
   ============================================ */
.input-error {
    border-color: #ef4444 !important;
}

.input-error:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.hint-error {
    color: #dc2626 !important;
}

/* ============================================
   HINT TEXT
   ============================================ */
.firm-form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton-loading {
    animation: pulse 1.5s infinite;
}

.skeleton-section {
    margin-bottom: 24px;
}

.skeleton-toggle {
    height: 44px;
    background: #e2e8f0;
    border-radius: 8px;
    margin-bottom: 24px;
}

.skeleton-title {
    height: 14px;
    width: 120px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 16px;
}

.skeleton-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.skeleton-field {
    height: 44px;
    background: #e2e8f0;
    border-radius: 6px;
}

.skeleton-field-full {
    height: 44px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
