/**
 * Cibato Quick Order — Frontend Styles
 * Clean, mobile-first design. No blur effects.
 */

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    --cq-green: #22c55e;
    --cq-green-dark: #16a34a;
    --cq-orange: #f97316;
    --cq-red: #ef4444;
    --cq-text: #1a1a2e;
    --cq-muted: #6b7280;
    --cq-border: #e2e8f0;
    --cq-bg: #f8fafc;
    --cq-white: #ffffff;
    --cq-radius: 14px;
    --cq-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================================
   ORDER BUTTON
   ============================================================ */
.wccoq-order-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    margin: 12px 0;
    font-family: var(--cq-font);
    font-size: 17px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.18);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}
.wccoq-order-btn:hover { background-color: var(--wccoq-hover-color) !important; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.22); }
.wccoq-order-btn:active { transform: scale(0.97); filter: brightness(0.96); }
.wccoq-order-btn svg { flex-shrink: 0; }

/* ============================================================
   OVERLAY — Dark dim, NO blur
   ============================================================ */
.wccoq-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.wccoq-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   POPUP — Bottom sheet on mobile
   ============================================================ */
.wccoq-popup {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
    background: var(--cq-white);
    border-radius: 22px 22px 0 0;
    z-index: 999999;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s ease;
    overflow: hidden;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.18);
    font-family: var(--cq-font);
}
.wccoq-popup.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   HEADER
   ============================================================ */
.wccoq-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 18px 16px 20px;
    flex-shrink: 0;
    position: relative;
}
/* Drag pill */
.wccoq-popup-header::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
}

.wccoq-popup-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    flex: 1;
    padding-right: 12px;
    padding-top: 8px;
}

.wccoq-popup-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2) !important;
    border: 1.5px solid rgba(255,255,255,0.35) !important;
    border-radius: 50% !important;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #fff !important;
    box-shadow: none !important;
    padding: 0 !important;
    outline: none !important;
    flex-shrink: 0;
    margin-top: 4px;
    touch-action: manipulation;
    transition: background 0.2s !important;
}
.wccoq-popup-close:hover { background: rgba(255,255,255,0.32) !important; }

/* ============================================================
   BODY — Scrollable area
   ============================================================ */
.wccoq-popup-body {
    padding: 16px 16px 28px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    overscroll-behavior: contain;
    width: 100%;
    box-sizing: border-box;
}
.wccoq-popup-body::-webkit-scrollbar { width: 3px; }
.wccoq-popup-body::-webkit-scrollbar-thumb { background: #dde2ea; border-radius: 2px; }

/* Lock form width */
#wccoq-form {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.wccoq-field {
    margin-bottom: 14px;
}
.wccoq-field > label:first-child {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--cq-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wccoq-required {
    color: var(--cq-red);
    margin-left: 2px;
}

/* Input wrapper */
.wccoq-input-wrap {
    display: flex;
    align-items: center;
    background: var(--wccoq-input-bg, #f8fafc) !important;
    border: 1.5px solid var(--cq-border) !important;
    border-radius: var(--cq-radius) !important;
    outline: none !important;
    box-shadow: none !important;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.wccoq-input-wrap:focus-within {
    background: #fff !important;
    border-color: var(--cq-green) !important;
    outline: none !important;
    box-shadow: none !important;
}
.wccoq-input-wrap:hover {
    box-shadow: none !important;
}

/* Icon */
.wccoq-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 50px;
    flex-shrink: 0;
    color: var(--wccoq-input-icon-color, #94a3b8) !important;
    transition: color 0.2s;
}
.wccoq-input-icon svg,
.wccoq-input-icon svg * {
    stroke: var(--wccoq-input-icon-color, #94a3b8) !important;
    fill: none !important;
    color: inherit !important;
}
.wccoq-input-wrap:focus-within .wccoq-input-icon,
.wccoq-input-wrap:focus-within .wccoq-input-icon svg,
.wccoq-input-wrap:focus-within .wccoq-input-icon svg * {
    color: var(--cq-green) !important;
    stroke: var(--cq-green) !important;
}

/* Text input */
.wccoq-input-wrap input {
    flex: 1;
    min-width: 0;
    padding: 0 14px 0 0;
    height: 50px;
    font-size: 16px;
    font-family: var(--cq-font);
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #111111 !important;
    -webkit-appearance: none;
    appearance: none;
}
.wccoq-input-wrap:hover,
.wccoq-input-wrap:focus {
    box-shadow: none !important;
    outline: none !important;
}
.wccoq-input-wrap input:hover,
.wccoq-input-wrap input:focus,
.wccoq-input-wrap input:active {
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}
.wccoq-input-wrap input::placeholder {
    color: #9eaab8;
}

/* Chrome autofill background fix */
.wccoq-input-wrap input:-webkit-autofill,
.wccoq-input-wrap input:-webkit-autofill:hover, 
.wccoq-input-wrap input:-webkit-autofill:focus, 
.wccoq-input-wrap input:-webkit-autofill:active,
.wccoq-coupon-wrap input:-webkit-autofill,
.wccoq-coupon-wrap input:-webkit-autofill:hover,
.wccoq-coupon-wrap input:-webkit-autofill:focus,
.wccoq-order-note-field input:-webkit-autofill,
.wccoq-order-note-field input:-webkit-autofill:hover,
.wccoq-order-note-field input:-webkit-autofill:focus,
.wccoq-order-note-field textarea:-webkit-autofill {
    transition: background-color 9999s ease-in-out 0s !important;
    -webkit-text-fill-color: #111111 !important;
}

/* ============================================================
   SHIPPING OPTIONS
   ============================================================ */
.wccoq-shipping-field > label:first-of-type {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--cq-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wccoq-shipping-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.wccoq-shipping-option {
    display: flex;
    align-items: center;
    padding: 13px 14px;
    background: var(--cq-bg);
    border: 1.5px solid var(--cq-border);
    border-radius: var(--cq-radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    touch-action: manipulation;
}
.wccoq-shipping-option:has(input:checked) {
    border-color: var(--cq-green);
    background: #f0fdf4;
}
.wccoq-shipping-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0 12px 0 0;
    accent-color: var(--cq-green);
    cursor: pointer;
    flex-shrink: 0;
}
.wccoq-shipping-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--cq-text);
}
.wccoq-shipping-cost {
    font-size: 14px;
    font-weight: 700;
    color: var(--cq-green-dark);
    white-space: nowrap;
}

/* ============================================================
   COUPON
   ============================================================ */
.wccoq-coupon-field { margin-bottom: 14px; }
.wccoq-coupon-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}
.wccoq-coupon-wrap input {
    padding: 0 14px;
    height: 50px;
    font-size: 16px;
    font-family: var(--cq-font);
    border: 1.5px solid var(--cq-border) !important;
    border-radius: var(--cq-radius) !important;
    outline: none !important;
    box-shadow: none !important;
    background: var(--wccoq-input-bg, #f8fafc) !important;
    color: #111111 !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
    width: 100%;
}
.wccoq-coupon-wrap input:focus {
    border-color: var(--cq-green) !important;
    background: #fff !important;
}
.wccoq-coupon-wrap input::placeholder { color: #9eaab8; }
.wccoq-coupon-wrap button {
    height: 42px;
    padding: 0 28px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--cq-font);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    flex-shrink: 0;
    transition: filter 0.15s, transform 0.1s;
}
.wccoq-coupon-wrap button:hover { background-color: var(--wccoq-theme-secondary) !important; color: #fff !important; transform: translateY(-1px); }
.wccoq-coupon-wrap button:active { filter: brightness(0.94); transform: scale(0.97); }

.wccoq-coupon-message {
    margin-top: 7px;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    display: none;
}
.wccoq-coupon-message.success { display:block; background:#dcfce7; color:#15803d; }
.wccoq-coupon-message.error   { display:block; background:#fee2e2; color:#b91c1c; }

/* ============================================================
   PRODUCT INFO
   ============================================================ */
.wccoq-product-info {
    background: var(--cq-bg);
    border: 1.5px solid var(--cq-border);
    border-radius: var(--cq-radius);
    padding: 14px;
    margin-bottom: 14px;
}
.wccoq-product-row {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    align-items: center;
    gap: 12px;
}
.wccoq-product-image-wrap {
    position: relative;
    width: 68px;
    height: 68px;
    flex-shrink: 0;
}
.wccoq-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    border: 1.5px solid var(--cq-border);
}
.wccoq-product-qty-badge {
    position: absolute;
    top: -7px;
    left: -7px;
    width: 22px;
    height: 22px;
    background: var(--cq-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wccoq-product-details { min-width: 0; }
.wccoq-product-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cq-text);
    margin-bottom: 10px;
    line-height: 1.4;
}
.wccoq-product-price-col { text-align: right; }
.wccoq-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--cq-text);
    white-space: nowrap;
}

/* ============================================================
   QUANTITY CONTROL
   ============================================================ */
.wccoq-quantity-control {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--cq-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.wccoq-qty-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cq-bg);
    border: none;
    font-size: 20px;
    font-weight: 400;
    color: var(--cq-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.15s;
}
.wccoq-qty-btn:active { background: #e2e8f0; }
.wccoq-quantity-control input {
    width: 40px;
    height: 38px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    border: none;
    background: #fff;
    color: var(--cq-text);
    font-family: var(--cq-font);
    outline: none;
    -moz-appearance: textfield;
}
.wccoq-quantity-control input::-webkit-outer-spin-button,
.wccoq-quantity-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
}

/* ============================================================
   PRICE SUMMARY
   ============================================================ */
.wccoq-price-summary {
    background: var(--cq-bg);
    border: 1.5px solid var(--cq-border);
    border-radius: var(--cq-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.wccoq-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    font-size: 14px;
    color: var(--cq-muted);
    border-bottom: 1px solid #f1f5f9;
}
.wccoq-price-row:last-child { border-bottom: none; }
.wccoq-total-row {
    font-size: 17px;
    font-weight: 800;
    color: var(--cq-text);
    padding-top: 10px;
    border-top: 1.5px solid var(--cq-border);
    border-bottom: none;
}
.wccoq-discount-row span:last-child { color: var(--cq-green-dark); font-weight: 700; }

/* ============================================================
   ORDER NOTE
   ============================================================ */
.wccoq-order-note-field input,
.wccoq-order-note-field textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    min-height: 50px;
    font-size: 16px;
    font-family: var(--cq-font);
    border: 1.5px solid var(--cq-border) !important;
    border-radius: var(--cq-radius) !important;
    outline: none !important;
    box-shadow: none !important;
    background: var(--wccoq-input-bg, #f8fafc) !important;
    color: #111111 !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, background 0.2s;
    resize: vertical;
}
.wccoq-order-note-field input:focus,
.wccoq-order-note-field textarea:focus {
    border-color: var(--cq-green) !important;
    background: #fff !important;
}

/* ============================================================
   UPSELL BOX
   ============================================================ */
.wccoq-upsell-box {
    border: 2px solid;
    border-radius: var(--cq-radius);
    padding: 14px;
    margin-bottom: 14px;
}
.wccoq-upsell-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.wccoq-upsell-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #2196f3;
    cursor: pointer;
    flex-shrink: 0;
}
.wccoq-upsell-image {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.wccoq-upsell-text { flex: 1; min-width: 0; }
.wccoq-upsell-message {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cq-text);
    line-height: 1.4;
}
.wccoq-upsell-sub {
    display: block;
    font-size: 12px;
    color: var(--cq-muted);
    margin-top: 3px;
}

/* ============================================================
   CONFIRM BUTTON
   ============================================================ */
.wccoq-confirm-btn {
    width: 100%;
    padding: 17px 20px;
    font-size: 17px;
    font-weight: 700;
    font-family: var(--cq-font);
    border: none;
    border-radius: var(--cq-radius);
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
}
.wccoq-confirm-btn:hover:not(:disabled) { background-color: var(--wccoq-theme-secondary) !important; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.22); }
.wccoq-confirm-btn:active:not(:disabled) { transform: scale(0.98); filter: brightness(0.95); }
.wccoq-confirm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.wccoq-btn-loader { display: flex; align-items: center; gap: 8px; }
.wccoq-spinner {
    width: 20px;
    height: 20px;
    animation: wccoq-spin 1s linear infinite;
}
@keyframes wccoq-spin { to { transform: rotate(360deg); } }

/* ============================================================
   CONFIRM NOTICE
   ============================================================ */
.wccoq-confirm-notice {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 10px;
}

/* ============================================================
   PAY ONLINE BUTTON
   ============================================================ */
.wccoq-pay-online-btn {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--cq-font);
    border: none;
    border-radius: var(--cq-radius);
    cursor: pointer;
    touch-action: manipulation;
    transition: filter 0.15s, transform 0.1s;
}
.wccoq-pay-online-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.wccoq-pay-online-btn:active { filter: brightness(0.93); transform: scale(0.98); }

/* ============================================================
   SUCCESS MESSAGE
   ============================================================ */
.wccoq-success-message {
    text-align: center;
    padding: 30px 20px 24px;
}
.wccoq-success-icon {
    margin-bottom: 16px;
    animation: wccoq-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes wccoq-pop {
    from { transform: scale(0.3); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.wccoq-success-message h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--cq-green-dark);
    margin-bottom: 10px;
}
.wccoq-success-message p {
    font-size: 15px;
    color: var(--cq-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}
.wccoq-order-id {
    font-size: 14px;
    color: var(--cq-text);
    background: var(--cq-bg);
    padding: 9px 16px;
    border-radius: 8px;
    display: inline-block;
    margin: 14px 0;
    border: 1px solid var(--cq-border);
}
.wccoq-order-id strong { color: var(--cq-green-dark); }
.wccoq-success-close {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: var(--cq-green);
    border: none;
    border-radius: var(--cq-radius);
    cursor: pointer;
    font-family: var(--cq-font);
}

/* Hide form when success shown */
.wccoq-popup-body.success-shown #wccoq-form { display: none; }

/* ============================================================
   TABLET / DESKTOP — Centered modal above 600px
   ============================================================ */
@media (min-width: 600px) {
    .wccoq-popup {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: 94%;
        max-width: 520px;
        max-height: 90vh;
        border-radius: 20px;
        transform: translate(-50%, -50%) scale(0.92);
    }
    .wccoq-popup::before { display: none; }
    .wccoq-popup.active  { transform: translate(-50%, -50%) scale(1); }
    .wccoq-popup-body    { max-height: calc(90vh - 72px); }
    .wccoq-popup-header::before { display: none; }
}

/* ============================================================
   SMALL PHONES — 380px and below
   ============================================================ */
@media (max-width: 380px) {
    .wccoq-popup-body { padding: 0 14px 22px; }
    .wccoq-popup-header { padding: 18px 14px 14px; }
    .wccoq-input-wrap input,
    .wccoq-coupon-wrap input,
    .wccoq-order-note-field input { height: 48px; }
    .wccoq-confirm-btn { font-size: 15px; padding: 15px; }
    .wccoq-product-row { grid-template-columns: 58px 1fr auto; gap: 10px; }
    .wccoq-product-image-wrap { width: 58px; height: 58px; }
}
