/* Marketplace nypau — "aviso mural": el anuncio pegado en el poste/almacén.
   Papel cálido + tinta oscura en claro, pizarra en oscuro (según el sistema
   del visitante). Precio a mano, categoría como tag colgando, tarjetas con
   leve inclinación que se enderezan al pasar el mouse. */
:root {
    --bg: #faf8f4;
    --superficie: #fffdfa;
    --borde: rgba(20,16,10,0.16);
    --borde-hover: rgba(20,16,10,0.4);
    --texto: #141414;
    --texto-2: #6b6660;
    --rojo: #a8332b;
    --verde: #3c7a6e;
    --accent: #8a4a30;
    --tape1: #e8b400;
    --tape2: #c24b3c;
    --tape3: #3c7a6e;
    --sombra: rgba(20,16,10,0.14);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1a17;
        --superficie: #242019;
        --borde: rgba(245,241,230,0.14);
        --borde-hover: rgba(245,241,230,0.35);
        --texto: #f5f1e6;
        --texto-2: #b7ac99;
        --rojo: #e2685a;
        --verde: #5fb3a3;
        --accent: #c9ab8f;
        --tape1: #f2c94c;
        --tape2: #e2685a;
        --tape3: #5fb3a3;
        --sombra: rgba(0,0,0,0.45);
    }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--texto);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: inherit; text-decoration: none; }
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: 0.9rem 1.5rem; border-bottom: 1.5px solid var(--texto);
    position: sticky; top: 0; background: var(--bg); z-index: 100;
}
.logo { font-family: Georgia, 'Times New Roman', serif; font-weight: 900; font-style: italic; font-size: 1.35rem; }
.logo span { color: var(--texto-2); font-weight: 400; font-style: normal; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { font-size: 0.9rem; color: var(--texto-2); }
.topbar nav a:hover { color: var(--texto); }
.btn-borde {
    border: 1.5px solid var(--texto); border-radius: 999px; padding: 0.4rem 0.9rem;
    color: var(--texto) !important; transition: background 0.2s, color 0.2s;
}
.btn-borde:hover { background: var(--texto); color: var(--bg) !important; }

footer { border-top: 1px solid var(--borde); padding: 1.25rem; text-align: center; color: var(--texto-2); font-size: 0.8rem; }
footer a { text-decoration: underline; text-underline-offset: 2px; }

/* Grilla de publicaciones: tarjetas tipo aviso pegado, leve inclinación
   alternada que se endereza al pasar el mouse (como sacarlo del corcho). */
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2rem 1.4rem; align-items: start; margin-top: 1.5rem; }
.tarjeta {
    position: relative; background: var(--superficie); border: 1.5px solid var(--texto); border-radius: 10px;
    overflow: visible; transition: transform 0.2s cubic-bezier(.2,.8,.3,1), box-shadow 0.2s; display: block;
    transform: rotate(var(--rot, -1.2deg));
    box-shadow: 0 3px 6px var(--sombra);
}
.grilla .tarjeta:nth-child(3n+1) { --rot: -1.4deg; }
.grilla .tarjeta:nth-child(3n+2) { --rot: 1.1deg; }
.grilla .tarjeta:nth-child(3n+3) { --rot: -0.7deg; }
.tarjeta:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 10px 18px var(--sombra); z-index: 2; }
.tarjeta::before {
    /* Pin de cinta arriba de cada aviso */
    content: ""; position: absolute; top: -8px; left: 50%; width: 56px; height: 18px;
    transform: translateX(-50%) rotate(-3deg); background: var(--tape2); opacity: 0.85;
    box-shadow: 0 1px 2px var(--sombra); border-radius: 2px;
}
.tarjeta:nth-child(2n)::before { background: var(--tape1); transform: translateX(-50%) rotate(3deg); }
.tarjeta:nth-child(3n)::before { background: var(--tape3); }
.tarjeta .foto { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--borde); display: block; border-radius: 9px 9px 0 0; }
.tarjeta .sin-foto {
    width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
    color: var(--texto-2); font-size: 2rem; border-radius: 9px 9px 0 0; opacity: 0.85;
    background: repeating-linear-gradient(135deg, var(--borde) 0 1px, transparent 1px 10px);
}
.tarjeta .datos { padding: 0.8rem 0.9rem; position: relative; }
/* Tag de categoría colgando, con "agujerito" -- como una etiqueta de papel
   clipeada a la tarjeta, tal como en la maqueta original. */
.tarjeta .cat-tag {
    position: absolute; top: -10px; left: 8px; z-index: 2;
    background: var(--superficie); border: 1.5px solid var(--texto); border-radius: 3px;
    padding: 0.1rem 0.5rem 0.1rem 0.85rem; font-size: 0.62rem; text-transform: uppercase;
    letter-spacing: 0.05em; transform: rotate(-3deg); color: var(--texto);
}
.tarjeta .cat-tag::before {
    content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: var(--superficie); border: 1.5px solid var(--texto);
}
.tarjeta .precio { font-family: 'Comic Sans MS', 'Marker Felt', cursive; font-weight: 700; font-size: 1.3rem; color: var(--accent); transform: rotate(-1.5deg); display: inline-block; }
.tarjeta .titulo { color: var(--texto); font-size: 0.9rem; margin-top: 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tarjeta .meta { color: var(--texto-2); font-size: 0.75rem; margin-top: 0.4rem; }

/* Formularios / paneles */
form.panel, .panel {
    background: var(--superficie); border: 1.5px solid var(--texto); border-radius: 12px;
    padding: 1.5rem; max-width: 560px; margin: 1.5rem auto; box-shadow: 0 3px 8px var(--sombra);
}
.panel h2 { font-family: Georgia, serif; font-size: 1.05rem; margin: 1.5rem 0 0.6rem; }
.panel ul { padding-left: 1.2rem; margin-bottom: 0.6rem; }
.panel li { margin-bottom: 0.4rem; line-height: 1.5; color: var(--texto-2); }
.panel p { line-height: 1.6; color: var(--texto-2); margin-bottom: 0.6rem; }
.panel a { text-decoration: underline; text-underline-offset: 2px; }
label { display: block; font-size: 0.85rem; color: var(--texto-2); margin: 0.9rem 0 0.3rem; }
input, textarea, select {
    width: 100%; background: var(--bg); border: 1.5px solid var(--borde); border-radius: 8px;
    color: var(--texto); padding: 0.6rem 0.75rem; font-family: inherit; font-size: 0.95rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--texto); }
input[type="checkbox"] {
    width: auto; flex-shrink: 0; background: none; border: none; padding: 0;
    accent-color: var(--texto); cursor: pointer;
}
textarea { min-height: 120px; resize: vertical; }
button, .boton {
    background: var(--texto); color: var(--bg); border: 1.5px solid var(--texto); border-radius: 999px;
    padding: 0.65rem 1.3rem; font-family: inherit; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; margin-top: 1.1rem; display: inline-block;
}
button:hover, .boton:hover { opacity: 0.85; }
button.secundario, .boton.secundario { background: none; color: var(--texto); border: 1.5px solid var(--texto); }
button.peligro { background: none; color: var(--rojo); border: 1.5px solid var(--rojo); }
.error-msg { background: none; border: 1.5px solid var(--rojo); color: var(--rojo); border-radius: 8px; padding: 0.7rem 1rem; margin-top: 1rem; font-size: 0.9rem; }
.ok-msg { background: none; border: 1.5px solid var(--verde); color: var(--verde); border-radius: 8px; padding: 0.7rem 1rem; margin-top: 1rem; font-size: 0.9rem; }

/* Buscador de la home */
.buscador { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.buscador input { flex: 1; min-width: 200px; }
.buscador select { width: auto; }
.buscador button { margin-top: 0; }

/* Detalle de publicación: el aviso "ampliado", recto (sin inclinación) para
   que se lea claro -- la inclinación queda solo para la tarjeta chica. */
.detalle {
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; margin-top: 1.5rem;
    background: var(--superficie); border: 1.5px solid var(--texto); border-radius: 12px; padding: 1.5rem;
    box-shadow: 0 4px 10px var(--sombra);
}
@media (max-width: 800px) { .detalle { grid-template-columns: 1fr; } }
.galeria img { width: 100%; border-radius: 10px; border: 1.5px solid var(--texto); margin-bottom: 0.75rem; }
.info-pub h1 { font-family: Georgia, 'Times New Roman', serif; font-weight: 900; font-style: italic; font-size: 1.5rem; text-wrap: balance; }
.info-pub .precio-grande { font-family: 'Comic Sans MS', 'Marker Felt', cursive; font-size: 2.2rem; font-weight: 700; margin: 0.6rem 0; color: var(--accent); }
.chip { display: inline-block; border: 1.5px solid var(--texto); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.78rem; color: var(--texto); }
.chip.vendida { color: var(--rojo); border-color: var(--rojo); }
.descripcion { white-space: pre-wrap; color: var(--texto-2); margin-top: 1rem; line-height: 1.55; }
.contacto-botones { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.25rem; }
.boton-wsp { background: var(--verde); border-color: var(--verde); color: var(--bg); }

/* Perfil público (tienda del vendedor) */
.cabecera-perfil { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.5rem; flex-wrap: wrap; }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--texto); background: var(--borde); }
.avatar-placeholder { width: 84px; height: 84px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-size: 2rem; background: var(--borde); border: 1.5px solid var(--texto); }
.bio { color: var(--texto-2); margin-top: 0.3rem; max-width: 640px; white-space: pre-wrap; }

/* Tablas admin / mis publicaciones */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--borde); }
th { color: var(--texto-2); font-weight: 600; font-size: 0.8rem; }
td form { display: inline; }
td button { margin-top: 0; padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.estado-pendiente { color: var(--tape2); }
.estado-aprobado { color: var(--verde); }
.estado-suspendido, .estado-eliminada { color: var(--rojo); }
.miniatura { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borde); }

h1.titulo-seccion { font-family: Georgia, 'Times New Roman', serif; font-weight: 900; font-style: italic; font-size: 1.7rem; margin-top: 1rem; text-wrap: balance; }
.subtitulo { color: var(--texto-2); font-size: 0.9rem; margin-top: 0.25rem; }
.fotos-edit { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.fotos-edit .foto-item { position: relative; }
.fotos-edit img { width: 90px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); }
.fotos-edit label { font-size: 0.7rem; margin: 0.2rem 0 0; text-align: center; }

/* ===== Personalización de tienda del vendedor: swatches circulares para
   elegir fondo/letra/cintas, usados en mi_perfil.html. Mismo lenguaje visual
   que el resto del sitio, sin nada de color libre (listas fijas). ===== */
.swatches { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.4rem; }
.swatch {
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    border: 1.5px solid rgba(128,128,128,0.4); position: relative; padding: 0;
    display: flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-weight: 700;
}
.swatch.ink-swatch { background: #c9c5bb; font-size: 0.85rem; }
.swatch.active::after {
    content: "✓"; position: absolute; inset: -4px; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 900; width: 16px; height: 16px; margin: auto;
    background: #fff; color: #000; border-radius: 50%; border: 1.5px solid var(--bg);
}
