/**
 * CM Quote — estilos frontend
 * Los colores vienen de CSS variables inyectadas por PHP según settings.
 */

:root {
    --cmq-primary: #1B2A4A;
    --cmq-primary-hover: #2a3d66;
    --cmq-accent: #E8A928;
    --cmq-icon: #FFFFFF;
    --cmq-border: #eeedf3;
    --cmq-bg-soft: #f8f8fc;
    --cmq-text: #333;
    --cmq-text-muted: #888;
}

/* Toggle flotante */
.cm-quote-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--cmq-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.cm-quote-toggle:hover {
    transform: scale(1.05);
    background: var(--cmq-primary-hover);
}

/* Contenedor del ícono: blindado contra estilos del theme (Kadence inyecta
   background/fill/stroke a <svg> y <span> en botones). */
.cm-quote-toggle .cm-quote-toggle__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    color: var(--cmq-icon) !important;
}

.cm-quote-toggle .cm-quote-toggle__icon svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    fill: none !important;
    stroke: currentColor !important;
    color: var(--cmq-icon) !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

.cm-quote-toggle .cm-quote-toggle__icon svg path,
.cm-quote-toggle .cm-quote-toggle__icon svg rect {
    fill: none !important;
    stroke: currentColor !important;
}

.cm-quote-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--cmq-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Overlay */
.cm-quote-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cm-quote-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* Panel */
.cm-quote-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cm-quote-panel.is-open {
    transform: translateX(0);
}

.cm-quote-panel__header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--cmq-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cmq-bg-soft);
}

.cm-quote-panel__header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--cmq-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cm-quote-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}

.cm-quote-close:hover {
    color: var(--cmq-primary);
}

.cm-quote-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Vacío */
.cm-quote-empty {
    text-align: center;
    color: var(--cmq-text-muted);
    padding: 40px 0;
}

/* Items */
.cm-quote-items {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
}

.cm-quote-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cmq-border);
    align-items: flex-start;
}

.cm-quote-item__img {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--cmq-bg-soft);
}

.cm-quote-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cm-quote-item__info {
    flex: 1;
    font-size: 14px;
    min-width: 0; /* evita overflow en nombres largos */
}

.cm-quote-item__info strong {
    display: block;
    color: var(--cmq-primary);
    margin-bottom: 4px;
    font-weight: 600;
    line-height: 1.3;
}

.cm-quote-item__info small {
    color: var(--cmq-text-muted);
    font-size: 12px;
    display: block;
    margin-bottom: 8px;
}

/* Contenedor cantidad + eliminar: alineados y compactos */
.cm-quote-item__qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-quote-qty {
    width: 56px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--cmq-border);
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    text-align: center;
    -moz-appearance: textfield;
}

.cm-quote-qty::-webkit-outer-spin-button,
.cm-quote-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cm-quote-qty:focus {
    outline: none;
    border-color: var(--cmq-primary);
}

.cm-quote-remove {
    background: none;
    border: 1px solid var(--cmq-border);
    color: #999;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.cm-quote-remove:hover {
    background: #fee;
    border-color: #d88;
    color: #c33;
}

/* Honeypot: oculto pero accesible al DOM para que los bots lo llenen */
.cm-quote-hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Formulario */
.cm-quote-form h4 {
    margin: 0 0 16px;
    font-size: 15px;
    color: var(--cmq-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cm-quote-form p {
    margin: 0 0 12px;
}

.cm-quote-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #444;
}

.cm-quote-form input,
.cm-quote-form textarea,
.cm-quote-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cmq-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
    color: var(--cmq-text);
}

.cm-quote-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.cm-quote-form input:focus,
.cm-quote-form textarea:focus,
.cm-quote-form select:focus {
    outline: none;
    border-color: var(--cmq-primary);
}

.cm-quote-submit {
    width: 100%;
    padding: 14px !important;
    background: var(--cmq-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer;
    margin-top: 8px !important;
    transition: background 0.15s ease;
}

.cm-quote-submit:hover:not(:disabled) {
    background: var(--cmq-primary-hover) !important;
}

.cm-quote-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cm-quote-feedback {
    margin-top: 12px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.cm-quote-feedback.is-success {
    display: block;
    background: #e6f7ec;
    color: #1d6b3a;
    border: 1px solid #b8e0c4;
}

.cm-quote-feedback.is-error {
    display: block;
    background: #fee;
    color: #c33;
    border: 1px solid #f5c6cb;
}

/* Toast */
.cm-quote-toast {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--cmq-primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 14px;
}

.cm-quote-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Botón principal de cotización en el producto */
.cm-quote-add-btn {
    background: var(--cmq-primary) !important;
    color: #fff !important;
    border: none !important;
    transition: background 0.15s ease;
}

.cm-quote-add-btn:hover:not(:disabled) {
    background: var(--cmq-primary-hover) !important;
}

/* Mobile */
@media (max-width: 600px) {
    .cm-quote-panel {
        width: 100%;
    }

    .cm-quote-toggle {
        bottom: 16px;
        right: 16px;
    }
}
