/* ===============================
   RESET + BASE
================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(180deg, #e6f7f5, #f1f5f9);
    min-height: 100vh;
    color: #1e293b;
}

/* ===============================
   VARIABLES
================================ */
:root {
    --primary: #43cea2;
    --secondary: #185a9d;
    --dark: #0f172a;
    --gray: #64748b;
    --light: #ffffff;
    --radius: 18px;
    --shadow: 0 15px 35px rgba(0,0,0,0.18);
}

/* ===============================
   HEADER
================================ */
header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 16px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 999;
    overflow: visible;
}

.Logo {
    font-family: 'Pacifico', cursive;
    font-size: 30px;
    color: white;
    text-decoration: none;
}

/* ===============================
   BUSCADOR
================================ */
.Buscar {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 10px 25px;
}

.Buscar2 {
    width: 100%;
    max-width: 380px;
    position: relative;
}

.Buscar_i {
    width: 100%;
    padding: 13px 48px 13px 18px;
    border-radius: 30px;
    border: none;
    outline: none;
    font-size: 14px;
}

.busqueda {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

/* ===============================
   NAVBAR
================================ */
.navbar {
    display: flex;
    align-items: center;
    gap: 14px;
}

.navbar button,
.navbar a {
    background: none;
    border: none;
    cursor: pointer;
}

.navbar img {
    transition: transform .25s ease;
}

.navbar img:hover {
    transform: scale(1.15);
}

/* ===============================
   MENU USUARIO
================================ */
.container-cerrar-sesion {
    position: absolute;
    top: 80px;
    right: 20px;
    background: white;
    width: 200px;
    border-radius: var(--radius);
    padding: 18px;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
}

.container-cerrar-sesion img {
    width: 45px;
    align-self: center;
}

.container-cerrar-sesion span,
.container-cerrar-sesion a {
    font-size: 14px;
    text-align: center;
    color: var(--dark);
    text-decoration: none;
}

.container-cerrar-sesion a:hover {
    color: var(--secondary);
}

/* ===============================
   NOTIFICACIONES
================================ */
.container-noti {
    position: absolute;
    top: 80px;
    right: 70px;
    background: white;
    width: 260px;
    border-radius: var(--radius);
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    animation: fadeDown .4s ease;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nombre-usu-ofer {
    font-weight: 700;
    font-size: 14px;
}

.ofer-text {
    font-size: 13px;
    color: var(--gray);
}

.ver a {
    font-size: 13px;
    color: var(--secondary);
    text-decoration: none;
    margin-right: 10px;
}

/* ===============================
   GRID PRODUCTOS
================================ */
.container-items {
    padding: 35px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
}

/* ===============================
   CARD PRODUCTO
================================ */
.item {
    background: var(--light);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .25s ease, box-shadow .25s ease;
}

.item:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}

.item figure {
    height: 200px;
    overflow: hidden;
}

.item figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.item:hover figure img {
    transform: scale(1.08);
}

.Info_producto {
    padding: 16px;
}

.name-product {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.price,
.cambio {
    font-size: 14px;
    color: var(--gray);
}

/* ===============================
   BOTÓN
================================ */
.cambiarocomprar {
    width: 100%;
    padding: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform .2s ease, opacity .2s ease;
}

.cambiarocomprar:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* ===============================
   SKELETON LOADER
================================ */
.skeleton {
    background: linear-gradient(90deg, #eee, #f5f5f5, #eee);
    background-size: 200% 100%;
    animation: skeleton 1.4s infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===============================
   DARK MODE
================================ */
body.dark {
    background: #0f172a;
    color: #e5e7eb;
}

body.dark .item,
body.dark .container-noti,
body.dark .container-cerrar-sesion {
    background: #1e293b;
    color: #e5e7eb;
}

body.dark .Buscar_i {
    background: #1e293b;
    color: white;
}

/* ===============================
   RESPONSIVE
================================ */
@media (max-width: 768px) {

    header {
        flex-direction: column;
        gap: 12px;
    }

    .Buscar {
        width: 100%;
        margin: 10px 0;
    }

    .navbar {
        width: 100%;
        justify-content: space-between;
    }

    .container-items {
        padding: 20px;
        gap: 20px;
    }
}

@media (max-width: 480px) {

    .Logo {
        font-size: 24px;
    }

    .item figure {
        height: 160px;
    }

    .name-product {
        font-size: 15px;
    }
}
/* ===============================
   DARK MODE TOGGLE
================================ */
.dark-toggle {
    background: none;
    border: none;
    cursor: pointer;
}

.dark-toggle img {
    width: 26px;
}

/* ===============================
   FAVORITOS
================================ */
.fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: white;
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,.25);
    transition: transform .2s;
}

.fav-btn:hover {
    transform: scale(1.2);
}

.fav-btn.active {
    background: #ff4d6d;
}

.fav-btn img {
    width: 18px;
}

/* ===============================
   PREVIEW IMAGEN
================================ */
.preview-container {
    margin-top: 10px;
    text-align: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 180px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* ===============================
   CHAT FLOATING
================================ */
.chat-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.chat-btn img {
    width: 28px;
}

.chat-box {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 12px;
    font-weight: bold;
    text-align: center;
}

.chat-messages {
    padding: 10px;
    height: 200px;
    overflow-y: auto;
    font-size: 13px;
}

.chat-input {
    display: flex;
}

.chat-input input {
    flex: 1;
    border: none;
    padding: 10px;
}

.chat-input button {
    border: none;
    background: var(--secondary);
    color: white;
    padding: 10px;
    cursor: pointer;
}

/* ===============================
   LOADER
================================ */
.loader {
    width: 50px;
    height: 50px;
    border: 6px solid #ddd;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.user-menu {
    position: relative;
}

/* Botón */
.boton-cerrar {
    background: none;
    border: none;
    cursor: pointer;
}

/* Menú oculto por defecto */
.container-cerrar-sesion {
    position: absolute;
    top: 45px;
    right: 0;
    width: 180px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

/* Mostrar menú */
.container-cerrar-sesion.active {
    display: flex;
}

.container-cerrar-sesion img {
    width: 40px;
    margin: 0 auto;
}

.container-cerrar-sesion a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 6px;
    border-radius: 6px;
}

.container-cerrar-sesion a:hover {
    background: #f0f0f0;
}
header {
    overflow: visible !important;
}

.navbar {
    overflow: visible !important;
}

.user-menu {
    position: relative;
    overflow: visible !important;
}

/* Menú usuario */
.container-cerrar-sesion {
    position: absolute;
    top: 45px;
    right: 0;
    width: 180px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 99999; /* MUY IMPORTANTE */
}

.container-cerrar-sesion.active {
    display: flex;
}
