/* =========================================
   VARIABLES GLOBALES (Estilo iOS)
   ========================================= */
:root {
    --ios-bg: #F2F2F7;
    --ios-card-bg: #FFFFFF;
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-text: #1C1C1E;
    --ios-gray: #8E8E93;
    --ios-red: #FF3B30;
}

    .avatar-icon {
      width: 60px;
      height: 60px;
      margin-top: 10px;
      --avatar-color: #999999; /* Color principal (gris) */
      --avatar-bg: #ffffff;    /* Color del recorte (debe coincidir con el fondo de tu web) */
      color: #007bff;; /* Cambia este color por el que quieras */
      transition: color 0.3s ease;
    }

/* =========================================
   RESETEO BÁSICO Y TIPOGRAFÍA
   ========================================= */
/* Aplicar box-sizing globalmente para evitar problemas de espaciado */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--ios-bg);
    color: var(--ios-text);
    margin: 0;
    padding: 16px;
}

/* =========================================
   COMPONENTES UI BASE (Tarjetas, Formularios, Botones)
   ========================================= */
.ios-card {
    background-color: var(--ios-card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    margin: 20px auto;
}

/* Campos de texto */
.ios-input, 
.ios-textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    /* Borde transparente por defecto para evitar saltos de layout al hacer focus */
    border: 1px solid transparent; 
    background-color: #F2F2F7;
    border-radius: 12px;
    font-size: 16px;
    color: var(--ios-text);
    transition: border-color 0.2s ease;
}

.ios-textarea {
    height: 100px;
    resize: none;
}

/* Botón principal */
.ios-button {
    width: 100%;
    background-color: var(--ios-blue);
    color: white;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.ios-button:hover { 
    background-color: #0062CC; /* Feedback visual en escritorio */
}

.ios-button:active { 
    opacity: 0.7; 
}

.ios-link-danger {
    color: var(--ios-red);
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
    font-size: 14px;
}

/* =========================================
   ESTRUCTURA Y CABECERAS
   ========================================= */
/* Contenedor principal (Eliminada la clase duplicada) */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px;
}

/* Cabecera principal ClasiPress */
.main-header {
    margin: 20px 0 10px 0;
}

.main-header h1 {
    font-size: 34px;
    font-weight: 800;
    margin: 0 0 4px 0;
    letter-spacing: -1px;
}

.main-header p {
    color: var(--ios-gray);
    margin: 0;
    font-size: 16px;
}

/* Miga de pan / Breadcrumbs */
.breadcrumbs {
    font-size: 14px;
    color: var(--ios-gray);
    margin-bottom: 15px;
}

.breadcrumbs a { 
    color: var(--ios-blue); 
    text-decoration: none; 
}

/* =========================================
   MENÚ DESPLEGABLE (Select Estilo iOS)
   ========================================= */
.select-container {
    margin: 15px 0 25px 0;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.ios-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 1px solid #E5E5EA;
    background-color: var(--ios-card-bg);
    color: var(--ios-text);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    
    /* Resetear flecha nativa */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Icono SVG personalizado */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238E8E93' d='M0,0 L5,5 L10,0 Z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
}

/* Estados de foco unificados para inputs, textareas y selects */
.ios-input:focus, 
.ios-textarea:focus, 
.ios-select:focus {
    border-color: var(--ios-blue);
    outline: none;
}

/* =========================================
   GRILLA Y TARJETAS DE ANUNCIOS (Listings)
   ========================================= */
.grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 15px; 
}

.listing-card {
    background: var(--ios-card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid #E5E5EA;
    transition: transform 0.2s, box-shadow 0.2s;
}

.listing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.listing-card:active { 
    transform: scale(0.98); 
}

/* Imagen de la tarjeta */
.listing-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #1C1C1E;
    overflow: hidden;
    position: relative;
}

.listing-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-thumb .no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--ios-gray);
    font-size: 14px;
    background: #E5E5EA;
}

/* Contenido de la tarjeta */
.listing-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.listing-cat {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ios-gray);
    font-weight: 700;
    margin-bottom: 6px;
}

.listing-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    color: var(--ios-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 42px;
}

/* Pie de la tarjeta */
.listing-footer {
    border-top: 1px solid #F2F2F7;
    padding-top: 12px;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.listing-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--ios-blue);
}

.listing-date {
    font-size: 11px;
    color: var(--ios-gray);
    font-weight: 500;
}

/* Estado sin resultados */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--ios-card-bg);
    border-radius: 16px;
    color: var(--ios-gray);
}

/* =========================================
   PÁGINA DE DETALLE (Layout de Anuncio)
   ========================================= */
/* Layout a dos columnas en escritorio */
.layout-anuncio {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .layout-anuncio {
        grid-template-columns: 2fr 1fr;
    }
}

/* Columna Principal */
.main-content { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

/* Galería Interactiva */
.anuncio-gallery {
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.main-image-wrapper {
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1C1C1E;
}

.main-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease-in-out;
}

.thumbnail-grid {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--ios-card-bg);
    overflow-x: auto;
    border-top: 1px solid #E5E5EA;
}

.thumb-btn {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s;
    flex-shrink: 0;
}

.thumb-btn.active, 
.thumb-btn:hover {
    border-color: var(--ios-blue);
    opacity: 1;
}

/* Bloques de Información y Ficha Técnica */
.block-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #F2F2F7;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.specs-table tr {
    border-bottom: 1px solid #F2F2F7;
}

.specs-table td {
    padding: 10px 0;
    font-size: 15px;
}

.specs-table td.label {
    color: var(--ios-gray);
    font-weight: 500;
    width: 40%;
}

.specs-table td.value {
    font-weight: 600;
    text-align: right;
}

/* =========================================
   BARRA LATERAL (Sidebar)
   ========================================= */
.sidebar { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

.price-box {
    background: #FFD517;
    color: #1C1C1E;;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.2);
}

.price-box .amount { 
    font-size: 32px; 
    font-weight: 800; 
}

.price-box .label { 
    font-size: 12px; 
    opacity: 0.8; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.seller-card {
    text-align: center;
}

.avatar {
    width: 60px;
    height: 60px;
    background: #E5E5EA;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 10px auto;
}