/* MPOMS Pottery — Front-end Styles
   Scoped to .mpoms-* to avoid theme conflicts */

/* ── Reset & Base ──────────────────────────────────────────────────── */
.mpoms-form-wrapper *,
.mpoms-receipt * {
    box-sizing: border-box;
}

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
    --mpoms-primary:   rgb(84,54,64);
    --mpoms-primary-d: rgb(60,36,44);
    --mpoms-accent:    rgb(227,154,51);
    --mpoms-accent-d:  rgb(196,130,30);
    --mpoms-bg:        #fdf8f0;
    --mpoms-card:      #ffffff;
    --mpoms-border:    #e8ddd0;
    --mpoms-text:      #2d1f25;
    --mpoms-muted:     #7a6570;
    --mpoms-radius:    12px;
    --mpoms-shadow:    0 2px 12px rgba(84,54,64,.10);
    --mpoms-green:     #2d8a55;
    --mpoms-red:       #c0392b;
}

/* ── Form Wrapper ──────────────────────────────────────────────────── */
.mpoms-form-wrapper {
    max-width: 980px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--mpoms-text);
}

.mpoms-form-section {
    background: var(--mpoms-card);
    border: 1px solid var(--mpoms-border);
    border-radius: var(--mpoms-radius);
    padding: 22px 28px;
    margin-bottom: 18px;
    box-shadow: var(--mpoms-shadow);
}

.mpoms-section-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--mpoms-primary);
    border-bottom: 2px solid var(--mpoms-border);
    padding-bottom: 10px;
}

.mpoms-hint {
    font-size: .9rem;
    color: var(--mpoms-muted);
    margin: -8px 0 16px;
}

/* ── Fields ────────────────────────────────────────────────────────── */
.mpoms-field {
    margin-bottom: 16px;
}

.mpoms-field label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 6px;
    color: var(--mpoms-text);
}

.mpoms-field input[type="text"],
.mpoms-field input[type="email"],
.mpoms-field input[type="tel"],
.mpoms-field input[type="number"],
.mpoms-field input[type="url"],
.mpoms-field textarea,
.mpoms-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--mpoms-border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--mpoms-bg);
    color: var(--mpoms-text);
    transition: border-color .2s;
    -webkit-appearance: none;
}

.mpoms-field input:focus,
.mpoms-field textarea:focus,
.mpoms-field select:focus {
    outline: none;
    border-color: var(--mpoms-primary);
    background: #fff;
}

.mpoms-field-row {
    display: flex;
    gap: 14px;
}

.mpoms-field-row .mpoms-field {
    flex: 1;
}

.mpoms-required {
    color: var(--mpoms-red);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.mpoms-btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-decoration: none;
    line-height: 1;
}

.mpoms-btn-primary {
    background: var(--mpoms-primary);
    color: #fff;
}

.mpoms-btn-primary:hover {
    background: var(--mpoms-primary-d);
    color: #fff;
}

.mpoms-btn-secondary {
    background: var(--mpoms-bg);
    color: var(--mpoms-primary);
    border: 1.5px solid var(--mpoms-primary);
}

.mpoms-btn-secondary:hover {
    background: var(--mpoms-primary);
    color: #fff;
}

.mpoms-btn-large {
    padding: 14px 36px;
    font-size: 1.1rem;
}

.mpoms-btn-sm {
    padding: 8px 14px;
    font-size: .85rem;
}

/* ── Item Cards ─────────────────────────────────────────────────── */
.mpoms-item-card {
    border: 1.5px solid var(--mpoms-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
    background: #fdf9f5;
    position: relative;
}

.mpoms-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.mpoms-item-num {
    font-weight: 700;
    font-size: .9rem;
    color: var(--mpoms-primary);
}

.mpoms-remove-item-btn {
    background: none;
    border: none;
    color: var(--mpoms-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color .2s, background .2s;
    line-height: 1;
}
.mpoms-remove-item-btn:hover {
    color: var(--mpoms-red);
    background: rgba(192,57,43,.08);
}

/* ── Item body: photo | fields side by side on desktop ─────────── */
.mpoms-item-body {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    align-items: start;
}

/* ── Photo column ───────────────────────────────────────────────── */
.mpoms-item-photo-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mpoms-photo-preview {
    width: 110px;
    height: 110px;
    border: 2px dashed var(--mpoms-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    position: relative;
}

.mpoms-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mpoms-photo-placeholder {
    text-align: center;
    color: var(--mpoms-muted);
    padding: 8px;
}

.mpoms-photo-placeholder span {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 3px;
}

.mpoms-photo-placeholder p {
    font-size: .72rem;
    margin: 0;
    line-height: 1.3;
}

.mpoms-photo-label {
    font-size: .75rem !important;
    padding: 5px 8px !important;
    width: 100%;
    text-align: center;
}

.mpoms-upload-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mpoms-muted);
    font-size: .8rem;
    margin-top: 4px;
}

.mpoms-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--mpoms-border);
    border-top-color: var(--mpoms-primary);
    border-radius: 50%;
    animation: mpoms-spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes mpoms-spin {
    to { transform: rotate(360deg); }
}

/* ── Fields column ──────────────────────────────────────────────── */
.mpoms-item-fields-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mpoms-item-fields-col .mpoms-field {
    margin-bottom: 0;
}

.mpoms-catalog-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--mpoms-border);
    border-radius: 8px;
    font-size: .92rem;
    background: #fff;
    color: var(--mpoms-text);
    appearance: auto;
    cursor: pointer;
    transition: border-color .2s;
}
.mpoms-catalog-field select:focus {
    border-color: var(--mpoms-primary);
    outline: none;
}

/* ── Mobile: stack photo above fields ──────────────────────────── */
@media (max-width: 600px) {
    .mpoms-item-body {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .mpoms-item-photo-col {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    .mpoms-photo-preview {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }
    .mpoms-photo-label {
        width: auto;
    }
}

/* ── Form Footer ───────────────────────────────────────────────────── */
.mpoms-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 0;
    gap: 16px;
    flex-wrap: wrap;
}

.mpoms-total-bar {
    font-size: 1.2rem;
    color: var(--mpoms-text);
}

.mpoms-total-bar strong {
    color: var(--mpoms-primary);
    font-size: 1.4rem;
    margin-left: 6px;
}

/* ── Error ─────────────────────────────────────────────────────────── */
.mpoms-error {
    background: #fdf0ef;
    border: 1.5px solid var(--mpoms-red);
    color: var(--mpoms-red);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    font-size: .95rem;
}

/* ── Success Screen ────────────────────────────────────────────────── */
.mpoms-success-screen {
    text-align: center;
    padding: 48px 24px;
    background: var(--mpoms-card);
    border-radius: var(--mpoms-radius);
    box-shadow: var(--mpoms-shadow);
}

.mpoms-success-icon {
    font-size: 4rem;
    margin-bottom: 12px;
}

.mpoms-success-screen h2 {
    color: var(--mpoms-green);
    margin: 0 0 12px;
}

.mpoms-qr {
    max-width: 200px;
    border-radius: 8px;
    border: 2px solid var(--mpoms-border);
    padding: 8px;
    background: #fff;
    margin: 12px auto;
    display: block;
}

/* ── Notice ────────────────────────────────────────────────────────── */
.mpoms-notice {
    padding: 14px 18px;
    background: var(--mpoms-bg);
    border-left: 4px solid var(--mpoms-primary);
    border-radius: 4px;
    color: var(--mpoms-muted);
}

/* ── Receipt ───────────────────────────────────────────────────────── */
.mpoms-receipt {
    max-width: 640px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--mpoms-text);
    box-shadow: var(--mpoms-shadow);
    border-radius: var(--mpoms-radius);
    overflow: hidden;
}

.mpoms-receipt-header {
    background: var(--mpoms-primary);
    color: #fff;
    text-align: center;
    padding: 32px 24px;
}

.mpoms-receipt-logo {
    max-height: 80px;
    max-width: 240px;
    object-fit: contain;
}

.mpoms-receipt-studio {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
}

.mpoms-receipt-tagline {
    margin: 6px 0 0;
    opacity: .8;
    font-size: .9rem;
}

.mpoms-receipt-body {
    background: var(--mpoms-card);
    padding: 28px;
}

.mpoms-receipt-meta {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--mpoms-border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mpoms-receipt-meta > div span {
    display: block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mpoms-muted);
    margin-bottom: 2px;
}

.mpoms-receipt-meta > div strong {
    font-size: 1rem;
}

.mpoms-receipt-customer h3,
.mpoms-receipt-items h3,
.mpoms-receipt-notes h3 {
    font-size: .9rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mpoms-muted);
    border-bottom: 1px solid var(--mpoms-border);
    padding-bottom: 8px;
    margin: 0 0 14px;
}

.mpoms-receipt-customer {
    margin-bottom: 24px;
}

.mpoms-receipt-item {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--mpoms-border);
}

.mpoms-receipt-item:last-of-type {
    border-bottom: none;
}

.mpoms-receipt-item-photo img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--mpoms-border);
}

.mpoms-receipt-item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mpoms-receipt-item-name {
    font-weight: 600;
}

.mpoms-receipt-item-price {
    font-weight: 700;
    color: var(--mpoms-primary);
}

.mpoms-receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px solid var(--mpoms-text);
    font-size: 1.15rem;
}

.mpoms-receipt-total strong {
    color: var(--mpoms-primary);
    font-size: 1.3rem;
}

.mpoms-receipt-qr {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--mpoms-border);
}

.mpoms-receipt-qr img {
    max-width: 160px;
    border: 1px solid var(--mpoms-border);
    padding: 8px;
    border-radius: 8px;
}

.mpoms-receipt-footer {
    background: var(--mpoms-bg);
    padding: 20px 28px;
    border-top: 1px solid var(--mpoms-border);
    text-align: center;
    font-size: .9rem;
    color: var(--mpoms-muted);
}

.mpoms-receipt-thank {
    font-weight: 700;
    color: var(--mpoms-primary);
    margin-bottom: 0;
}

/* ── Status Badges ─────────────────────────────────────────────────── */
.mpoms-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
}

.mpoms-status--pending          { background: #fff3cd; color: #856404; }
.mpoms-status--in-kiln          { background: #ffe5d0; color: #a0420a; }
.mpoms-status--ready-for-pickup { background: #d4edda; color: #155724; }
.mpoms-status--out-for-delivery { background: #cce5ff; color: #004085; }
.mpoms-status--completed        { background: #d1ecf1; color: #0c5460; }
.mpoms-status--expired          { background: #f8d7da; color: #721c24; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media ( max-width: 600px ) {
    .mpoms-field-row {
        flex-direction: column;
        gap: 0;
    }

    .mpoms-item-fields {
        flex-direction: column;
    }

    .mpoms-form-footer {
        flex-direction: column;
        text-align: center;
    }

    .mpoms-receipt-meta {
        flex-direction: column;
        gap: 12px;
    }

    .mpoms-receipt-item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ── Validation ────────────────────────────────────────────────────── */
.mpoms-input-error {
    border-color: #DC2626 !important;
    background: #FFF5F5 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
    animation: mpoms-shake .35s ease;
}
@keyframes mpoms-shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}
.mpoms-field-error {
    display: block;
    color: #DC2626;
    font-size: .78rem;
    font-weight: 600;
    margin-top: 4px;
}
.mpoms-field { position: relative; }
#mpoms-form-error {
    background: #FEF2F2;
    border: 1.5px solid #FECACA;
    color: #991B1B;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 16px;
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Mobile improvements ───────────────────────────────────────────── */
@media (max-width: 480px) {
    #mpoms-add-item {
        width: 100%;
        justify-content: center;
        padding: 14px !important;
        font-size: 1rem !important;
        margin-top: 8px;
    }
    .mpoms-form-section { padding: 16px; }
    .mpoms-item-card { padding: 14px; }
    #mpoms-submit-btn {
        width: 100%;
        padding: 16px !important;
        font-size: 1.05rem !important;
    }
}

/* ── Validation & Error Styles ─────────────────────────────────────── */
.mpoms-input-error {
    border-color: #DC2626 !important;
    background: #FFF5F5 !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.15) !important;
    animation: mpoms-shake .35s ease;
}
@keyframes mpoms-shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}
.mpoms-field-error {
    display: block;
    color: #DC2626;
    font-size: .78rem;
    font-weight: 600;
    margin-top: 5px;
    line-height: 1.4;
}
#mpoms-form-error {
    background: #FEF2F2;
    border: 1.5px solid #FECACA;
    color: #991B1B;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: .9rem;
    font-weight: 500;
    display: none;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}
#mpoms-form-error[style*="flex"] {
    display: flex !important;
}

/* ── Mobile improvements ───────────────────────────────────────────── */
@media (max-width: 600px) {
    #mpoms-add-item {
        display: block;
        width: 100%;
        text-align: center;
        padding: 14px 10px;
        font-size: 1rem;
        margin-top: 8px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .mpoms-form-section { padding: 16px 14px; }
    .mpoms-item-card    { padding: 14px; }
    #mpoms-submit-btn {
        display: block;
        width: 100%;
        padding: 16px 10px;
        font-size: 1.05rem;
        touch-action: manipulation;
    }
    .mpoms-field-row { flex-direction: column; }
    .mpoms-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* ── Studio Fee — compact inline ───────────────────────────────── */
.mpoms-fee-section {
    border-top: 3px solid var(--mpoms-accent) !important;
    padding: 14px 22px !important;
}

.mpoms-fee-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mpoms-fee-inline__label {
    font-weight: 700;
    color: var(--mpoms-primary);
    font-size: .95rem;
    white-space: nowrap;
}

.mpoms-fee-inline__rate {
    color: var(--mpoms-muted);
    font-size: .88rem;
    white-space: nowrap;
}

.mpoms-fee-inline__guests {
    color: var(--mpoms-muted);
    font-size: .88rem;
}

.mpoms-fee-inline__sep {
    color: var(--mpoms-muted);
    font-weight: 600;
}

.mpoms-fee-inline__total {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--mpoms-accent);
    min-width: 60px;
}

/* Counter inside fee inline */
.mpoms-fee-inline .mpoms-counter {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--mpoms-border);
    border-radius: 8px;
    overflow: hidden;
}

.mpoms-counter-btn {
    background: var(--mpoms-primary);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mpoms-counter-btn:hover { background: var(--mpoms-primary-d); }

.mpoms-counter input[type="number"] {
    width: 48px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1.5px solid var(--mpoms-border);
    border-right: 1.5px solid var(--mpoms-border);
    font-size: 1rem;
    font-weight: 700;
    color: var(--mpoms-primary);
    background: #fff;
    -moz-appearance: textfield;
    outline: none;
}
.mpoms-counter input[type="number"]::-webkit-inner-spin-button,
.mpoms-counter input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }



/* ── Total bar ──────────────────────────────────────────────────── */
.mpoms-total-breakdown {
    font-size: .78rem;
    color: var(--mpoms-muted);
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mpoms-total-final {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.05rem;
}

.mpoms-optional {
    font-weight: 400;
    font-size: .8rem;
    color: var(--mpoms-muted);
}
