/* =============================================================================
   Oliva — Sistema de Pedidos bajo Demanda
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Mensajes de estado del producto
   --------------------------------------------------------------------------- */
.oliva-pedido-aviso,
.oliva-sin-stock {
    margin-bottom: 1.5em;
}

.oliva-pedido-mensaje,
.oliva-sin-stock-mensaje {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    padding: 0.85em 1.1em;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 0.75em;
}

.oliva-pedido-mensaje {
    background-color: #fff8e1;
    border-left: 4px solid #f5a623;
    color: #7a5c00;
}

.oliva-sin-stock-mensaje {
    background-color: #fef2f2;
    border-left: 4px solid #e53e3e;
    color: #742a2a;
}

.oliva-tiempo-entrega {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 1em;
}

.oliva-tiempo-entrega strong {
    color: #333;
}

/* ---------------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------------- */
.oliva-btn-pedido,
.oliva-btn-pendiente {
    display: block;
    width: 100%;
    text-align: center;
    cursor: pointer;
    min-height: 44px; /* touch target mínimo */
}

.oliva-btn-pedido {
    background-color: #2d6a4f;
    border-color: #2d6a4f;
    color: #fff;
}

.oliva-btn-pedido:hover {
    background-color: #1b4332;
    border-color: #1b4332;
    color: #fff;
}

.oliva-btn-pendiente {
    background-color: #4a5568;
    border-color: #4a5568;
    color: #fff;
}

.oliva-btn-pendiente:hover {
    background-color: #2d3748;
    border-color: #2d3748;
    color: #fff;
}

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */
.oliva-modal-open {
    overflow: hidden;
}

.oliva-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oliva-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

.oliva-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 2em 2.2em 2.2em;
    width: 90%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.oliva-modal-close {
    position: absolute;
    top: 0.75em;
    right: 0.9em;
    background: none;
    border: none;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0.1em 0.3em;
    transition: color 0.2s;
}

.oliva-modal-close:hover {
    color: #333;
}

.oliva-modal-content h3 {
    margin: 0 0 0.3em;
    font-size: 1.25em;
}

.oliva-modal-subtitle {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 1.4em;
}

/* ---------------------------------------------------------------------------
   Formulario del modal
   --------------------------------------------------------------------------- */
.oliva-form-group {
    margin-bottom: 1.1em;
}

.oliva-form-group label {
    display: block;
    font-size: 0.875em;
    font-weight: 600;
    margin-bottom: 0.35em;
    color: #333;
}

.oliva-form-group label span[aria-hidden] {
    color: #e53e3e;
    margin-left: 0.1em;
}

.oliva-optional {
    font-weight: 400;
    color: #888;
    font-size: 0.85em;
}

.oliva-form-group input {
    width: 100%;
    padding: 0.6em 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.oliva-form-group input:focus {
    outline: none;
    border-color: #2d6a4f;
    box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.15);
}

.oliva-btn-submit {
    width: 100%;
    padding: 0.75em;
    font-size: 1em;
    margin-top: 0.5em;
    cursor: pointer;
    background-color: #2d6a4f;
    border-color: #2d6a4f;
    color: #fff;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.oliva-btn-submit:hover:not(:disabled) {
    background-color: #1b4332;
    border-color: #1b4332;
}

.oliva-btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Mensajes de respuesta del formulario
   --------------------------------------------------------------------------- */
#oliva-form-message {
    margin-top: 0.9em;
    padding: 0.7em 1em;
    border-radius: 4px;
    font-size: 0.9em;
    display: none;
}

#oliva-form-message:not(:empty) {
    display: block;
}

#oliva-form-message.oliva-success {
    background-color: #f0fff4;
    border: 1px solid #68d391;
    color: #276749;
}

#oliva-form-message.oliva-error {
    background-color: #fff5f5;
    border: 1px solid #fc8181;
    color: #9b2c2c;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

/* Tablet y abajo */
@media (max-width: 768px) {
    .oliva-modal-content {
        width: 95%;
        padding: 1.6em 1.4em 1.8em;
    }

    .oliva-pedido-mensaje,
    .oliva-sin-stock-mensaje {
        font-size: 0.9em;
    }
}

/* Móvil */
@media (max-width: 480px) {
    .oliva-modal-content {
        width: 100%;
        max-width: 100%;
        min-height: 100dvh;         /* ocupa pantalla completa en móvil */
        border-radius: 0;
        padding: 1.4em 1.1em 2em;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .oliva-modal {
        align-items: flex-end;      /* slide desde abajo en móvil */
    }

    .oliva-modal-content h3 {
        font-size: 1.1em;
        padding-right: 2em;         /* espacio para el botón ✕ */
    }

    .oliva-modal-close {
        top: 1em;
        right: 0.8em;
        font-size: 1.4em;
    }

    .oliva-form-group input {
        font-size: 1em;             /* evita zoom en iOS al enfocar */
        padding: 0.65em 0.75em;
    }

    .oliva-btn-submit {
        padding: 0.85em;
        font-size: 1em;
    }

    .oliva-pedido-mensaje,
    .oliva-sin-stock-mensaje {
        font-size: 0.875em;
        padding: 0.75em 0.9em;
    }

    /* Botones de producto full-width en móvil (ya son block, reforzamos) */
    .oliva-btn-pedido,
    .oliva-btn-pendiente {
        padding-top: 0.85em;
        padding-bottom: 0.85em;
    }
}
