/* WC Recesso — Frontend Styles
   Compatibile con WoodMart — usa variabili CSS del tema dove disponibili
   -------------------------------------------------------------------- */

/* ── Variabili di fallback (override automatico da WoodMart) ────────── */
:root {
    --wcr-primary:        var(--color-primary, #4caf50);
    --wcr-primary-dark:   var(--color-primary-hover, #388e3c);
    --wcr-primary-text:   #fff;
    --wcr-radius:         var(--wd-brd-radius, 3px);
    --wcr-font:           var(--wd-body-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* ── Pulsante nella colonna ordini ─────────────────────────────── */
.wcr-btn-open.button {
    font-size: 12px !important;
    padding: 5px 12px !important;
    background: var(--wcr-primary) !important;
    color: var(--wcr-primary-text) !important;
    border: none !important;
    border-radius: var(--wcr-radius) !important;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: none !important;
    text-shadow: none !important;
}
.wcr-btn-open.button:hover {
    background: var(--wcr-primary-dark) !important;
    color: var(--wcr-primary-text) !important;
    opacity: 1;
}

/* Badge di stato */
.wcr-badge,
.wcr-expired,
.wcr-na {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.wcr-badge--pending   { background: #fff3cd; color: #856404; }
.wcr-badge--in_review { background: #cfe2ff; color: #0a58ca; }
.wcr-badge--approved  { background: #d4edda; color: #155724; }
.wcr-badge--rejected  { background: #f8d7da; color: #721c24; }
.wcr-badge--completed { background: #e2e3e5; color: #383d41; }
.wcr-expired          { background: #f8d7da; color: #721c24; }
.wcr-na               { color: #bbb; font-size: 13px; }

/* ── Overlay ────────────────────────────────────────────────────── */
#wcr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .60);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
#wcr-overlay[hidden] { display: none !important; }

/* ── Modal ──────────────────────────────────────────────────────── */
#wcr-modal {
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0,0,0,.22);
    font-family: var(--wcr-font);
    color: #1a1a1a;
    line-height: 1.5;
}

/* Scrollbar discreta */
#wcr-modal::-webkit-scrollbar { width: 4px; }
#wcr-modal::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

#wcr-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #bbb;
    padding: 0;
    transition: color 0.1s;
}
#wcr-close:hover { color: #1a1a1a; }

#wcr-modal h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.3;
    padding-right: 28px;
}
.wcr-meta {
    font-size: 13px;
    color: #777;
    margin: 0 0 20px;
}

/* ── Lista prodotti ──────────────────────────────────────────────── */
#wcr-items-list { margin-bottom: 20px; }

.wcr-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.wcr-item-row:last-child { border-bottom: none; }

.wcr-item-img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 4px;
    background: #f5f5f5;
    flex-shrink: 0;
    border: 1px solid #eee;
}
.wcr-item-info { flex: 1; font-size: 13px; }
.wcr-item-name { font-weight: 600; margin-bottom: 2px; }
.wcr-item-sku  { color: #aaa; font-size: 11px; }

.wcr-item-qty-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    flex-shrink: 0;
}
.wcr-item-qty-wrap input[type=checkbox] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--wcr-primary);
    flex-shrink: 0;
}
.wcr-qty-input {
    width: 54px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: var(--wcr-radius);
    padding: 4px 6px;
    font-size: 13px;
    font-family: var(--wcr-font);
}
.wcr-qty-input:focus {
    outline: none;
    border-color: var(--wcr-primary);
}
.wcr-qty-input:disabled { background: #f7f7f7; color: #ccc; }

/* ── Campi form ──────────────────────────────────────────────────── */
.wcr-field { margin-bottom: 16px; }

.wcr-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}
.wcr-field select,
.wcr-field textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: var(--wcr-radius);
    padding: 9px 11px;
    font-size: 13px;
    background: #fff;
    color: #1a1a1a;
    box-sizing: border-box;
    font-family: var(--wcr-font);
    transition: border-color 0.15s;
}
.wcr-field select:focus,
.wcr-field textarea:focus {
    outline: none;
    border-color: var(--wcr-primary);
}

/* Checkbox di conferma */
.wcr-field--check {
    background: #f8fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    overflow: hidden;
}
.wcr-field--check label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    padding: 12px 14px;
    line-height: 1.6;
}
.wcr-field--check input[type=checkbox] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--wcr-primary);
    cursor: pointer;
}
.wcr-privacy-row {
    border-top: 1px solid #c8e6c9;
    padding: 8px 14px;
    font-size: 12px;
}
.wcr-privacy-row a {
    color: var(--wcr-primary);
    text-decoration: underline;
    font-weight: 600;
}
.wcr-privacy-row a:hover { opacity: .8; }

/* ── Step 2 — riepilogo ─────────────────────────────────────────── */
#wcr-summary {
    background: #f7f7f7;
    border-radius: 4px;
    padding: 14px 16px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.7;
    border: 1px solid #eee;
}
#wcr-summary p { margin: 0 0 4px; }
#wcr-summary p:last-child { margin-bottom: 0; }
#wcr-summary strong { color: #333; }

/* ── Nota legale ─────────────────────────────────────────────────── */
.wcr-legal {
    font-size: 11px;
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 20px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

/* ── Bottoni ─────────────────────────────────────────────────────── */
.wcr-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}
.wcr-btn {
    padding: 10px 22px;
    border-radius: var(--wcr-radius);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
    font-family: var(--wcr-font);
    letter-spacing: .03em;
    text-transform: uppercase;
}
.wcr-btn:hover { opacity: .88; }
.wcr-btn--primary {
    background: var(--wcr-primary);
    color: var(--wcr-primary-text);
}
.wcr-btn--primary:hover {
    background: var(--wcr-primary-dark);
    opacity: 1;
}
.wcr-btn--secondary {
    background: #f0f0f0;
    color: #555;
}
.wcr-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Success ─────────────────────────────────────────────────────── */
.wcr-success-icon {
    font-size: 52px;
    text-align: center;
    margin-bottom: 10px;
    color: var(--wcr-primary);
}
#wcr-step-success h2 { text-align: center; margin-bottom: 12px; }
#wcr-success-msg {
    font-size: 13px;
    color: #555;
    text-align: center;
    line-height: 1.8;
    margin-bottom: 24px;
    background: #f8fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    padding: 16px;
}
#wcr-success-msg strong { color: #333; }

/* ── Loader ──────────────────────────────────────────────────────── */
#wcr-loader { text-align: center; padding: 40px 0; }
.wcr-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: var(--wcr-primary);
    border-radius: 50%;
    animation: wcr-spin .7s linear infinite;
    margin: 0 auto 14px;
}
@keyframes wcr-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #wcr-modal { padding: 20px 16px; }
    .wcr-actions { flex-direction: column-reverse; }
    .wcr-btn { width: 100%; text-align: center; }
    #wcr-modal h2 { font-size: 15px; }
}

/* ── WoodMart: fix z-index header sticky ────────────────────────── */
.wd-header-sticky { z-index: 9999 !important; }
