/**
 * Advanced Product Pricing Form - Compact Frontend Calculator CSS
 * Optimized multi-column grid layout for reduced height & modern aesthetics.
 */

:root {
    --appf-primary: #c59b27;
    --appf-border: #d4af37;
    --appf-price: #0284c7;
    --appf-btn-bg: #c59b27;
    --appf-btn-color: #ffffff;
    --appf-radius: 8px;
    --appf-font-size: 14px;
}

/* Calculator Container */
.appf-calculator-container {
    box-sizing: border-box;
    border: 2px solid var(--appf-border);
    border-radius: var(--appf-radius);
    padding: 18px 20px;
    background: #ffffff;
    font-size: var(--appf-font-size);
    color: #1e293b;
    margin: 16px 0;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.appf-calculator-container *,
.appf-calculator-container *::before,
.appf-calculator-container *::after {
    box-sizing: border-box;
}

/* Field Rows - Compact Spacing */
.appf-field-row {
    margin-bottom: 14px;
    transition: opacity 0.2s ease;
}

.appf-field-row.appf-hidden {
    display: none !important;
}

.appf-field-label-wrap {
    margin-bottom: 6px;
}

.appf-field-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 700;
    font-size: 0.98em;
    color: #0f172a;
    line-height: 1.3;
    cursor: default;
}

.appf-selected-val-badge {
    font-weight: 500;
    color: #475569;
    margin-left: 4px;
}

.appf-selected-val-badge:not(:empty)::before {
    content: ": ";
    font-weight: 700;
    color: #0f172a;
    margin-right: 2px;
}

.appf-required-star {
    color: #ef4444;
    margin-left: 4px;
}

.appf-field-desc {
    margin: 2px 0 0;
    font-size: 0.82em;
    color: #64748b;
}

/* 1. Multi-Column Grid for Radio Items (Reduces Form Height dramatically) */
.appf-radio-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.appf-radio-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.appf-radio-item:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.appf-radio-item.appf-selected {
    border-color: var(--appf-primary);
    background-color: #fffdf5;
    box-shadow: 0 0 0 1px var(--appf-primary);
}

.appf-radio-input {
    width: 18px !important;
    height: 18px !important;
    margin: 0 6px 0 0 !important;
    accent-color: var(--appf-primary, #c59b27) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    opacity: 1 !important;
    position: relative !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.appf-radio-left {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.appf-radio-label {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.appf-radio-item.appf-selected .appf-radio-label {
    color: #0f172a;
    font-weight: 700;
}

.appf-price-pill {
    font-size: 0.78em;
    font-weight: 700;
    color: #0284c7;
    background: #e0f2fe;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.appf-base-price-pill {
    color: #0f172a;
    background: #f1f5f9;
}

/* 2. Button Pills / Swatches */
.appf-pills-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.appf-pill-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88em;
    color: #1e293b;
    background: #ffffff;
    transition: all 0.15s ease;
    user-select: none;
}

.appf-pill-item input[type="radio"] {
    display: none;
}

.appf-pill-item:hover {
    border-color: var(--appf-primary);
    background: #fffdf5;
}

.appf-pill-item.appf-active {
    border-color: #0f172a;
    background: #0f172a;
    color: #ffffff;
}

.appf-pill-item.appf-active .appf-pill-surcharge {
    background: rgba(255,255,255,0.25);
    color: #ffffff;
}

.appf-pill-surcharge {
    font-size: 0.78em;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    color: #475569;
}

/* 3. Select Dropdowns */
.appf-select-wrapper {
    width: 100%;
}

.appf-select-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.92em;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1e293b;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23475569" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.appf-select-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* 4. Single Checkbox */
.appf-single-check-item {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 8px;
    padding: 4px 0;
}

.appf-single-check-item input[type="checkbox"] {
    display: none;
}

.appf-check-box {
    width: 18px;
    height: 18px;
    border: 2px solid #94a3b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.appf-single-check-item input[type="checkbox"]:checked + .appf-check-box {
    background-color: var(--appf-primary);
    border-color: var(--appf-primary);
}

.appf-single-check-item input[type="checkbox"]:checked + .appf-check-box::after {
    content: "✓";
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.appf-check-label {
    font-weight: 600;
    font-size: 0.9em;
}

/* 5. Image Cards */
.appf-image-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.appf-img-card {
    display: flex;
    flex-direction: column;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.2s ease;
}

.appf-img-card input[type="radio"] {
    display: none;
}

.appf-img-card:hover {
    border-color: var(--appf-primary);
}

.appf-img-card.appf-selected {
    border-color: var(--appf-primary);
    box-shadow: 0 0 0 2px var(--appf-primary);
}

.appf-img-card-thumb {
    width: 100%;
    height: 80px;
    background: #f1f5f9;
    overflow: hidden;
}

.appf-img-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.appf-img-card-details {
    padding: 6px 8px;
    text-align: center;
}

.appf-img-card-title {
    font-size: 0.82em;
    font-weight: 600;
    display: block;
}

/* 6. Drag & Drop Artwork Upload Zone */
.appf-upload-zone {
    position: relative;
    border: 2px dashed #93c5fd;
    border-radius: 6px;
    padding: 16px 12px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.appf-upload-zone:hover,
.appf-upload-zone.appf-dragover {
    background: #eff6ff;
    border-color: #3b82f6;
}

.appf-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.appf-upload-icon {
    color: #64748b;
    margin-bottom: 4px;
}

.appf-upload-main-text {
    font-size: 0.88em;
    color: #1e293b;
    margin-bottom: 2px;
}

.appf-upload-sub-text {
    font-size: 0.78em;
    color: #64748b;
}

.appf-upload-progress {
    margin-top: 8px;
}

.appf-progress-bar {
    height: 5px;
    background: #3b82f6;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.appf-upload-status-text {
    font-size: 0.8em;
    color: #3b82f6;
    font-weight: 600;
}

.appf-upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 4px 10px;
    border-radius: 4px;
    color: #065f46;
    font-size: 0.82em;
    font-weight: 600;
}

.appf-remove-file-btn {
    background: none;
    border: none;
    color: #991b1b;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

/* 7. Text & Textarea Inputs */
.appf-text-input,
.appf-textarea-input,
.appf-number-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9em;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    font-family: inherit;
}

/* Clear link */
.appf-clear-link-wrap {
    margin-top: -6px;
    margin-bottom: 14px;
}

.appf-clear-btn {
    font-size: 0.8em;
    color: #e11d48;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.appf-clear-btn:hover {
    text-decoration: underline;
}

/* Footer Section */
.appf-pricing-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
    margin-top: 8px;
}

.appf-price-display-box {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.appf-unit-price-sub {
    font-size: 0.88em;
    color: #64748b;
    font-weight: 600;
    gap: 4px;
}

.appf-unit-val {
    color: #0f172a;
}

.appf-total-price-hero {
    font-size: 2em;
    font-weight: 800;
    color: var(--appf-price);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

/* CTA Row (Qty & Golden Button) */
.appf-cta-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.appf-qty-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.appf-qty-field label {
    font-size: 0.88em;
    font-weight: 700;
    color: #334155;
}

.appf-qty-box {
    width: 64px;
    height: 44px;
    border: 1px solid #64748b;
    border-radius: 4px;
    text-align: center;
    font-size: 1.05em;
    font-weight: 700;
    color: #0f172a;
    padding: 0 4px;
}

.appf-submit-field {
    flex: 1;
}

.appf-add-to-cart-btn {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(180deg, var(--appf-btn-bg), #a67c1e) !important;
    color: var(--appf-btn-color) !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 1.02em !important;
    font-weight: 700 !important;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
    text-transform: none !important;
}

.appf-add-to-cart-btn:hover {
    opacity: 0.94;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.appf-btn-icon {
    font-size: 1.15em;
}

/* Validation Notices */
.appf-validation-notices {
    margin-top: 10px;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 8px 12px;
    color: #991b1b;
    font-size: 0.85em;
    border-radius: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .appf-radio-grid-2col {
        grid-template-columns: 1fr;
    }
    .appf-calculator-container {
        padding: 14px;
    }
}

/* Option Price Badges Hide/Show Toggle */
.appf-calculator-container.appf-hide-option-prices .appf-price-pill,
.appf-calculator-container.appf-hide-option-prices .appf-pill-surcharge,
.appf-calculator-container.appf-hide-option-prices .appf-number-price-hint {
    display: none !important;
}

/* Number Input & Dimensions Styling */
.appf-number-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.appf-number-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.appf-number-input-group .appf-number-input {
    width: 100%;
    padding-right: 50px;
}

.appf-number-unit-suffix {
    position: absolute;
    right: 12px;
    font-weight: 700;
    font-size: 0.85em;
    color: #64748b;
    pointer-events: none;
    text-transform: uppercase;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

.appf-number-price-hint {
    font-size: 0.8em;
    font-weight: 600;
    color: #0284c7;
    margin-top: 3px;
}
