/* ===== COMPRAS PAGE CSS (Neo-Brutalism) ===== */

.contenedor-compras {
    max-width: 800px; /* Un poco más ancho que el perfil para acomodar la tabla o lista */
}

/* Lista de pedidos */
.compras-lista {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.compra-card {
    background: #fff;
    border: 2px solid #000;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 4px 4px 0px #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.compra-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #1fb546;
}

.compra-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.compra-codigo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #000;
}

.compra-fecha {
    font-size: 0.9rem;
    color: #555;
}

.compra-detalles-mini {
    margin-top: 5px;
    display: flex;
    gap: 15px;
    font-size: 0.95rem;
    font-weight: 600;
}

.compra-estado {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    border: 2px solid #000;
    text-transform: uppercase;
}

.estado-pendiente {
    background-color: #f1c40f;
    color: #000;
}

.estado-completado {
    background-color: #1fb546;
    color: #fff;
}

.estado-cancelado {
    background-color: #ff4d4d;
    color: #fff;
}

.estado-lista-retiro {
    background-color: #3498db;
    color: #fff;
}

/* Link de ubicación GPS para retiro */
.link-ubicacion-retiro {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    padding: 6px 14px;
    background-color: #3498db;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid #000;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 3px 3px 0px #000;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.link-ubicacion-retiro:hover {
    background-color: #2980b9;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px #000;
    color: #fff;
    text-decoration: none;
}

.link-ubicacion-retiro .fa-map-marker {
    font-size: 1rem;
}

/* Versión modal: ocupa el ancho completo */
.link-ubicacion-modal {
    display: flex;
    justify-content: center;
    font-size: 0.95rem;
    padding: 10px 18px;
    box-shadow: 4px 4px 0px #000;
    border-radius: 10px;
}

.btn-ver-detalle {
    background: #000;
    color: #fff;
    border: 2px solid #000;
    padding: 10px 15px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 3px 3px 0px #1fb546;
    transition: all 0.2s ease;
}

.btn-ver-detalle:hover {
    background: #1fb546;
    color: #000;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px #000;
}

/* Modal Detalle Compra */
.modal-detalle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-detalle-box {
    background: #fff;
    border: 3px solid #000;
    border-radius: 16px;
    box-shadow: 8px 8px 0px #000;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.btn-cerrar-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff4d4d;
    color: #fff;
    border: 2px solid #000;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-cerrar-modal:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000;
}

.modal-detalle-titulo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #000;
}

.detalle-info-basica {
    background: #f0f2f5;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 3px 3px 0px #000;
}

.detalle-info-basica p {
    margin-bottom: 8px;
    font-size: 1rem;
}

.detalle-info-basica p:last-child {
    margin-bottom: 0;
}

.badge-estado {
    padding: 2px 6px;
    border: 1px solid #000;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
}

.detalle-productos-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.detalle-producto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 2px dashed #000;
    border-radius: 8px;
}

.dp-nombre {
    font-weight: 700;
    font-size: 1rem;
}

.dp-cantidad {
    color: #666;
    font-size: 0.9rem;
    margin-top: 3px;
}

.dp-subtotal {
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.detalle-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1fb546;
    color: #fff;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    box-shadow: 4px 4px 0px #000;
}


/* ==========================================================================
   RESPONSIVIDAD MÓVIL - COMPRAS
   ========================================================================== */

/* Tablet y pantallas medianas */
@media (max-width: 768px) {
    /* El body deja de centrar verticalmente para no cortar contenido largo */
    .pagina-perfil-body {
        align-items: flex-start;
        padding: 15px;
    }

    /* El contenedor ocupa casi toda la pantalla */
    .contenedor-perfil {
        padding: 20px 16px;
        border-radius: 16px;
        box-shadow: 5px 5px 0px rgba(0, 0, 0, 1);
    }

    .contenedor-compras {
        max-width: 100%;
    }

    /* Cabecera más compacta */
    .perfil-titulo {
        font-size: 1.3rem;
    }

    .perfil-logo img {
        max-width: 180px;
    }

    /* Modal más compacto */
    .modal-detalle-overlay {
        padding: 10px;
        align-items: flex-end; /* El modal sube desde abajo en móvil */
    }

    .modal-detalle-box {
        border-radius: 20px 20px 0 0;
        padding: 24px 18px 28px 18px;
        max-height: 92vh;
        box-shadow: 0 -4px 0px #000;
    }

    .modal-detalle-titulo {
        font-size: 1.2rem;
        padding-right: 40px; /* espacio para el botón cerrar */
        word-break: break-word;
    }

    .detalle-info-basica p {
        font-size: 0.9rem;
    }

    .detalle-total {
        font-size: 1.1rem;
        padding: 12px;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .pagina-perfil-body {
        padding: 10px;
    }

    .contenedor-perfil {
        padding: 16px 12px;
        border-radius: 12px;
    }

    .perfil-header {
        margin-bottom: 18px;
    }

    .perfil-titulo {
        font-size: 1.15rem;
    }

    /* Tarjeta de compra: apila verticalmente en móvil */
    .compra-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 16px;
        border-radius: 10px;
        box-shadow: 3px 3px 0px #000;
    }

    .compra-card:hover {
        transform: none;
        box-shadow: 3px 3px 0px #1fb546;
    }

    .compra-codigo {
        font-size: 1rem;
    }

    .compra-fecha {
        font-size: 0.82rem;
    }

    .compra-detalles-mini {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 4px;
    }

    .compra-estado {
        font-size: 0.75rem;
        padding: 3px 7px;
    }

    /* Botón "Ver Detalle" ocupa todo el ancho */
    .btn-ver-detalle {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 0.95rem;
    }

    /* Link de ubicación ocupa todo el ancho */
    .link-ubicacion-retiro {
        width: 100%;
        justify-content: center;
        font-size: 0.82rem;
        white-space: normal;
        text-align: center;
    }

    /* Modal fondo sin padding lateral */
    .modal-detalle-overlay {
        padding: 0;
    }

    .modal-detalle-box {
        border-radius: 18px 18px 0 0;
        padding: 20px 14px 24px 14px;
        max-height: 95vh;
    }

    .modal-detalle-titulo {
        font-size: 1.05rem;
        margin-bottom: 14px;
        padding-bottom: 8px;
    }

    /* Producto item del modal: sin overflow */
    .detalle-producto-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 8px;
    }

    .dp-subtotal {
        align-self: flex-end;
        font-size: 1rem;
    }

    .dp-nombre {
        font-size: 0.9rem;
    }

    .dp-cantidad {
        font-size: 0.82rem;
    }

    .detalle-total {
        font-size: 1rem;
        padding: 10px 12px;
        border-radius: 6px;
    }

    .detalle-info-basica {
        padding: 12px;
        box-shadow: 2px 2px 0px #000;
    }

    .detalle-info-basica p {
        font-size: 0.85rem;
        word-break: break-word;
    }

    /* Link ubicación en modal centrado */
    .link-ubicacion-modal {
        font-size: 0.88rem;
        padding: 9px 12px;
    }

    /* Toast en móvil: ocupa más ancho */
    .toast-container {
        right: 10px;
        left: 10px;
        bottom: 14px;
    }

    .toast {
        max-width: 100%;
        font-size: 0.9rem;
        padding: 12px 14px;
    }

    /* Btn cerrar modal más accesible */
    .btn-cerrar-modal {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
}

