body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: #e6f7ff;
    color: #333;
}

a {
    text-decoration: none;
}

.content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

/* ====== Header ====== */
header {
    background-color: #00aaff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header nav a {
    color: white;
    margin-left: 20px;
    font-weight: bold;
    font-size: 16px;
}

header nav a:hover {
    text-decoration: underline;
}

/* ====== Modal General ====== */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 170, 255, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #f9fcff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: animarModal 0.3s ease;
}

@keyframes animarModal {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ====== Estilos Publicaciones ====== */
.detalle-publicacion {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    padding: 20px;
    max-width: 1100px;
    margin: 30px auto;
    align-items: start;
}

.izquierda {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.galeria {
    background: white;
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
}

.galeria img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.info-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
    height: 100%; /* <- ACA EL CAMBIO IMPORTANTE */
    display: flex;
    flex-direction: column;
}

.info-box h1 {
    margin-bottom: 10px;
    font-size: 28px;
    color: #333;
}

.info-box h2 {
    color: #00aaff;
    margin-bottom: 20px;
    font-size: 24px;
}

.info-box h3 {
    margin-top: 20px;
    color: #555;
    font-size: 20px;
}

.info-box p, .info-box ul li {
    margin-bottom: 10px;
    font-size: 16px;
}

.vendedor-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.btn-contactar {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #00aaff;
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
}

.btn-contactar:hover {
    background-color: #008ecc;
}

/* ====== Cards de publicaciones en index.php ====== */
.publicaciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); /* 🔥 Mejor distribución */
    gap: 25px;
    padding: 20px;
    justify-content: center;
}

.card-publicacion {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%; /* 🔥 Que ocupen todo el alto */
    position: relative;
}

.card-publicacion:hover {
    transform: scale(1.02);
}

.carrusel-imagenes {
    width: 100%;
    height: 200px;
    overflow-x: auto;
    display: flex;
    scroll-snap-type: x mandatory;
}

.carrusel-imagenes img {
    flex-shrink: 0;
    width: 100%;
    height: 200px;
    object-fit: cover;
    scroll-snap-align: start;
    border-bottom: 1px solid #eee;
}

.card-publicacion h3 {
    font-size: 18px;
    margin: 10px 0 5px;
    color: #333;
    text-align: center;
}

.card-publicacion .precio {
    font-weight: bold;
    color: #00aaff;
    margin-bottom: 10px;
}

.btn-vermas {
    background-color: #00aaff;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    margin-bottom: 15px;
    transition: background-color 0.2s;
}

.btn-vermas:hover {
    background-color: #0077cc;
}

/* ====== Estilos Modal Login y Registro ====== */
.modal-content form {
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="number"],
.modal-content input[type="checkbox"] {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="email"]:focus,
.modal-content input[type="password"]:focus,
.modal-content input[type="number"]:focus {
    border-color: #00aaff;
    outline: none;
}

.modal-content button {
    background-color: #00aaff;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.modal-content button:hover {
    background-color: #0088cc;
}

/* Estilo para la label del checkbox */
.modal-content label {
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

/* ====== Estilos generales de los modales ====== */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 170, 255, 0.6); /* Fondo semitransparente celeste */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #f9fcff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFade 0.3s ease;
    position: relative; /* 🔥 Fundamental */
}

/* Animación modal */
@keyframes modalFade {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Estilos internos */
.modal-content h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
    color: #00aaff;
}

.modal-content form {
    display: flex;
    flex-direction: column;
}

.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="number"],
.modal-content input[type="file"],
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    box-sizing: border-box;
}

.modal-content input[type="checkbox"] {
    margin-right: 8px;
}

.modal-content textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    border-color: #00aaff;
    outline: none;
}

/* Botones */
.modal-content button {
    background-color: #00aaff;
    color: white;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background-color: #008ecc;
}

.cerrar:hover {
    color: #0077cc;
}

/* Scroll lindo en modales largos */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-thumb {
    background-color: #00aaff;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.btn-denunciar {
    display: inline-block;
    padding: 10px 20px;
    background-color: #ff4d4d;
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-denunciar:hover {
    background-color: #e60000;
}

/* Overlay de carga */
#overlay-carga {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* Spinner */
.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #00aaff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: girar 1s linear infinite;
}

@keyframes girar {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensaje flotante */
#mensaje-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00cc66;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 3000;
    animation: aparecer 0.5s;
}

#mensaje-flotante.error {
    background: #ff3333;
}

@keyframes aparecer {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-publicar form input,
.modal-publicar form select,
.modal-publicar form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px; /* Un solo renglón de separación */
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    box-sizing: border-box;
}

.modal-publicar form button {
    width: 100%;
    background-color: #00aaff;
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    margin-top: 10px;
}

.modal-publicar form button:hover {
    background-color: #008ecc;
}

.preview-imagenes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.preview-imagenes img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

#overlay-carga-login {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#mensaje-login-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00cc66;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 3000;
    animation: aparecer 0.5s;
}

#mensaje-login-flotante.error {
    background: #ff3333;
}

.modal-content .cerrar {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    font-weight: bold;
    color: #00aaff;
    cursor: pointer;
    z-index: 10;
}

.modal-content .cerrar:hover {
    color: #008ecc;
}

.cerrar {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    font-weight: bold;
    color: #00aaff;
    cursor: pointer;
    z-index: 30; /* 🔥 Siempre visible */
}

.cerrar:hover {
    color: #0077cc;
}

.contenedor-preview {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.imagen-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.boton-eliminar {
    position: absolute;
    top: 5px; /* más adentro */
    right: 5px; /* más adentro */
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 16px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transition: background 0.3s;
}

.boton-eliminar:hover {
    background: #e60000;
}
.carrusel-contenedor {
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 10px;
}

.carrusel-imagenes {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    height: 200px;
    width: 100%;
    scroll-behavior: smooth;
    scrollbar-width: none; /* 🔥 Para Firefox */
    -ms-overflow-style: none; /* 🔥 Para IE y Edge */
}

.carrusel-imagenes::-webkit-scrollbar {
    display: none; /* 🔥 Para Chrome, Safari */
}

.carrusel-imagenes img {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    object-fit: cover;
    scroll-snap-align: center;
}

.carrusel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 170, 255, 0.7);
    border: none;
    color: white;
    font-size: 20px;
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    z-index: 5;
    border-radius: 50%;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carrusel-btn.prev {
    left: 8px;
}

.carrusel-btn.next {
    right: 8px;
}

.carrusel-btn:hover {
    background: rgba(0, 170, 255, 0.9);
}
.galeria-carrusel {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.galeria-imagenes {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.galeria-imagenes::-webkit-scrollbar {
    display: none;
}

.galeria-imagenes img {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    object-fit: contain;
    scroll-snap-align: center;
}

.galeria-carrusel .carrusel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 170, 255, 0.7);
    border: none;
    color: white;
    font-size: 26px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.galeria-carrusel .prev {
    left: 10px;
}

.galeria-carrusel .next {
    right: 10px;
}

.galeria-carrusel .carrusel-btn:hover {
    background: rgba(0, 170, 255, 0.9);
}
