/* style.css - Adaptación E-Commerce Grilla (Inspiración en ML) */

/* ═══ PANTALLA DE LOGIN ═══ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
}
.login-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 16px;
    padding: 40px 35px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    animation: loginSlideUp 0.5s ease-out;
}
@keyframes loginSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-logo {
    font-size: 2.5rem;
    font-weight: 800;
    color: #2D3277;
    letter-spacing: -1px;
    margin-bottom: 5px;
}
.login-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}
.login-form {
    text-align: left;
}
.login-field {
    margin-bottom: 18px;
}
.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}
.login-field label i {
    color: #2D3277;
    margin-right: 5px;
}
.login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.login-field input:focus {
    border-color: #2D3277;
    box-shadow: 0 0 0 3px rgba(45, 50, 119, 0.1);
}
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper input {
    padding-right: 40px; /* Space for the icon */
}
.toggle-password {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    font-size: 18px;
    z-index: 10;
}
.toggle-password:hover {
    color: #2D3277;
}
.login-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #2D3277, #3a42a0);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(45, 50, 119, 0.3);
}
.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
.login-btn.register-btn {
    background: linear-gradient(135deg, #00A650, #00883f);
}
.login-error {
    color: #d32f2f;
    font-size: 13px;
    background: #ffeaea;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #ffcdd2;
}
.login-divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
    border-top: 1px solid #e0e0e0;
}
.login-divider span {
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 13px;
    position: relative;
    top: -10px;
}
.login-toggle {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
}
.login-toggle span {
    cursor: pointer;
}
.login-toggle strong {
    color: #2D3277;
}
.login-toggle span:hover strong {
    text-decoration: underline;
}

:root {
    --bg-main: #EBEBEB; /* Fondo tradicional de e-commerce */
    --brand-color: #FFF159; /* Amarillo */
    --text-dark: #333333;
    --text-light: #666666;
    --text-link: #3483FA; /* Azul links */
    --green-shipping: #00A650; /* Verde envíos / donaciones */
    --card-bg: #FFFFFF;
    --border-color: #EEEEEE;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Proxima Nova";
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-dark);
}

/* === Encabezado === */
.ml-header {
    background-color: var(--brand-color);
    padding: 10px 0;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: #2D3277;
    letter-spacing: -1px;
}

.search-bar {
    display: flex;
    flex-grow: 1;
    max-width: 600px;
    margin: 0 40px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.2);
}

.search-bar input {
    width: 100%;
    border: none;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    border-radius: 2px 0 0 2px;
    color: var(--text-dark);
}

.search-bar button {
    background: transparent;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-light);
    border-left: 1px solid #e6e6e6;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.user-menu img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* === Layout Principal === */
.main-container {
    max-width: 1250px;
    margin: 20px auto;
    display: flex;
    gap: 30px;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* === Sidebar e Interruptores === */
.sidebar {
    width: 250px;
    flex-shrink: 0;
}

/* Acordeones Sidebar */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.accordion-header i {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.accordion-header.active i {
    transform: rotate(90deg);
}

.accordion-content {
    display: none;
    padding-left: 15px;
    margin-top: 10px;
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}

.accordion-content.active {
    display: flex;
}

.filter-box {
    margin-bottom: 20px;
}

.switch-filter {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
}

.switch-info {
    font-size: 14px;
}

.switch-info p {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.full-badge {
    color: var(--green-shipping);
    font-weight: 800;
    font-style: italic;
}

.red-text {
    color: #cc0000;
    font-weight: 600;
    font-style: italic;
}

/* Diseño del Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--text-link);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* --- Listas Laterales --- */
.list-filters h3 {
    font-size: 16px;
    color: var(--text-dark);
    margin: 20px 0 10px 0;
}

.list-filters ul {
    list-style: none;
}

.list-filters li {
    margin-bottom: 8px;
    font-size: 14px;
}

.list-filters a {
    color: var(--text-light);
    text-decoration: none;
}

.list-filters a:hover {
    color: var(--text-link);
}

.count {
    color: #999;
    font-size: 12px;
}

/* === Grilla de Resultados === */
.grid-layout {
    flex-grow: 1;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
    color: var(--text-dark);
}

.sort-by strong {
    color: var(--text-link);
    cursor: pointer;
    font-weight: 600;
    margin-left: 5px;
}

.products-grid {
    display: grid;
    /* Ajuste responsivo fluido de la cuadrícula */
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 15px;
}

/* === Tarjeta de Producto === */
.product-card {
    background-color: var(--card-bg);
    border-radius: 8px; /* Redondeado más moderno */
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.03);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.image-container {
    position: relative;
    width: 100%;
    height: 230px;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: #fff;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-top-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #2D3277;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.product-info {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 300;
    line-height: 1.3;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Truncar a dos líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seller-info {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.seller-info i {
    color: var(--text-link);
    margin-left: 4px;
}

.rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.rating i {
    color: var(--text-link);
    font-size: 11px;
}

.price {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 6px;
}



.shipping {
    font-size: 13px;
    color: var(--green-shipping);
    font-weight: 600;
    margin-top: auto;
}

.shipping .bolt {
    font-style: italic;
    font-weight: 800;
}

/* === Menú Lateral Estilo Amazon === */
.amazon-sidebar-menu {
    background-color: #fff;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    color: #0f1111;
    font-family: Arial, sans-serif;
    border-radius: 4px;
    overflow: hidden;
}

.asm-header {
    background-color: #232f3e;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.asm-header h2 {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
}

.asm-section {
    padding: 15px 0;
}

.asm-section h3 {
    font-size: 16px;
    font-weight: 700;
    padding: 0 20px;
    margin-bottom: 10px;
    color: #111;
}

.asm-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.asm-section li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    color: #111;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
}

.asm-section li a:hover {
    background-color: #eaeded;
}

.asm-section li a i {
    color: #888;
    font-size: 12px;
}

.asm-divider {
    border: 0;
    border-top: 1px solid #d5d9d9;
    margin: 5px 0;
}

/* === Botón Publicar === */
.btn-publicar {
    background-color: transparent;
    color: var(--text-dark);
    border: 1px solid rgba(0,0,0,0.2);
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.2s;
}
.btn-publicar:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Estilos de botones de Auth en Header */
.btn-login-trigger, .btn-register-trigger, .btn-logout, .btn-mis-chats {
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    color: var(--text-dark);
}

.btn-register-trigger {
    background-color: #00A650;
    color: white;
    border: none;
}

.btn-register-trigger:hover {
    background-color: #008f45;
}

.btn-login-trigger:hover, .btn-logout:hover, .btn-mis-chats:hover {
    background-color: rgba(0,0,0,0.05);
}

.btn-mis-chats {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e61d2b;
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 14px;
    text-align: center;
    display: none; /* Se muestra vía JS */
    border: 2px solid var(--brand-color);
}

/* === Modal de Publicación === */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}
.modal.mostrar {
    display: flex;
}
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}
.close-modal:hover {
    color: #333;
}
.publish-form h2 {
    margin-bottom: 20px;
    color: #333;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}
.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: var(--text-link);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s;
}
.btn-submit:hover {
    background-color: #2968c8;
}

/* === Modal de Chat === */
.chat-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 80vh;
    max-height: 600px;
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.chat-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-msg {
    max-width: 80%;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}
.chat-msg.received {
    align-self: flex-start;
    background-color: #EAEAEA;
    color: #333;
}
.chat-msg.sent {
    align-self: flex-end;
    background-color: #DCF8C6; /* Whatsapp green */
    color: #333;
}
.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.chat-input-area input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}
.chat-link {
    color: var(--text-link);
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
}
.chat-link:hover {
    text-decoration: underline;
}

/* Nuevos Botones Header */
.btn-mis-publicaciones {
    background-color: transparent;
    color: var(--text-dark);
    border: 1px solid rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 5px;
    transition: all 0.2s;
}
.btn-mis-publicaciones:hover {
    background-color: rgba(0,0,0,0.05);
}

.btn-mis-chats {
    background-color: transparent;
    color: var(--text-dark);
    border: none;
    font-size: 18px;
    cursor: pointer;
    margin-left: 5px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}
.btn-mis-chats:hover {
    background-color: rgba(0,0,0,0.05);
}
.btn-mis-chats {
    position: relative;
}
.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: badgePulse 0.3s ease-out;
}
@keyframes badgePulse {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.chats-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.chats-empty i {
    font-size: 40px;
    margin-bottom: 15px;
    color: #ccc;
}
.chats-empty p {
    font-size: 14px;
}
.chat-list-item.unread {
    border-left: 3px solid #3483FA;
    background-color: #f0f6ff;
}

/* Modal Lista de Chats */
.chats-list-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.chat-list-item:hover {
    background-color: #f5f5f5;
}
.chat-list-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #333;
}
.chat-list-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

/* Responsividad General */
@media (max-width: 1024px) {
    .main-container {
        gap: 20px;
    }
    .sidebar {
        width: 220px;
    }
}

@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    .logo {
        text-align: center;
        margin-bottom: 5px;
        font-size: 2rem;
    }
    .search-bar {
        margin: 0;
        max-width: 100%;
        width: 100%;
    }
    .user-menu {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }
    .main-container {
        flex-direction: column;
        padding: 10px;
        margin: 10px auto;
    }
    .sidebar {
        width: 100%;
        margin-bottom: 20px;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }
    .image-container {
        height: 180px;
        padding: 10px;
    }
    .product-info {
        padding: 12px;
    }
    .product-title {
        font-size: 13px;
    }
    .price {
        font-size: 20px;
    }
    .login-card {
        padding: 30px 20px;
        width: 95%;
    }
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 20px auto;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .image-container {
        height: 150px;
    }
    .price {
        font-size: 18px;
    }
    .btn-publicar, .btn-mis-publicaciones {
        padding: 8px 10px;
        font-size: 12px;
        margin-left: 2px;
    }
    .header-content {
        padding: 10px;
    }
}

/* ═══ ESTADOS Y MODERACIÓN ═══ */
.badge-status {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 5px;
}

.badge-pendiente {
    background-color: #FFF3E0;
    color: #EF6C00;
    border: 1px solid #FFE0B2;
}

.badge-aprobado {
    background-color: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.badge-rechazado {
    background-color: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

/* Panel Admin */
.btn-admin-panel {
    background-color: #2D3277;
    color: white !important;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: none; /* Se muestra vía JS */
}

.btn-admin-panel:hover {
    background-color: #1a1e4d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.admin-list {
    list-style: none;
    padding: 0;
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.admin-item:hover {
    background-color: #f9f9f9;
}

.admin-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.admin-item-info {
    flex-grow: 1;
}

.admin-item-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #333;
}

.admin-item-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.btn-approve {
    background-color: #00A650;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-reject {
    background-color: #E61D2B;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-approve:hover { background-color: #008f45; }
.btn-reject:hover { background-color: #c41824; }

/* Motivo Rechazo */
.rechazo-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rechazo-container textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}
