/* ═══════════════════════════════════════════════════════════════
   FMM Monument Builder v21 — Frontend Styles
   Inspired by Signature Headstones layout
═══════════════════════════════════════════════════════════════ */

:root {
    --fmm-gold:       #c8a84b;
    --fmm-gold-light: #f5edd6;
    --fmm-dark:       #1a1a1a;
    --fmm-gray:       #666;
    --fmm-border:     #e0ddd6;
    --fmm-card-bg:    #f9f7f2;
    --fmm-input-bg:   #ffffff;
    --fmm-radius:     4px;
    --fmm-ease:       0.18s ease;
}

/* ── Canvas wrap ───────────────────────────────────────────── */
.fmm-canvas-wrap {
    overflow: visible;
    width: 100%;
    margin: 0;
    background: #111;
    border-radius: var(--fmm-radius);
}

.fmm-canvas-container {
    position: relative;
    width: 100%;
    line-height: 0;
    background: #111;
    border-radius: var(--fmm-radius);
    overflow: hidden;
}

.fmm-canvas-bg { display: none; }

.fmm-canvas-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 13px;
}

#fmm-canvas {
    display: block !important;
    width: 100% !important;
    height: auto !important;
}

.fmm-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1a1a1a;
    flex-wrap: wrap;
}

.fmm-tool-btn,
.fmm-btn-download {
    background: transparent;
    border: 1px solid rgba(200,168,75,0.6);
    color: var(--fmm-gold);
    padding: 4px 12px;
    border-radius: var(--fmm-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fmm-ease);
    white-space: nowrap;
}

.fmm-tool-btn:hover,
.fmm-btn-download:hover {
    background: var(--fmm-gold);
    color: #fff;
    border-color: var(--fmm-gold);
}

#fmm-proof-indicator {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.fmm-canvas-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    padding: 6px 12px;
    margin: 0;
    background: rgba(0,0,0,0.4);
    line-height: 1.5;
}

.fmm-layout-badge { margin: 0 0 10px; }
.fmm-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .4px; }
.fmm-badge-double { background: var(--fmm-dark); color: #fff; }

/* ════════════════════════════════════════════════════════════
   STEP CARDS
════════════════════════════════════════════════════════════ */
.fmm-configurator {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.fmm-step-card {
    border: 1px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    overflow: hidden;
    background: var(--fmm-input-bg);
}

.fmm-step-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--fmm-card-bg);
    border-bottom: 1px solid var(--fmm-border);
}

.fmm-step-num-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fmm-dark);
    color: var(--fmm-gold);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 4px 10px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.fmm-step-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fmm-dark);
}

.fmm-step-card-title em {
    font-weight: 400;
    color: var(--fmm-gray);
    font-style: normal;
}

.fmm-step-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Field blocks ──────────────────────────────────────────── */
.fmm-field-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fmm-field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--fmm-dark);
    gap: 8px;
}

.fmm-field-label-sm {
    font-size: 11px;
    font-weight: 600;
    color: var(--fmm-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fmm-required { color: #c0392b; font-size: 11px; }
.fmm-inline-error { color: #c0392b; font-size: 12px; margin: 2px 0 0; }

.fmm-char-count {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
    flex-shrink: 0;
}
.fmm-char-count.fmm-near-limit { color: #e67e22; font-weight: 600; }
.fmm-char-count.fmm-at-limit   { color: #c0392b; font-weight: 700; }

/* ── Inputs ────────────────────────────────────────────────── */
.fmm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    font-size: 14px;
    background: var(--fmm-input-bg);
    color: var(--fmm-dark);
    transition: border-color var(--fmm-ease);
    appearance: none;
}

.fmm-input:focus {
    outline: none;
    border-color: var(--fmm-gold);
    box-shadow: 0 0 0 2px rgba(200,168,75,0.15);
}

.fmm-textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.5;
}

.fmm-epitaph-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ════════════════════════════════════════════════════════════
   MONUMENT TYPE BUTTONS
════════════════════════════════════════════════════════════ */
.fmm-btn-group {
    display: flex;
    gap: 8px;
}

.fmm-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    background: var(--fmm-input-bg);
    cursor: pointer;
    transition: all var(--fmm-ease);
    font-family: inherit;
}

.fmm-type-icon {
    font-size: 18px;
    color: var(--fmm-gray);
    line-height: 1;
}

.fmm-type-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--fmm-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fmm-type-btn:hover {
    border-color: var(--fmm-gold);
}

.fmm-type-btn--active {
    border-color: var(--fmm-gold) !important;
    background: var(--fmm-gold-light) !important;
}

.fmm-type-btn--active .fmm-type-icon,
.fmm-type-btn--active .fmm-type-label {
    color: #8a6a00;
}

/* ════════════════════════════════════════════════════════════
   FONT TILE GRID (Step 1 visual font selector)
════════════════════════════════════════════════════════════ */
.fmm-font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.fmm-font-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 8px 10px;
    border: 1.5px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    background: var(--fmm-input-bg);
    cursor: pointer;
    transition: all var(--fmm-ease);
    text-align: center;
    user-select: none;
    min-height: 72px;
}

.fmm-font-tile:hover {
    border-color: var(--fmm-gold);
    background: var(--fmm-gold-light);
}

.fmm-font-tile--active {
    border-color: var(--fmm-gold) !important;
    background: var(--fmm-gold-light) !important;
    box-shadow: 0 0 0 1px var(--fmm-gold);
}

.fmm-font-tile-sample {
    font-size: 24px;
    color: var(--fmm-dark);
    line-height: 1.1;
    display: block;
}

.fmm-font-tile-img {
    max-height: 36px;
    width: auto;
    display: block;
}

.fmm-font-tile-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--fmm-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* ════════════════════════════════════════════════════════════
   PER-LINE FONT (compact inline)
════════════════════════════════════════════════════════════ */
.fmm-font-inline {
    display: none;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.fmm-font-inline--visible { display: flex; }

.fmm-font-options-inline {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.fmm-font-option-sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--fmm-border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: var(--fmm-input-bg);
    transition: all var(--fmm-ease);
    white-space: nowrap;
}

.fmm-font-option-sm:hover,
.fmm-font-option-sm--active,
.fmm-font-option-sm:has(input:checked) {
    border-color: var(--fmm-gold);
    background: var(--fmm-gold-light);
    color: #8a6a00;
}

.fmm-font-option-sm input { display: none; }
.fmm-font-img-sm { max-height: 18px; width: auto; }

/* Line group error state */
.fmm-line-group.fmm-error .fmm-input {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.1);
}

/* Double monument grid */
.fmm-double-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.fmm-col-left,
.fmm-col-right {
    border-left: 1px solid var(--fmm-border);
    padding-left: 12px;
}

.fmm-col-heading {
    font-size: 11px;
    font-weight: 700;
    color: var(--fmm-gold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--fmm-gold-light);
}

@media (max-width: 680px) {
    .fmm-double-grid { grid-template-columns: 1fr; }
    .fmm-col-left, .fmm-col-right {
        border-left: none;
        border-top: 1px solid var(--fmm-border);
        padding-left: 0;
        padding-top: 10px;
    }
}

/* ════════════════════════════════════════════════════════════
   UPLOAD TOGGLE ACCORDION
════════════════════════════════════════════════════════════ */
.fmm-upload-block {
    border: 1px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    overflow: hidden;
}

.fmm-upload-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--fmm-card-bg);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--fmm-dark);
    text-align: left;
    transition: background var(--fmm-ease);
}

.fmm-upload-toggle:hover { background: var(--fmm-gold-light); }

.fmm-upload-toggle[aria-expanded="true"] {
    background: var(--fmm-gold-light);
    color: #8a6a00;
    border-bottom: 1px solid var(--fmm-border);
}

.fmm-upload-toggle[aria-expanded="true"] .fmm-upload-toggle-icon {
    transform: rotate(45deg);
    color: var(--fmm-gold);
}

.fmm-upload-toggle-icon {
    font-size: 18px;
    font-weight: 400;
    color: var(--fmm-gold);
    transition: transform var(--fmm-ease);
    flex-shrink: 0;
    line-height: 1;
}

.fmm-upload-toggle-sub {
    font-size: 11px;
    font-weight: 400;
    color: var(--fmm-gray);
    margin-left: auto;
    white-space: nowrap;
}

.fmm-upload-panel {
    display: none;
    background: var(--fmm-input-bg);
}

.fmm-upload-panel.fmm-open { display: block; }

.fmm-upload-inner {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fmm-upload-desc {
    font-size: 13px;
    color: var(--fmm-gray);
    margin: 0;
    line-height: 1.5;
}

/* Drop zone */
.fmm-upload-dropzone {
    position: relative;
    border: 2px dashed var(--fmm-border);
    border-radius: var(--fmm-radius);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--fmm-ease), background var(--fmm-ease);
    cursor: pointer;
    overflow: hidden;
}

.fmm-upload-dropzone:hover,
.fmm-upload-dropzone.fmm-drag-over {
    border-color: var(--fmm-gold);
    background: var(--fmm-gold-light);
}

.fmm-upload-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.fmm-upload-dropzone-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    text-align: center;
    pointer-events: none;
}

.fmm-upload-icon {
    font-size: 28px;
    color: var(--fmm-gray);
    line-height: 1;
}

.fmm-upload-cta {
    font-size: 13px;
    font-weight: 600;
    color: var(--fmm-dark);
    margin: 0;
}

.fmm-upload-formats {
    font-size: 11px;
    color: var(--fmm-gray);
    margin: 0;
}

/* Upload preview */
.fmm-upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--fmm-card-bg);
    border-radius: var(--fmm-radius);
}

.fmm-upload-preview img {
    max-height: 70px;
    max-width: 120px;
    object-fit: contain;
    border-radius: 3px;
    border: 1px solid var(--fmm-border);
}

.fmm-upload-remove {
    background: none;
    border: 1px solid #ddd;
    color: #c0392b;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--fmm-radius);
    cursor: pointer;
    margin-left: auto;
}

.fmm-upload-remove:hover { background: #fdf0f0; }

.fmm-upload-note {
    font-size: 12px;
    margin: 0;
}

.fmm-upload-note.fmm-error { color: #c0392b; }
.fmm-upload-note.fmm-success { color: #27ae60; }

.fmm-upload-range {
    width: 100%;
    accent-color: var(--fmm-gold);
}

/* ── Epitaph section ───────────────────────────────────────── */
.fmm-epitaph-section { border-top: 1px dashed var(--fmm-border); padding-top: 12px; }

/* ── Footer note ───────────────────────────────────────────── */
.fmm-note {
    font-size: 12px;
    color: var(--fmm-gray);
    margin: 4px 0 0;
    padding: 8px 12px;
    background: var(--fmm-card-bg);
    border-left: 3px solid var(--fmm-gold);
    border-radius: 0 var(--fmm-radius) var(--fmm-radius) 0;
    line-height: 1.5;
}

/* ── Cart badge ────────────────────────────────────────────── */
.fmm-cart-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--fmm-gold);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Variation selectors in left column ───────────────────── */
.fmm-variations-only .single_add_to_cart_button,
.fmm-variations-only .quantity,
.fmm-variations-only .woocommerce-variation-price,
.fmm-variations-only .woocommerce-variation-availability { display: none !important; }

.fmm-variations-only .variations { width: 100%; border-collapse: collapse; }
.fmm-variations-only .variations td.label { font-weight: 600; font-size: 13px; padding-right: 12px; white-space: nowrap; vertical-align: middle; width: 70px; }
.fmm-variations-only .variations select { width: 100%; border: 1px solid var(--fmm-border); border-radius: var(--fmm-radius); padding: 8px 10px; font-size: 14px; background: #fff; }
.fmm-variations-only .reset_variations { font-size: 12px; color: var(--fmm-gold); display: block; margin-top: 4px; }

/* ── Cart button ───────────────────────────────────────────── */
.fmm-cart-button-only .variations,
.fmm-cart-button-only .woocommerce-variation.single_variation { display: none !important; }

.fmm-cart-button-only .single_add_to_cart_button {
    background-color: var(--fmm-gold) !important;
    border-color: #b8943b !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    padding: 12px 28px !important;
    border-radius: var(--fmm-radius) !important;
    width: 100% !important;
    cursor: pointer !important;
    transition: background .18s ease !important;
}

.fmm-cart-button-only .single_add_to_cart_button:hover { background-color: #b8943b !important; }

/* ── Canvas actions ────────────────────────────────────────── */
.fmm-canvas-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1a1a1a;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Engravings step ─────────────────────────────────── */
.fmm-engravings-body {
    padding: 8px 0;
}

.fmm-engravings-slot .variations {
    width: 100%;
    border-collapse: collapse;
}

.fmm-engravings-slot .variations td.label {
    font-weight: 600;
    font-size: 13px;
    padding-right: 14px;
    white-space: nowrap;
    vertical-align: middle;
    width: 100px;
}

.fmm-engravings-slot .variations select {
    width: 100%;
    border: 1px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--fmm-dark);
}

.fmm-engravings-slot .variations select:focus {
    outline: none;
    border-color: var(--fmm-gold);
    box-shadow: 0 0 0 2px rgba(200,168,75,0.15);
}

.fmm-engravings-slot .reset_variations {
    font-size: 12px;
    color: var(--fmm-gold);
    display: inline-block;
    margin-top: 4px;
}

.fmm-engravings-hint {
    font-size: 13px;
    color: #999;
    margin: 0;
    font-style: italic;
}

/* ── Engravings variation table inside Step 1 ── */
.fmm-variations-table {
    width: 100%;
    border-collapse: collapse;
}

.fmm-variations-table td.label {
    font-weight: 600;
    font-size: 13px;
    padding-right: 14px;
    white-space: nowrap;
    vertical-align: middle;
    width: 110px;
    padding: 6px 14px 6px 0;
}

.fmm-variations-table td.value {
    padding: 6px 0;
}

.fmm-variations-table select {
    width: 100%;
    border: 1px solid var(--fmm-border);
    border-radius: var(--fmm-radius);
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--fmm-dark);
}

.fmm-variations-table select:focus {
    outline: none;
    border-color: var(--fmm-gold);
    box-shadow: 0 0 0 2px rgba(200,168,75,0.15);
}

.fmm-variations-table .reset_variations {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--fmm-gold);
}

/* ── Font tile active state ── */
.fmm-font-tile--active {
    border-color: var(--fmm-gold) !important;
    background: var(--fmm-gold-lt) !important;
    box-shadow: 0 0 0 1px var(--fmm-gold) !important;
}
