/* =========================================
   1. VARIABLES (Personaliza los colores aquí)
   ========================================= */
:root {
    --principal: #ff8c00;    /* Naranja Ferretero principal */
    --oscuro: #2d2d2d;       /* Gris muy oscuro para contraste */
    --gris-claro: #f4f4f4;   /* Fondo de la página */
    --blanco: #ffffff;
    --whatsapp: #25d366;     /* Verde oficial de WA */
    --sombra: 0 4px 12px rgba(0,0,0,0.1);
}

/* =========================================
   2. REGLAS BASE
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--gris-claro);
    color: var(--oscuro);
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   3. HEADER Y BUSQUEDA
   ========================================= */
header {
    background-color: var(--oscuro);
    color: white;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 5px solid var(--principal);
}

header h1 { font-size: 2.2rem; margin-bottom: 10px; }

.contenedor-busqueda {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: var(--blanco);
}

.barra-busqueda {
    display: flex;
    width: 100%;
    max-width: 600px;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--sombra);
    border: 2px solid #ddd;
    transition: 0.3s;
}

.barra-busqueda:focus-within { border-color: var(--principal); }

.barra-busqueda input {
    border: none;
    padding: 12px 20px;
    width: 100%;
    outline: none;
    font-size: 1rem;
}

.btn-buscar {
    background: var(--principal);
    border: none;
    color: white;
    padding: 0 20px;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   4. CATEGORÍAS (Cuadros de arriba)
   ========================================= */
.seccion-categorias { padding: 30px 15px; text-align: center; }

.grid-categorias {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en móvil */
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
}

.caja-cat {
    background: var(--oscuro);
    color: white;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
    border-bottom: 4px solid var(--principal);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.caja-cat:hover {
    background: var(--principal);
    transform: translateY(-3px);
}

/* =========================================
   5. GRID DE PRODUCTOS
   ========================================= */
.grid-productos {
    display: grid;
    grid-template-columns: 1fr; /* 1 columna en móvil */
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.tarjeta-producto {
    background: var(--blanco);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--sombra);
    transition: 0.3s;
    border: 1px solid #eee;
}

.tarjeta-producto:hover { transform: translateY(-5px); }

.tarjeta-producto img {
    width: 100%;
    height: 200px;
    object-fit: contain; /* Para que la herramienta se vea completa */
    background: #f9f9f9;
}

.info { padding: 20px; text-align: center; }

.categoria-tag {
    background: #eee;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #666;
}

.precio {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--principal);
    margin: 10px 0;
}

.btn-ver {
    display: block;
    background: var(--principal);
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
}

/* =========================================
   6. COMPONENTES FLOTANTES (Chat / WA)
   ========================================= */
/* CONTENEDOR DE BOTONES FLOTANTES */
.botones-flotantes {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column; /* Apila uno arriba del otro */
    gap: 15px; /* Espacio entre los botones */
    z-index: 9999;
}

/* ESTILO BASE PARA AMBOS BOTONES */
.btn-redondo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

.btn-redondo:hover {
    transform: scale(1.1);
}

/* COLORES ESPECÍFICOS */
.btn-wa {
    background-color: #25d366; /* Verde WhatsApp */
}

.btn-chat {
    background-color: var(--principal); /* Tu naranja ferretero */
}

/* Iconos (ajuste opcional) */
.btn-redondo img {
    width: 30px;
    height: 30px;
}

/* =========================================
   7. MEDIA QUERIES (Ajustes de pantalla)
   ========================================= */

/* Tablets (600px o más) */
@media (min-width: 600px) {
    .grid-categorias { grid-template-columns: repeat(4, 1fr); }
    .grid-productos { grid-template-columns: repeat(2, 1fr); }
}

/* Computadoras (1000px o más) */
@media (min-width: 1000px) {
    .grid-productos { grid-template-columns: repeat(3, 1fr); }
    header h1 { font-size: 3rem; }
}

/* Ocultar texto de WA en pantallas pequeñas */
@media (max-width: 480px) {
    .btn-flotante span { display: none; }
    .btn-flotante { padding: 15px; border-radius: 50%; }
}

/* =========================================
   ESTILOS EXCLUSIVOS DEL CHATBOT
   ========================================= */

/* Contenedor que agrupa WA y Chat */
.botones-flotantes {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
}

/* Botones Redondos (WA y Chat) */
.btn-redondo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: 0.3s;
    border: none;
    text-decoration: none;
}

.btn-wa { background-color: #25d366; }
.btn-chat { background-color: #ff8c00; color: white; font-size: 28px; }

.btn-redondo:hover { transform: scale(1.1); }

/* VENTANA DEL CHAT */
#ventana-chat {
    width: 300px;
    height: 400px;
    background: white;
    border-radius: 15px;
    display: none; /* Se activa con JS */
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    position: absolute;
    bottom: 75px; /* Aparece arriba del botón naranja */
    right: 0;
    border: 1px solid #ddd;
}

/* Cabecera del Chat */
.chat-header {
    background: #2d2d2d;
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cuerpo del Chat */
.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Burbujas de Mensajes */
.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.bot {
    background: #eee;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.user {
    background: #ff8c00;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Pie del Chat (Input) */
.chat-footer {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-footer input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px;
    font-size: 0.9rem;
}

.chat-footer button {
    background: none;
    border: none;
    color: #ff8c00;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
}
