/*
 * QuantumFlex SmartForms — shared utility classes.
 * Copyright (c) 2025-2026 QuantumFlex AI Inc.
 *
 * Replaces inline style="..." attributes that previously required
 * CSP `style-src 'unsafe-inline'`. Each template that previously
 * used inline styles now links this stylesheet and applies the
 * matching utility class instead.
 *
 * Add new utilities here rather than scattering one-offs across
 * page-specific <style> blocks.
 */

/* Visibility. !important so .qf-hidden wins regardless of source order
 * vs page-specific layout classes (e.g. `.modal { display: flex }`).
 * Phase 2 of the CSP style-src migration moved all JS show/hide from
 * `el.style.display = ...` to `classList.add/remove/toggle('qf-hidden')`,
 * so the !important is no longer in conflict with anything. */
.qf-hidden { display: none !important; }

/* Sizing */
.qf-full-width { width: 100%; }
.qf-checkbox-auto-width { width: auto; }

/* Spacing */
.qf-mt-half { margin-top: 0.5rem; }
.qf-mt-1 { margin-top: 1rem; }
.qf-mt-2 { margin-top: 2rem; }
.qf-mb-1 { margin-bottom: 1rem; }
.qf-mb-1-25 { margin-bottom: 1.25rem; }
.qf-mb-16 { margin-bottom: 16px; }
.qf-mb-8 { margin-bottom: 8px; }
.qf-mt-16 { margin-top: 16px; }

/* Layout */
.qf-flex-row-center { display: flex; align-items: center; gap: 12px; }
.qf-flex-between-center { display: flex; justify-content: space-between; align-items: center; }
.qf-flex-justify-center { display: flex; justify-content: center; flex-wrap: wrap; gap: 2rem; margin-bottom: 1rem; }

/* Text */
.qf-text-muted { color: #475569; }
.qf-text-muted-light { color: #64748b; }
.qf-text-faint { color: #94a3b8; }
.qf-text-success { color: #22c55e; }
.qf-text-danger { color: #ef4444; }
.qf-text-warning { color: #fbbf24; }
.qf-text-yellow { color: #eab308; }
.qf-text-default { color: #e2e8f0; }
.qf-text-link { color: #0ea5e9; }
.qf-text-sm { font-size: 0.875rem; }
.qf-text-xs { font-size: 0.8rem; }
.qf-text-11 { font-size: 11px; }
.qf-text-12 { font-size: 12px; }
.qf-text-14 { font-size: 14px; }
.qf-no-decoration { text-decoration: none; }
.qf-word-break { word-break: break-all; }
.qf-opacity-70 { opacity: 0.7; }

/* Borders / dividers */
.qf-divider-top { border-top: 1px solid #334155; padding-top: 12px; margin-top: 4px; }

/* Footer / legal layout */
.qf-legal-footer {
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
}

/* Compose-area helpers used by form-view rendered output */
.qf-form-footer-stamp {
    margin-top: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Help-page row highlight */
.qf-row-highlight { background: #f0f9ff; }

/* Padded pseudo-empty cell */
.qf-padded-12 { padding: 12px; }
.qf-padding-x-4 { padding: 0 4px; }

/* Upgrade-button accent override (dashboard limit modal) */
.qf-upgrade-accent { background: #0ea5e9; }

/* Builder logo preview thumbnail */
.qf-logo-preview-img { max-width: 100%; max-height: 100px; }

/* Builder field row-break: applied via classList.toggle when field.newRow is true */
.qf-flex-basis-full { flex-basis: 100% !important; }

/* Cookie-consent banner. Was built via insertAdjacentHTML with inline
 * style="..." attributes — broke when CSP style-src dropped 'unsafe-inline'
 * (CRIT-5 phase 2). Migrated to DOM-API + classes here. MED-12 (May 2026
 * audit) ARIA additions live on the elements created in cookie-consent.js. */
.qf-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    z-index: 9999;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
}
.qf-cookie-banner-text { flex: 1; min-width: 300px; }
.qf-cookie-banner-text p { margin: 0; line-height: 1.5; }
.qf-cookie-banner-link { color: #38bdf8; text-decoration: underline; }
.qf-cookie-banner-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
.qf-cookie-banner-btn-accept {
    background: #0ea5e9;
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.qf-cookie-banner-btn-accept:hover { background: #0284c7; }
.qf-cookie-banner-btn-decline {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.qf-cookie-banner-btn-decline:hover { background: rgba(148, 163, 184, 0.1); }
.qf-cookie-banner-btn-learn {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

/* Cookie-consent banner slide-out animation (replaces inline transform/transition). */
.qf-cookie-banner-dismissed {
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

/* Modal fade-out animation (replaces inline opacity/transition in modal.js dismiss). */
.qf-modal-fade-out {
    opacity: 0;
    transition: opacity 0.15s;
}

/* Help-icon margin (replaces inline style in tooltips.js). */
.qf-help-icon-spacing { margin-left: 8px; }

/* Builder preview-modal layout */
.qf-preview-modal-content {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.qf-preview-modal-body {
    flex: 1;
    overflow: hidden;
    background: #f5f5f5;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}
.qf-preview-paper {
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    max-height: 100%;
}
.qf-preview-iframe {
    width: 816px;
    min-height: 1056px;
    border: none;
    display: block;
    background: white;
}
.qf-preview-iframe.qf-iframe-landscape {
    width: 1056px;
    min-height: 816px;
}
.qf-preview-footer-note {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Admin-users modal sizing */
.qf-modal-narrow { max-width: 600px; }

/* Chart bar label override (admin) */
.qf-chart-bar-label-horizontal {
    writing-mode: horizontal-tb;
    transform: none;
    height: auto;
}
