/* =============================================
   MARKETPLACE NICARAGUA - Diseño Profesional
   ============================================= */

:root {
    --primary: #1a56db;
    --primary-dark: #1e429f;
    --primary-light: #ebf5ff;
    --secondary: #e3a008;
    --success: #057a55;
    --danger: #c81e1e;
    --dark: #111928;
    --gray: #6b7280;
    --light: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 8px;
    --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    font-size: 15px;
}

a { text-decoration: none; color: inherit; }

/* ---- NAVBAR ---- */
.navbar {
    background: var(--primary);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.navbar-brand span { color: #fbbf24; }

.search-bar {
    flex: 1;
    max-width: 480px;
    display: flex;
}

.search-bar input {
    flex: 1;
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.9rem;
    outline: none;
    background: rgba(255,255,255,0.95);
}

.search-bar button {
    padding: 9px 18px;
    background: #fbbf24;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #111;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.nav-links {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
}

.nav-links a:hover { background: rgba(255,255,255,0.12); }

.btn-publicar {
    background: #fbbf24 !important;
    color: #111 !important;
    font-weight: 600 !important;
}

/* ---- CONTENEDOR ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ---- HERO ---- */
.hero {
    background: linear-gradient(135deg, #1a56db 0%, #1e429f 100%);
    color: white;
    text-align: center;
    padding: 56px 20px;
}

.hero h1 {
    font-size: 2.1rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.05rem;
    opacity: 0.85;
    margin-bottom: 28px;
    font-weight: 400;
}

.hero-search {
    display: flex;
    max-width: 580px;
    margin: 0 auto;
}

.hero-search input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 1rem;
    outline: none;
}

.hero-search button {
    padding: 14px 28px;
    background: #fbbf24;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #111;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
}

/* ---- CATEGORIAS ---- */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.categoria-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    border: 1.5px solid var(--border);
    transition: all 0.15s;
    box-shadow: var(--shadow);
}

.categoria-card:hover, .categoria-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.categoria-card .cat-icon {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
}

.categoria-card .name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

/* ---- SECTION TITLE ---- */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--dark);
    letter-spacing: -0.3px;
}

/* ---- PRODUCTOS GRID ---- */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.producto-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1.5px solid var(--border);
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
}

.producto-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.badge-destacado {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--secondary);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.producto-card img {
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.producto-card .no-foto {
    width: 100%;
    height: 190px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-foto svg { color: #9ca3af; }

.producto-info { padding: 14px; }

.producto-info .precio {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.producto-info .titulo {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--dark);
}

.producto-info .meta {
    font-size: 0.78rem;
    color: var(--gray);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-contactar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s;
    letter-spacing: 0.2px;
}

.btn-contactar:hover { background: var(--primary-dark); }

/* ---- BOTONES ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s;
    text-decoration: none;
    letter-spacing: 0.2px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- FORMULARIOS ---- */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    background: white;
    color: var(--dark);
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ---- CARD ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1.5px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--border);
    color: var(--dark);
    letter-spacing: -0.2px;
}

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---- FILTROS ---- */
.filtros-bar {
    background: white;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
}

.filtros-bar select, .filtros-bar input {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

/* ---- DETALLE PRODUCTO ---- */
.producto-detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.fotos-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.fotos-thumbs img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
}

.fotos-thumbs img.active { border-color: var(--primary); }

.precio-grande {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 12px 0;
    letter-spacing: -1px;
}

.vendedor-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--light);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    margin: 16px 0;
}

.vendedor-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---- PANEL USUARIO ---- */
.panel-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
}

.panel-sidebar {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    padding: 16px;
    height: fit-content;
}

.panel-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: #374151;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.panel-menu a:hover { background: var(--light); }
.panel-menu a.active { background: var(--primary); color: white; }

/* ---- TABLA ---- */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: var(--light); padding: 11px 14px; text-align: left; font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); border-bottom: 1.5px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; color: var(--dark); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

/* ---- STATS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}

.stat-card .number { font-size: 2rem; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.stat-card .label { font-size: 0.8rem; color: var(--gray); margin-top: 4px; font-weight: 500; }

/* ---- PAGINACION ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination a {
    padding: 8px 14px;
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    color: var(--dark);
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.15s;
}

.pagination a:hover, .pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ---- CHAT ---- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 420px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fafb;
}

.chat-msg {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg.enviado {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.recibido {
    background: white;
    color: var(--dark);
    align-self: flex-start;
    border: 1.5px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-msg .msg-hora {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.chat-msg.recibido .msg-autor {
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--primary);
}

.chat-input {
    display: flex;
    gap: 0;
    border-top: 1.5px solid var(--border);
    background: white;
}

.chat-input input {
    flex: 1;
    padding: 13px 16px;
    border: none;
    outline: none;
    font-size: 0.92rem;
    font-family: inherit;
}

.chat-input button {
    padding: 13px 20px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88rem;
    transition: background 0.15s;
    letter-spacing: 0.3px;
}

.chat-input button:hover { background: var(--primary-dark); }

.chat-lista .chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--dark);
}

.chat-item:hover { background: var(--light); }
.chat-item.unread { background: var(--primary-light); }

.chat-item .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-item .info { flex: 1; min-width: 0; }
.chat-item .nombre { font-weight: 600; font-size: 0.9rem; }
.chat-item .preview { font-size: 0.8rem; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .hora { font-size: 0.75rem; color: var(--gray); flex-shrink: 0; }
.badge-unread { background: var(--primary); color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }

/* ---- FOOTER ---- */
footer {
    background: var(--dark);
    color: #9ca3af;
    text-align: center;
    padding: 24px;
    margin-top: 48px;
    font-size: 0.85rem;
}

footer a { color: #fbbf24; }
footer strong { color: white; }

/* ---- BADGE ---- */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ---- DIVIDER ---- */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .navbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; }
    .search-bar { order: 3; width: 100%; max-width: 100%; }
    .hero h1 { font-size: 1.5rem; }
    .productos-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .producto-detalle-grid { grid-template-columns: 1fr; }
    .panel-grid { grid-template-columns: 1fr; }
    .categorias-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 480px) {
    .productos-grid { grid-template-columns: 1fr; }
    .categorias-grid { grid-template-columns: repeat(4, 1fr); }
}
