/* ====== CARRITO ====== */
.carrito {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    width: 0;
    background: var(--white);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: width 0.3s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.carrito.open {
    width: 520px;
}

.carrito-header {
    background: var(--primary-green);
    color: var(--white);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--gray-medium);
    flex-shrink: 0;
}

.btn-volver {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background 0.3s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-volver:hover {
    background: rgba(255,255,255,0.2);
}

.carrito-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

/* ====== ESTADO DEL CARRITO ====== */
.carrito-estado {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: none;
    flex-shrink: 0;
}

.carrito-estado.mostrar {
    display: block;
}

.estado-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--light-green);
    border-radius: 8px;
    border-left: 4px solid #4caf50;
}

.estado-icono {
    font-size: 1.2rem;
}

.estado-texto {
    flex: 1;
    font-size: 0.9rem;
    color: var(--primary-green);
    font-weight: 500;
}

.estado-editar {
    background: var(--accent-orange);
    color: var(--white);
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s;
    min-height: 32px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.estado-editar:hover {
    background: var(--accent-orange-hover);
}

/* ====== ETAPAS DEL CARRITO ====== */
.carrito-contenido {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.etapa {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.etapa.activa {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ====== FORMULARIO DE ENTREGA ====== */
.formulario-entrega {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.formulario-entrega h3 {
    color: var(--primary-green);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    text-align: center;
}

.campo-formulario {
    margin-bottom: 1.5rem;
}

.campo-formulario label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: bold;
    font-size: 0.9rem;
}

.campo-formulario input,
.campo-formulario textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--gray-medium);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.campo-formulario input:focus,
.campo-formulario textarea:focus {
    outline: none;
    border-color: #4caf50;
}

.campo-formulario textarea {
    resize: vertical;
    min-height: 80px;
}

.opciones-entrega {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.opcion-entrega {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.opcion-entrega:hover {
    border-color: #4caf50;
    background: #f9f9f9;
}

.opcion-entrega input[type="radio"] {
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: #2e7d32;
}

.nota-entrega {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.85rem;
}

.nota-entrega p {
    margin: 0;
    color: #856404;
}

/* ====== BOTÓN CONTINUAR ====== */
.btn-continuar {
    width: 100%;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    min-height: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-continuar:hover {
    background: var(--dark-green);
}

.btn-continuar:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* ====== LISTA DEL CARRITO ====== */
.lista-carrito {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.carrito-vacio {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.carrito-vacio p {
    margin-bottom: 1rem;
}

/* ====== ITEM ====== */
.item-carrito {
    display: flex;
    align-items: center;
    background: #f9f9f9;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.item-carrito:hover {
    background: #f0f4f1;
}

.item-carrito.expandido {
    background: #f0f4f1;
    box-shadow: 0 3px 12px rgba(47, 107, 79, 0.12);
    border-left-color: var(--green);
    align-items: flex-start;
}

.item-carrito .producto-imagen {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #f0f0f0;
}

.item-carrito .producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-info h4 {
    margin-bottom: 0.3rem;
    color: var(--text-dark);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    transition: all 0.2s;
    word-break: break-word;
}

/* Expandido: mostrar todo */
.item-carrito.expandido .item-info h4 {
    -webkit-line-clamp: unset;
    overflow: visible;
    display: block;
    white-space: pre-line;
}

.item-precio-unitario {
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 0.2rem 0;
}

.item-subtotal {
    color: var(--primary-green);
    font-weight: bold;
    font-size: 0.9rem;
    margin: 0.2rem 0 0 0;
}

/* ====== INDICADOR "Ver más / Ver menos" ====== */
.item-expandir-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    color: var(--green-dark);
    font-weight: 600;
    margin-top: 0.4rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.item-carrito:hover .item-expandir-hint {
    opacity: 1;
}

.item-carrito.expandido .item-expandir-hint {
    opacity: 1;
    color: #856404;
}

.item-expandir-hint .flecha {
    display: inline-block;
    transition: transform 0.25s ease;
    font-size: 0.6rem;
    line-height: 1;
}

.item-carrito.expandido .item-expandir-hint .flecha {
    transform: rotate(180deg);
}

/* ====== CONTROLES DE CANTIDAD ====== */
.item-controles {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn-cantidad {
    background: var(--primary-green);
    color: var(--white);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    padding: 0;
    line-height: 1;
}

.btn-cantidad:hover {
    background: var(--dark-green);
}

.btn-cantidad:active {
    background: #0d3018;
}

.btn-cantidad:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.cantidad {
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    font-size: 1rem;
}

.btn-eliminar {
    background: #f44336;
    color: var(--white);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    flex-shrink: 0;
    font-size: 1rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    padding: 0;
    line-height: 1;
}

.btn-eliminar:hover {
    background: #d32f2f;
}

.btn-eliminar:active {
    background: #b71c1c;
}

.carrito-footer {
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--gray-light);
    border-top: 1px solid var(--gray-medium);
    flex-shrink: 0;
}

.total {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-green);
    text-align: center;
    margin-bottom: 1rem;
}

.btn-whatsapp {
    width: 100%;
    background: #25d366;
    color: var(--white);
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    min-height: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-whatsapp:hover {
    background: #128c7e;
}

/* ============================================================ */
/* ====== OPCIÓN MANTENER ====== */
/* ============================================================ */
.opcion-mantener-wrap {
    margin-bottom: 1rem;
    padding: 0.85rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.toggle-mantener {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.35rem 0.2rem;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.toggle-mantener input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle-slider {
    position: relative;
    width: 46px;
    height: 26px;
    background: #cfd6d2;
    border-radius: 999px;
    transition: background 0.25s ease;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-mantener input[type="checkbox"]:checked + .toggle-slider {
    background: var(--green);
}

.toggle-mantener input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-mantener input[type="checkbox"]:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.25), inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toggle-texto {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    line-height: 1.2;
    min-width: 0;
}

.toggle-texto strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    transition: color 0.2s;
}

.toggle-texto small {
    font-size: 0.72rem;
    color: var(--ink-soft);
    font-weight: 400;
}

.toggle-mantener:hover .toggle-texto strong {
    color: var(--green-dark);
}

/* ============================================================ */
/* ====== RESPONSIVE MÓVIL ====== */
/* ============================================================ */
@media (max-width: 768px) {
    .carrito.open {
        width: 100%;
    }

    .carrito-header {
        padding: 1rem 1.2rem;
    }

    .carrito-header h2 {
        font-size: 1.15rem;
    }

    .item-carrito {
        padding: 0.85rem;
        gap: 0.75rem;
    }

    .item-carrito .producto-imagen {
        width: 55px;
        height: 55px;
    }

    .item-info h4 {
        font-size: 0.85rem;
    }

    .item-carrito.expandido .item-info h4 {
        font-size: 0.9rem;
    }

    .btn-cantidad,
    .btn-eliminar {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .item-controles {
        gap: 0.5rem;
    }

    .cantidad {
        font-size: 1.05rem;
        min-width: 28px;
    }

    .estado-editar {
        min-height: 38px;
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }

    .btn-continuar,
    .btn-whatsapp {
        min-height: 56px;
    }

    .toggle-slider {
        width: 52px;
        height: 30px;
    }

    .toggle-slider::before {
        width: 24px;
        height: 24px;
        top: 3px;
        left: 3px;
    }

    .toggle-mantener input[type="checkbox"]:checked + .toggle-slider::before {
        transform: translateX(22px);
    }

    .toggle-texto strong {
        font-size: 0.92rem;
    }

    .toggle-texto small {
        font-size: 0.75rem;
    }
}
/* ============================================================ */
/* ====== DATOS DEL CLIENTE (SOLO LECTURA) ====== */
/* ============================================================ */

#datos-cliente-config {
    margin-bottom: 1.25rem;
}

.dato-cliente-bloque {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.7rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.dato-cliente-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    font-weight: 700;
}

.dato-cliente-valor {
    font-size: 0.92rem;
    color: var(--ink);
    font-weight: 500;
    word-break: break-word;
    line-height: 1.3;
}

.btn-editar-config {
    display: block;
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.65rem 1rem;
    background: transparent;
    color: var(--green-dark);
    border: 1.5px solid var(--green);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-editar-config:hover {
    background: var(--green-tint);
}

/* ============================================================ */
/* ====== AVISO "FALTAN TUS DATOS" ====== */
/* ============================================================ */

#aviso-faltan-datos {
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: #fff8e1;
    border: 1.5px solid #ffe082;
    border-radius: var(--radius-md);
    text-align: center;
}

.aviso-faltan-titulo {
    font-family: 'Fraunces', serif;
    font-size: 1.05rem;
    color: #856404;
    margin: 0 0 0.35rem 0;
    font-weight: 700;
}

.aviso-faltan-texto {
    font-size: 0.85rem;
    color: #6d4c00;
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.btn-ir-config {
    display: inline-block;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: var(--green);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    line-height: 1.3;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ir-config:hover {
    background: var(--green-dark);
}
/* ============================================================ */
/* BOTÓN "Ver carrito completo"                                 */
/* ============================================================ */
.btn-ver-carrito-completo {
    display: block;
    width: 100%;
    background: var(--green, #2F6B4F);
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    margin-bottom: 0.6rem;
    transition: background 0.25s, transform 0.15s;
    box-sizing: border-box;
    min-height: 52px;
    line-height: 1.3;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-ver-carrito-completo:hover {
    background: var(--green-dark, #1E4A36);
    transform: translateY(-1px);
}

.btn-ver-carrito-completo:active {
    transform: translateY(0);
}