/**
 * MIATA.SPACE - Material Design 3 Components
 * ============================================
 * Componentes específicos de la aplicación
 */

/* ====================================
   SECTION HEADERS
   ==================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--md-sys-spacing-lg);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface);
}

.section-title .icon {
    color: var(--md-sys-color-primary);
}

/* ====================================
   EVENTO CARD
   ==================================== */
.evento-card {
    position: relative;
}

.evento-card .card-image {
    height: 180px;
    position: relative;
}

.evento-date {
    position: absolute;
    top: var(--md-sys-spacing-md);
    left: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    border-radius: var(--md-sys-shape-corner-small);
    text-align: center;
    box-shadow: var(--md-sys-elevation-2);
}

.evento-date-day {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    line-height: 1;
}

.evento-date-month {
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.5px;
}

.evento-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-md);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-md);
}

.evento-meta-item {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
}

.evento-meta-item .icon {
    width: 18px;
    height: 18px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ====================================
   PRODUCTO CARD
   ==================================== */
.producto-card {
    position: relative;
}

.producto-card .card-image {
    height: 200px;
    position: relative;
}

.producto-badges {
    position: absolute;
    top: var(--md-sys-spacing-sm);
    left: var(--md-sys-spacing-sm);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-xs);
}

.producto-precio {
    display: flex;
    align-items: baseline;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-sm);
}

.producto-precio .price {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.producto-estado {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-md);
}

.producto-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-xs);
}

.producto-seller {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    padding-top: var(--md-sys-spacing-md);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin-top: var(--md-sys-spacing-md);
}

.producto-seller .icon {
    color: var(--md-sys-color-on-surface-variant);
}

/* ====================================
   PÁGINA DE DETALLE
   ==================================== */
.detalle-header {
    margin-bottom: var(--md-sys-spacing-xl);
}

.detalle-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--md-sys-spacing-sm);
}

.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--md-sys-spacing-xl);
}

@media (max-width: 1024px) {
    .detalle-grid {
        grid-template-columns: 1fr;
    }
}

.detalle-galeria {
    position: relative;
}

.galeria-principal {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--md-sys-shape-corner-medium);
    margin-bottom: var(--md-sys-spacing-md);
}

.galeria-thumbs {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    overflow-x: auto;
    padding-bottom: var(--md-sys-spacing-sm);
}

.galeria-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    opacity: 0.6;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
    border: 2px solid transparent;
}

.galeria-thumb:hover {
    opacity: 1;
}

.galeria-thumb.active {
    opacity: 1;
    border-color: var(--md-sys-color-primary);
}

.detalle-sidebar {
    position: sticky;
    top: 88px;
}

.sidebar-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: var(--md-sys-spacing-lg);
    box-shadow: var(--md-sys-elevation-1);
    margin-bottom: var(--md-sys-spacing-md);
}

.sidebar-card h3 {
    font-size: 1rem;
    margin-bottom: var(--md-sys-spacing-md);
}

/* Vendedor info */
.vendedor-info {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    margin-bottom: var(--md-sys-spacing-lg);
}

.vendedor-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--md-sys-shape-corner-full);
    background-color: var(--md-sys-color-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vendedor-avatar .icon {
    color: var(--md-sys-color-on-primary-container);
}

.vendedor-datos h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.vendedor-datos span {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* ====================================
   SUBASTA
   ==================================== */
.subasta-info {
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-small);
    padding: var(--md-sys-spacing-md);
    margin-bottom: var(--md-sys-spacing-lg);
}

.subasta-tiempo {
    display: flex;
    justify-content: center;
    gap: var(--md-sys-spacing-lg);
    text-align: center;
    margin-bottom: var(--md-sys-spacing-md);
}

.tiempo-item {
    display: flex;
    flex-direction: column;
}

.tiempo-numero {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
}

.tiempo-label {
    font-size: 0.6875rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.puja-actual {
    text-align: center;
    padding: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-small);
}

.puja-actual .price {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.puja-form {
    display: flex;
    gap: var(--md-sys-spacing-sm);
}

.puja-form input {
    flex: 1;
}

/* ====================================
   PERFIL
   ==================================== */
.perfil-header {
    background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, #1557b0 100%);
    color: var(--md-sys-color-on-primary);
    padding: var(--md-sys-spacing-3xl) 0;
}

.perfil-info {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xl);
}

@media (max-width: 600px) {
    .perfil-info {
        flex-direction: column;
        text-align: center;
    }
}

.perfil-avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--md-sys-shape-corner-full);
    border: 4px solid var(--md-sys-color-on-primary);
    object-fit: cover;
    background-color: var(--md-sys-color-surface);
}

.perfil-nombre {
    font-size: 1.75rem;
    margin-bottom: var(--md-sys-spacing-xs);
}

.perfil-username {
    opacity: 0.8;
    font-size: 1rem;
}

.perfil-bio {
    margin-top: var(--md-sys-spacing-md);
    max-width: 500px;
    opacity: 0.9;
}

.perfil-meta {
    display: flex;
    gap: var(--md-sys-spacing-xl);
    margin-top: var(--md-sys-spacing-lg);
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .perfil-meta {
        justify-content: center;
    }
}

.perfil-meta-item {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    opacity: 0.9;
}

.perfil-meta-item .icon {
    width: 18px;
    height: 18px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: var(--md-sys-spacing-xl);
    overflow-x: auto;
}

.tab {
    padding: var(--md-sys-spacing-md) var(--md-sys-spacing-lg);
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    position: relative;
    transition: color var(--md-sys-motion-duration-short);
    white-space: nowrap;
}

.tab:hover {
    color: var(--md-sys-color-primary);
}

.tab.active {
    color: var(--md-sys-color-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ====================================
   FORMULARIOS DE CREACIÓN - Mejorados
   ==================================== */

/* Page container */
.form-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--md-sys-spacing-xl) var(--md-sys-spacing-md);
}

.form-page h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--md-sys-spacing-md);
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--md-sys-spacing-xl);
    color: var(--md-sys-color-on-surface);
}

.form-page h1 .icon {
    width: 36px;
    height: 36px;
    color: var(--md-sys-color-primary);
}

/* Hero header decorativo para formularios con wallpaper */
.form-hero {
    position: relative;
    margin: calc(-1 * var(--md-sys-spacing-xl)) calc(-1 * var(--md-sys-spacing-md)) var(--md-sys-spacing-2xl);
    padding: var(--md-sys-spacing-3xl) var(--md-sys-spacing-xl);
    background-color: var(--md-sys-color-primary-container);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 0 0 var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large);
    text-align: center;
    overflow: hidden;
}

/* Overlay oscuro para legibilidad del texto */
.form-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.65) 0%, 
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.65) 100%);
}

.form-hero-icon {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--md-sys-spacing-lg);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-sys-elevation-3);
}

.form-hero-icon .icon {
    width: 40px;
    height: 40px;
    color: var(--md-sys-color-primary);
}

.form-hero h1 {
    position: relative;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 var(--md-sys-spacing-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.form-hero p {
    position: relative;
    color: rgba(255, 255, 255, 0.9);
    max-width: 400px;
    margin: 0 auto;
    font-size: 0.9375rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Header decorativo */
.form-header {
    text-align: center;
    margin-bottom: var(--md-sys-spacing-2xl);
}

.form-header-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--md-sys-spacing-md);
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));
    border-radius: var(--md-sys-shape-corner-large);
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-header-icon .icon {
    width: 36px;
    height: 36px;
    color: var(--md-sys-color-on-primary-container);
}

.form-header h1 {
    margin-bottom: var(--md-sys-spacing-sm);
}

.form-header p {
    color: var(--md-sys-color-on-surface-variant);
    max-width: 500px;
    margin: 0 auto;
}

/* Card principal */
.form-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: var(--md-sys-spacing-2xl);
    box-shadow: var(--md-sys-elevation-2);
    border: 1px solid var(--md-sys-color-outline-variant);
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--md-sys-color-primary) 0%, 
        var(--md-sys-color-tertiary) 50%,
        var(--md-sys-color-secondary) 100%);
}

/* Secciones del formulario */
.form-section {
    margin-bottom: var(--md-sys-spacing-2xl);
    padding-bottom: var(--md-sys-spacing-xl);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: relative;
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section h3 {
    display: inline-flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--md-sys-spacing-lg);
    color: var(--md-sys-color-on-surface);
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-md);
    background: var(--md-sys-color-primary-container);
    border-radius: var(--md-sys-shape-corner-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-section h3 .icon {
    color: var(--md-sys-color-on-primary-container);
    width: 16px;
    height: 16px;
}

/* Rows y grid */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--md-sys-spacing-md);
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--md-sys-spacing-md);
}

@media (max-width: 600px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    
    .form-card {
        padding: var(--md-sys-spacing-lg);
        border-radius: var(--md-sys-shape-corner-large);
    }
    
    .form-page h1 {
        font-size: 1.5rem;
    }
    
    .form-hero {
        margin: calc(-1 * var(--md-sys-spacing-xl)) calc(-1 * var(--md-sys-spacing-md)) var(--md-sys-spacing-xl);
        padding: var(--md-sys-spacing-2xl) var(--md-sys-spacing-md);
    }
    
    .form-hero h1 {
        font-size: 1.5rem;
    }
    
    .form-hero-icon {
        width: 64px;
        height: 64px;
    }
    
    .form-hero-icon .icon {
        width: 32px;
        height: 32px;
    }
}

/* Mapa en formularios */
.form-map {
    height: 280px;
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--md-sys-color-outline-variant);
    overflow: hidden;
    margin-top: var(--md-sys-spacing-sm);
}

.map-search-container {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-sm);
}

.map-search-container .form-input {
    flex: 1;
    min-height: 44px;
}

.map-search-container .btn {
    flex-shrink: 0;
}

/* Upload de imágenes - Mejorado */
.upload-area {
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-2xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-medium) ease;
    background: var(--md-sys-color-surface-container-low);
}

.upload-area:hover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.upload-area.dragover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-sys-elevation-1);
}

.upload-icon .icon {
    width: 32px;
    height: 32px;
    color: var(--md-sys-color-primary);
}

.upload-text {
    color: var(--md-sys-color-on-surface-variant);
}

.upload-text strong {
    display: block;
    font-size: 1rem;
    color: var(--md-sys-color-primary);
    margin-bottom: var(--md-sys-spacing-xs);
}

.upload-hint {
    font-size: 0.8125rem;
    margin-top: var(--md-sys-spacing-xs);
}

/* Preview de imágenes */
.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--md-sys-spacing-md);
    margin-top: var(--md-sys-spacing-md);
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.preview-item:hover .preview-remove {
    opacity: 1;
}

.preview-remove .icon {
    width: 16px;
    height: 16px;
}

.preview-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 0.625rem;
    text-transform: uppercase;
    text-align: center;
    padding: var(--md-sys-spacing-md) var(--md-sys-spacing-xs) var(--md-sys-spacing-xs);
    letter-spacing: 0.5px;
}

.preview-item.uploading::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.preview-item.uploaded::after {
    content: '✓';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--md-sys-color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.preview-item.upload-error::after {
    content: '✗';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--md-sys-color-error);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.preview-item.upload-error {
    border-color: var(--md-sys-color-error);
}

/* Form actions - Mejorado */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    margin-top: var(--md-sys-spacing-2xl);
    padding-top: var(--md-sys-spacing-xl);
    background: var(--md-sys-color-surface-container-lowest);
    margin-left: calc(-1 * var(--md-sys-spacing-2xl));
    margin-right: calc(-1 * var(--md-sys-spacing-2xl));
    margin-bottom: calc(-1 * var(--md-sys-spacing-2xl));
    padding: var(--md-sys-spacing-xl) var(--md-sys-spacing-2xl);
    border-radius: 0 0 var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.form-actions .btn-primary {
    min-width: 160px;
    padding-left: var(--md-sys-spacing-xl);
    padding-right: var(--md-sys-spacing-xl);
}

@media (max-width: 600px) {
    .form-actions {
        flex-direction: column-reverse;
        margin-left: calc(-1 * var(--md-sys-spacing-lg));
        margin-right: calc(-1 * var(--md-sys-spacing-lg));
        margin-bottom: calc(-1 * var(--md-sys-spacing-lg));
        padding: var(--md-sys-spacing-lg);
        border-radius: 0 0 var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large);
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Checkbox label - Mejorado */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    padding: var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-small);
    transition: background 0.15s ease;
}

.checkbox-label:hover {
    background: var(--md-sys-color-surface-container-low);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--md-sys-color-primary);
    cursor: pointer;
}

/* Input improvements */
.form-group .form-input,
.form-group .form-select,
.form-group .form-textarea {
    min-height: 48px;
    font-size: 0.9375rem;
}

.form-group .form-textarea {
    min-height: 120px;
}

.form-group .form-hint {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    margin-top: var(--md-sys-spacing-xs);
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.form-group .form-hint .icon {
    width: 14px;
    height: 14px;
}

/* Utilidades de spacing para hints */
.mb-sm {
    margin-bottom: var(--md-sys-spacing-sm);
}

/* Select con iconos */
.select-icon-wrapper {
    position: relative;
}

.select-icon-wrapper .form-select {
    padding-left: 44px;
}

.select-icon-wrapper .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

/* ====================================
   MAPA EN FORMULARIOS
   ==================================== */
.form-map {
    width: 100%;
    height: 300px;
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--md-sys-color-outline);
    overflow: hidden;
    margin-top: var(--md-sys-spacing-sm);
}

.map-search-container {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-sm);
}

.map-search-container .form-input {
    flex: 1;
}

.map-search-container .btn {
    flex-shrink: 0;
}

/* Loading icon animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.icon-loading {
    animation: spin 1s linear infinite;
}

/* ====================================
   FILTROS MARKETPLACE
   ==================================== */
.filtros-bar {
    background: var(--md-sys-color-surface);
    padding: var(--md-sys-spacing-lg);
    border-radius: var(--md-sys-shape-corner-large);
    margin-bottom: var(--md-sys-spacing-lg);
    display: flex;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-lg);
    align-items: stretch;
    box-shadow: var(--md-sys-elevation-1);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.filtros-bar .search-field {
    flex: 1;
    min-width: 250px;
    background: var(--md-sys-color-surface-container-low);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.filtros-bar .search-field:focus-within {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filtros-bar .search-field input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 0.9375rem;
    color: var(--md-sys-color-on-surface);
}

.filtros-bar .search-field input:focus {
    outline: none;
}

.filtros-bar .search-field .icon {
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filtro-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filtro-group label .icon {
    width: 14px;
    height: 14px;
}

.filtro-group select {
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    padding-right: var(--md-sys-spacing-xl);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface-container-low);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 140px;
}

.filtro-group select:hover {
    border-color: var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
}

.filtro-group select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Checkbox mejorado */
.filtro-group label:has(input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    cursor: pointer;
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container-low);
    border-radius: var(--md-sys-shape-corner-small);
    border: 1px solid var(--md-sys-color-outline-variant);
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filtro-group label:has(input[type="checkbox"]):hover {
    background: var(--md-sys-color-surface);
    border-color: var(--md-sys-color-outline);
}

.filtro-group label:has(input[type="checkbox"]:checked) {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
}

.filtro-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--md-sys-color-primary);
    cursor: pointer;
}

/* Filtros responsive */
@media (max-width: 768px) {
    .filtros-bar {
        padding: var(--md-sys-spacing-md);
        gap: var(--md-sys-spacing-md);
        flex-direction: column;
        align-items: stretch;
    }
    
    .filtros-bar .search-field {
        min-width: 100%;
    }
    
    .filtros-bar-selects {
        display: flex;
        gap: var(--md-sys-spacing-sm);
        flex-wrap: wrap;
    }
    
    .filtro-group {
        flex: 1;
        min-width: calc(50% - var(--md-sys-spacing-sm));
    }
    
    .filtro-group select {
        width: 100%;
        min-width: unset;
    }
    
    .filtro-group label:has(input[type="checkbox"]) {
        justify-content: center;
    }
}

/* ====================================
   MAPA
   ==================================== */
.mapa-container {
    width: 100%;
    height: 300px;
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
    margin-bottom: var(--md-sys-spacing-md);
}

.mapa-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ====================================
   AUTH PAGES
   ==================================== */
.auth-page {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--md-sys-spacing-xl);
    background: var(--md-sys-color-surface-container);
}

.auth-card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-xl);
    box-shadow: var(--md-sys-elevation-2);
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--md-sys-spacing-xl);
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: var(--md-sys-spacing-sm);
}

.auth-header p {
    color: var(--md-sys-color-on-surface-variant);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--md-sys-spacing-lg) 0;
    color: var(--md-sys-color-on-surface-variant);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
}

.auth-divider span {
    padding: 0 var(--md-sys-spacing-md);
    font-size: 0.75rem;
}

.auth-footer {
    text-align: center;
    margin-top: var(--md-sys-spacing-lg);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* ====================================
   PAGINACIÓN
   ==================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    margin-top: var(--md-sys-spacing-xl);
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--md-sys-spacing-md);
    border: none;
    background: transparent;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--md-sys-color-surface-container-high);
}

.pagination-btn.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.pagination-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* ====================================
   BREADCRUMBS
   ==================================== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-sm) 0;
    margin-bottom: var(--md-sys-spacing-md);
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    color: var(--md-sys-color-primary);
    text-decoration: none;
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-small);
    -webkit-tap-highlight-color: transparent;
}

.breadcrumb-item:hover {
    background: var(--md-sys-color-surface-container);
    text-decoration: none;
}

.breadcrumb-item.current {
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    cursor: default;
}

.breadcrumb-item.current:hover {
    background: transparent;
}

.breadcrumb-separator {
    color: var(--md-sys-color-outline);
    display: flex;
    align-items: center;
}

.breadcrumb-separator .icon {
    width: 16px;
    height: 16px;
}

/* ====================================
   CATEGORÍAS MARKETPLACE - Minimalista
   ==================================== */
.categorias-section {
    margin-bottom: var(--md-sys-spacing-xl);
}

.categorias-grid {
    display: none; /* Oculto en desktop, se usa el select */
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-lg);
}

/* Card de categoría - Diseño tipo chip/tag */
.categoria-card {
    display: inline-flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.categoria-card:hover {
    border-color: var(--cat-color, var(--md-sys-color-primary));
    background: var(--md-sys-color-surface-container);
}

/* Colores por categoría - Tonos suaves */
.categoria-card[data-cat-color="motor"] { --cat-color: #ef4444; --cat-bg: #fef2f2; }
.categoria-card[data-cat-color="transmision"] { --cat-color: #a855f7; --cat-bg: #faf5ff; }
.categoria-card[data-cat-color="suspension"] { --cat-color: #3b82f6; --cat-bg: #eff6ff; }
.categoria-card[data-cat-color="frenos"] { --cat-color: #ec4899; --cat-bg: #fdf2f8; }
.categoria-card[data-cat-color="interior"] { --cat-color: #14b8a6; --cat-bg: #f0fdfa; }
.categoria-card[data-cat-color="exterior"] { --cat-color: #06b6d4; --cat-bg: #ecfeff; }
.categoria-card[data-cat-color="electrico"] { --cat-color: #f59e0b; --cat-bg: #fffbeb; }
.categoria-card[data-cat-color="ruedas"] { --cat-color: #64748b; --cat-bg: #f8fafc; }
.categoria-card[data-cat-color="escape"] { --cat-color: #78716c; --cat-bg: #fafaf9; }
.categoria-card[data-cat-color="accesorios"] { --cat-color: #22c55e; --cat-bg: #f0fdf4; }
.categoria-card[data-cat-color="coche"] { --cat-color: #4f46e5; --cat-bg: #eef2ff; }
.categoria-card[data-cat-color="capota"] { --cat-color: #8b5cf6; --cat-bg: #f5f3ff; }
.categoria-card[data-cat-color="otros"] { --cat-color: #6b7280; --cat-bg: #f9fafb; }

.categoria-header {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
}

.categoria-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cat-bg, var(--md-sys-color-surface-container));
    border-radius: var(--md-sys-shape-corner-small);
    flex-shrink: 0;
}

.categoria-icon .icon {
    width: 18px;
    height: 18px;
    color: var(--cat-color, var(--md-sys-color-primary));
}

.categoria-info {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
}

.categoria-nombre {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
}

.categoria-count {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.icon-expand {
    color: var(--md-sys-color-on-surface-variant);
    margin-left: auto;
    transition: transform 0.15s ease;
}

.categoria-header.expanded .icon-expand {
    transform: rotate(180deg);
}

/* Subcategorías - Popup o dropdown */
.categoria-card .subcategories-container {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    margin-top: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-sm);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-3);
    z-index: 100;
}

.categoria-card {
    position: relative;
}

.categoria-card .subcategories-container.visible {
    display: block;
}

.subcategory-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subcategory-chip {
    display: block;
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    transition: background 0.1s ease;
}

.subcategory-chip:hover {
    background: var(--md-sys-color-surface-container-high);
}

.subcategory-chip.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Responsive */
@media (max-width: 600px) {
    .categorias-grid {
        gap: var(--md-sys-spacing-xs);
        /* También oculto en móvil, se usa el drawer */
        display: none;
    }
    
    .categoria-card {
        padding: 6px var(--md-sys-spacing-sm);
    }
    
    .categoria-icon {
        width: 26px;
        height: 26px;
    }
    
    .categoria-icon .icon {
        width: 14px;
        height: 14px;
    }
    
    .categoria-nombre {
        font-size: 0.8125rem;
    }
    
    .categoria-count {
        display: none;
    }
}

/* ====================================
   CATEGORÍAS DRAWER (Móvil)
   ==================================== */
.fab-categorias {
    display: none;
}

.categorias-drawer-overlay {
    display: none;
}

.categorias-drawer {
    display: none;
}

@media (max-width: 600px) {
    /* Botón flotante de categorías */
    .fab-categorias {
        display: flex;
        align-items: center;
        gap: var(--md-sys-spacing-sm);
        position: fixed;
        bottom: 80px;
        left: var(--md-sys-spacing-md);
        padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
        background: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
        border: none;
        border-radius: var(--md-sys-shape-corner-full);
        box-shadow: var(--md-sys-elevation-3);
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        z-index: 90;
        -webkit-tap-highlight-color: transparent;
    }
    
    .fab-categorias .icon {
        width: 20px;
        height: 20px;
    }
    
    /* Overlay */
    .categorias-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        z-index: 999;
    }
    
    .categorias-drawer-overlay.visible {
        opacity: 1;
        visibility: visible;
    }
    
    /* Drawer lateral */
    .categorias-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--md-sys-color-surface);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1000;
        box-shadow: var(--md-sys-elevation-4);
    }
    
    .categorias-drawer.open {
        transform: translateX(0);
    }
    
    .drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--md-sys-spacing-md);
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }
    
    .drawer-header h3 {
        display: flex;
        align-items: center;
        gap: var(--md-sys-spacing-sm);
        font-size: 1rem;
        font-weight: 500;
        margin: 0;
    }
    
    .drawer-content {
        flex: 1;
        overflow-y: auto;
        padding: var(--md-sys-spacing-sm) 0;
    }
    
    /* Items del drawer */
    .drawer-cat-item {
        display: flex;
        align-items: center;
        gap: var(--md-sys-spacing-md);
        padding: var(--md-sys-spacing-md) var(--md-sys-spacing-lg);
        color: var(--md-sys-color-on-surface);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .drawer-cat-item:active {
        background: var(--md-sys-color-surface-container);
    }
    
    .drawer-cat-item.active {
        background: var(--md-sys-color-primary-container);
        color: var(--md-sys-color-on-primary-container);
    }
    
    .drawer-cat-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--cat-color, var(--md-sys-color-on-surface-variant));
    }
    
    .drawer-cat-icon .icon {
        width: 20px;
        height: 20px;
    }
    
    /* Colores de iconos en drawer */
    .drawer-cat-item[data-cat-color="motor"] { --cat-color: #ef4444; }
    .drawer-cat-item[data-cat-color="transmision"] { --cat-color: #a855f7; }
    .drawer-cat-item[data-cat-color="suspension"] { --cat-color: #3b82f6; }
    .drawer-cat-item[data-cat-color="frenos"] { --cat-color: #ec4899; }
    .drawer-cat-item[data-cat-color="interior"] { --cat-color: #14b8a6; }
    .drawer-cat-item[data-cat-color="exterior"] { --cat-color: #06b6d4; }
    .drawer-cat-item[data-cat-color="electrico"] { --cat-color: #f59e0b; }
    .drawer-cat-item[data-cat-color="ruedas"] { --cat-color: #64748b; }
    .drawer-cat-item[data-cat-color="escape"] { --cat-color: #78716c; }
    .drawer-cat-item[data-cat-color="accesorios"] { --cat-color: #22c55e; }
    .drawer-cat-item[data-cat-color="coche"] { --cat-color: #4f46e5; }
    .drawer-cat-item[data-cat-color="capota"] { --cat-color: #8b5cf6; }
    .drawer-cat-item[data-cat-color="otros"] { --cat-color: #6b7280; }
    
    .drawer-cat-name {
        flex: 1;
        font-size: 0.9375rem;
    }
    
    .drawer-cat-expand {
        color: var(--md-sys-color-on-surface-variant);
        transition: transform 0.15s ease;
    }
    
    .drawer-cat-item.expanded .drawer-cat-expand {
        transform: rotate(180deg);
    }
    
    /* Subcategorías en drawer */
    .drawer-subcats {
        display: none;
        background: var(--md-sys-color-surface-container);
    }
    
    .drawer-subcats.visible {
        display: block;
    }
    
    .drawer-cat-item.subcat {
        padding-left: calc(var(--md-sys-spacing-lg) + 24px + var(--md-sys-spacing-md));
        font-size: 0.875rem;
        color: var(--md-sys-color-on-surface-variant);
    }
    
    .drawer-cat-item.subcat:active,
    .drawer-cat-item.subcat.active {
        color: var(--md-sys-color-on-surface);
    }
}

/* ====================================
   CUSTOM SELECT - Selector personalizado
   ==================================== */
.custom-select {
    position: relative;
    min-width: 180px;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-width: 140px;
    transition: all 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.custom-select-trigger .icon-expand {
    transition: transform 0.15s ease;
    color: var(--md-sys-color-on-surface-variant);
}

.custom-select.open .custom-select-trigger .icon-expand {
    transform: rotate(180deg);
}

.custom-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-3);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.custom-select-option:hover {
    background: var(--md-sys-color-surface-container);
}

.custom-select-option.selected {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.custom-select-option.parent {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
}

/* Colores de texto en opciones del selector */
.custom-select-option[data-cat-color="motor"] { color: #ef4444; }
.custom-select-option[data-cat-color="transmision"] { color: #a855f7; }
.custom-select-option[data-cat-color="suspension"] { color: #3b82f6; }
.custom-select-option[data-cat-color="frenos"] { color: #ec4899; }
.custom-select-option[data-cat-color="interior"] { color: #14b8a6; }
.custom-select-option[data-cat-color="exterior"] { color: #06b6d4; }
.custom-select-option[data-cat-color="electrico"] { color: #f59e0b; }
.custom-select-option[data-cat-color="ruedas"] { color: #64748b; }
.custom-select-option[data-cat-color="escape"] { color: #78716c; }
.custom-select-option[data-cat-color="accesorios"] { color: #22c55e; }
.custom-select-option[data-cat-color="coche"] { color: #4f46e5; }
.custom-select-option[data-cat-color="capota"] { color: #8b5cf6; }
.custom-select-option[data-cat-color="otros"] { color: #6b7280; }

.custom-select-option .option-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--md-sys-shape-corner-small);
    flex-shrink: 0;
}

.custom-select-option .option-icon .icon {
    width: 14px;
    height: 14px;
}

/* Colores de iconos en select */
.option-icon[data-cat-color="motor"] { background: #fef2f2; color: #ef4444; }
.option-icon[data-cat-color="transmision"] { background: #faf5ff; color: #a855f7; }
.option-icon[data-cat-color="suspension"] { background: #eff6ff; color: #3b82f6; }
.option-icon[data-cat-color="frenos"] { background: #fdf2f8; color: #ec4899; }
.option-icon[data-cat-color="interior"] { background: #f0fdfa; color: #14b8a6; }
.option-icon[data-cat-color="exterior"] { background: #ecfeff; color: #06b6d4; }
.option-icon[data-cat-color="electrico"] { background: #fffbeb; color: #f59e0b; }
.option-icon[data-cat-color="ruedas"] { background: #f8fafc; color: #64748b; }
.option-icon[data-cat-color="escape"] { background: #fafaf9; color: #78716c; }
.option-icon[data-cat-color="accesorios"] { background: #f0fdf4; color: #22c55e; }
.option-icon[data-cat-color="coche"] { background: #eef2ff; color: #4f46e5; }
.option-icon[data-cat-color="capota"] { background: #f5f3ff; color: #8b5cf6; }
.option-icon[data-cat-color="otros"] { background: #f9fafb; color: #6b7280; }

/* Subcategorías colapsables */
.custom-select-subcats {
    display: none;
    padding-left: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container);
}

.custom-select-subcats.visible {
    display: block;
}

.custom-select-subcats .custom-select-option {
    padding-left: var(--md-sys-spacing-lg);
    font-size: 0.8125rem;
    /* Color heredado del data-cat-color, con fallback */
}

.custom-select-subcats .custom-select-option:hover {
    filter: brightness(1.1);
}

/* Color dot en el trigger del select */
.select-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.select-color-dot[data-cat-color="motor"] { background: #ef4444; }
.select-color-dot[data-cat-color="transmision"] { background: #a855f7; }
.select-color-dot[data-cat-color="suspension"] { background: #3b82f6; }
.select-color-dot[data-cat-color="frenos"] { background: #ec4899; }
.select-color-dot[data-cat-color="interior"] { background: #14b8a6; }
.select-color-dot[data-cat-color="exterior"] { background: #06b6d4; }
.select-color-dot[data-cat-color="electrico"] { background: #f59e0b; }
.select-color-dot[data-cat-color="ruedas"] { background: #64748b; }
.select-color-dot[data-cat-color="escape"] { background: #78716c; }
.select-color-dot[data-cat-color="accesorios"] { background: #22c55e; }
.select-color-dot[data-cat-color="coche"] { background: #4f46e5; }
.select-color-dot[data-cat-color="capota"] { background: #8b5cf6; }
.select-color-dot[data-cat-color="otros"] { background: #6b7280; }

/* ====================================
   COMENTARIOS - ESTILO REDDIT
   ==================================== */
.comments-section {
    margin-top: var(--md-sys-spacing-xl);
    padding-top: var(--md-sys-spacing-xl);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    overflow-x: auto;
    max-width: 100%;
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--md-sys-spacing-lg);
}

.comments-header h3 {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    font-size: 1rem;
}

.comments-count {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Formulario de comentario */
.comment-form {
    display: flex;
    gap: var(--md-sys-spacing-md);
    margin-bottom: var(--md-sys-spacing-xl);
}

.comment-form-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-form-avatar .icon {
    color: var(--md-sys-color-on-primary-container);
}

.comment-form-input {
    flex: 1;
}

.comment-form-input textarea {
    width: 100%;
    min-height: 80px;
    padding: var(--md-sys-spacing-md);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

.comment-form-input textarea:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--md-sys-spacing-sm);
    margin-top: var(--md-sys-spacing-sm);
}

/* Lista de comentarios */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-md);
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
}

.comment {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    max-width: 100%;
    overflow: hidden;
    min-width: 0;
}

.comment-thread-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    flex-shrink: 0;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-secondary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--md-sys-shape-corner-full);
    object-fit: cover;
}

.comment-avatar .icon {
    width: 18px;
    height: 18px;
    color: var(--md-sys-color-on-secondary-container);
}

.thread-line {
    width: 2px;
    flex: 1;
    background: var(--md-sys-color-outline-variant);
    margin: var(--md-sys-spacing-xs) 0;
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short);
}

.thread-line:hover {
    background: var(--md-sys-color-primary);
}

.comment-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-xs);
    flex-wrap: wrap;
}

.comment-author {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.comment-author.op {
    color: var(--md-sys-color-primary);
}

.comment-op-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: var(--md-sys-shape-corner-extra-small);
    text-transform: uppercase;
    font-weight: 500;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.comment-body {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    line-height: 1.5;
    margin-bottom: var(--md-sys-spacing-sm);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.comment-body p {
    margin-bottom: var(--md-sys-spacing-sm);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

/* Comentarios eliminados */
.comment-deleted {
    opacity: 0.6;
}

.comment-deleted .comment-avatar.deleted {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

.comment-deleted .comment-author.deleted {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    text-decoration: none;
    cursor: default;
}

.comment-deleted .comment-body.deleted {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.comment-deleted .comment-body.deleted em {
    font-style: italic;
}

/* Acciones del comentario (votos, responder, etc.) */
.comment-actions {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
}

.comment-action {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border: none;
    background: transparent;
    border-radius: var(--md-sys-shape-corner-extra-small);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short);
}

.comment-action:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.comment-action .icon {
    width: 16px;
    height: 16px;
}

.comment-action.upvoted {
    color: var(--md-sys-color-tertiary);
}

.comment-action.downvoted {
    color: var(--md-sys-color-error);
}

.vote-count {
    font-weight: 500;
    min-width: 24px;
    text-align: center;
}

/* Respuestas anidadas */
.comment-replies {
    margin-top: var(--md-sys-spacing-md);
    padding-left: var(--md-sys-spacing-md);
    max-width: 100%;
    overflow: hidden;
}

/* Comentario colapsado */
.comment.collapsed .comment-content > *:not(.comment-header) {
    display: none;
}

.comment.collapsed .comment-header::after {
    content: '[comentario colapsado]';
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
    margin-left: var(--md-sys-spacing-sm);
}

/* Formulario de respuesta inline */
.reply-form,
.reply-form-inline {
    margin-top: var(--md-sys-spacing-md);
    padding: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-small);
}

.reply-form textarea,
.reply-form-inline textarea {
    width: 100%;
    min-height: 60px;
    padding: var(--md-sys-spacing-sm);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
    margin-bottom: var(--md-sys-spacing-sm);
    background: var(--md-sys-color-surface);
}

.reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--md-sys-spacing-sm);
}

/* Cargar más comentarios */
.load-more-comments {
    margin-left: 48px;
    padding: var(--md-sys-spacing-sm);
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-extra-small);
    transition: background var(--md-sys-motion-duration-short);
}

.load-more-btn:hover {
    background: var(--md-sys-color-primary-container);
}

/* Empty state */
.comments-empty {
    text-align: center;
    padding: var(--md-sys-spacing-2xl);
    color: var(--md-sys-color-on-surface-variant);
}

.comments-empty .icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--md-sys-spacing-md);
    opacity: 0.5;
}

.comments-empty p {
    font-size: 0.875rem;
}

/* Ordenar comentarios */
.comments-sort {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
}

.comments-sort label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.comments-sort select {
    font-size: 0.75rem;
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

/* ====================================
   EMPTY STATES
   ==================================== */
.empty-state {
    text-align: center;
    padding: var(--md-sys-spacing-3xl) var(--md-sys-spacing-lg);
    grid-column: 1 / -1; /* Ocupar todas las columnas del grid */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state .icon {
    width: 64px;
    height: 64px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.5;
    margin-bottom: var(--md-sys-spacing-md);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: var(--md-sys-spacing-sm);
}

.empty-state p {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-lg);
}

/* ====================================
   SNACKBAR / TOAST
   ==================================== */
.snackbar {
    position: fixed;
    bottom: var(--md-sys-spacing-lg);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: var(--md-sys-spacing-md) var(--md-sys-spacing-lg);
    border-radius: var(--md-sys-shape-corner-small);
    box-shadow: var(--md-sys-elevation-3);
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    z-index: 1100;
    opacity: 0;
    transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.snackbar.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.snackbar-action {
    background: none;
    border: none;
    color: var(--md-sys-color-inverse-primary);
    font-weight: 500;
    cursor: pointer;
}

/* ====================================
   DIALOGS / MODALS
   ==================================== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--md-sys-spacing-lg);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--md-sys-motion-duration-medium);
}

.dialog-overlay.show {
    opacity: 1;
    visibility: visible;
}

.dialog {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: var(--md-sys-spacing-lg);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--md-sys-elevation-5);
    transform: scale(0.9);
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.dialog-overlay.show .dialog {
    transform: scale(1);
}

.dialog-header {
    margin-bottom: var(--md-sys-spacing-md);
}

.dialog-title {
    font-size: 1.5rem;
    margin-bottom: var(--md-sys-spacing-sm);
}

.dialog-body {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-lg);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--md-sys-spacing-sm);
}
/* ====================================
   LEAFLET MAPS
   ==================================== */
.event-map-container {
    margin: var(--md-sys-spacing-xl) 0;
}

.map-wrapper {
    position: relative;
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
    box-shadow: var(--md-sys-elevation-1);
}

.leaflet-map {
    z-index: 1;
}

.leaflet-map-selector {
    cursor: crosshair;
}

.map-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-md);
    margin-top: var(--md-sys-spacing-md);
}

.map-location-text {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    margin: 0;
}

/* Marcador personalizado */
.miata-marker {
    background: none;
    border: none;
}

.marker-pin {
    background: var(--md-sys-color-surface);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-sys-elevation-2);
}

.marker-pin svg {
    transform: rotate(45deg);
}

/* Controles de capa */
.map-layer-controls {
    position: absolute;
    bottom: var(--md-sys-spacing-md);
    right: var(--md-sys-spacing-md);
    display: flex;
    gap: var(--md-sys-spacing-xs);
    z-index: 10;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 4px;
    box-shadow: var(--md-sys-elevation-2);
}

.map-layer-btn {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-md);
    border: none;
    background: transparent;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short);
}

.map-layer-btn:hover {
    background: var(--md-sys-color-surface-variant);
}

.map-layer-btn.active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Búsqueda en mapa */
.map-search-control {
    margin-bottom: var(--md-sys-spacing-md);
    position: relative;
}

.map-search-input {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
}

.map-search-input .icon {
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
}

.map-search-input input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    outline: none;
}

.map-search-input input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

.map-search-btn {
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-md);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short);
}

.map-search-btn:hover {
    background: var(--md-sys-color-primary-hover);
}

.map-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-3);
    margin-top: var(--md-sys-spacing-xs);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.map-search-results.visible {
    display: block;
}

.map-search-result {
    display: flex;
    align-items: flex-start;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-md);
    cursor: pointer;
    transition: background var(--md-sys-motion-duration-short);
}

.map-search-result:hover {
    background: var(--md-sys-color-surface-variant);
}

.map-search-result .icon {
    color: var(--md-sys-color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.map-search-result span {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
    line-height: 1.4;
}

.map-search-loading,
.map-search-empty {
    padding: var(--md-sys-spacing-lg);
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

/* Coordenadas */
.map-coords-display {
    display: flex;
    gap: var(--md-sys-spacing-md);
    margin-top: var(--md-sys-spacing-md);
}

.coord-field {
    flex: 1;
}

.coord-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-xs);
}

.coord-field input {
    width: 100%;
    padding: var(--md-sys-spacing-sm);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface);
}

/* Selector de mapa en formularios */
.map-selector-container {
    margin-bottom: var(--md-sys-spacing-lg);
}

.map-selector-container .form-label {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-xs);
}

.map-selector-container .form-hint {
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-md);
}

/* ====================================
   SUBCATEGORÍAS
   ==================================== */
.subcategories-container {
    margin-top: var(--md-sys-spacing-md);
    padding-left: var(--md-sys-spacing-lg);
}

.subcategory-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-xs);
}

.subcategory-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 0.8125rem;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short);
}

.subcategory-chip:hover {
    background: var(--md-sys-color-surface-variant);
    border-color: var(--md-sys-color-outline);
}

.subcategory-chip.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--md-sys-spacing-sm) 0;
}

.category-header .icon-expand {
    transition: transform var(--md-sys-motion-duration-short);
}

.category-header.expanded .icon-expand {
    transform: rotate(180deg);
}

/* ====================================
   MODAL DE CONFIRMACIÓN
   ==================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-medium);
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-content {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-xl);
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform var(--md-sys-motion-duration-medium);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    margin-bottom: var(--md-sys-spacing-md);
    font-size: 1.25rem;
}

.modal-content p {
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-xl);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--md-sys-spacing-sm);
}

/* ====================================
   MEJORAS COMENTARIOS ANIDADOS
   ==================================== */
.comment-reply {
    margin-left: var(--md-sys-spacing-lg);
    border-left: 2px solid var(--md-sys-color-outline-variant);
    padding-left: var(--md-sys-spacing-md);
}

.comment-reply .comment-avatar {
    width: 28px;
    height: 28px;
}

.comment-reply .comment-avatar .icon {
    width: 16px;
    height: 16px;
}

.comment-author {
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.comment-author:hover {
    text-decoration: underline;
}

.comment-author.op {
    color: var(--md-sys-color-primary);
}

.comment-op-badge {
    font-size: 0.625rem;
    font-weight: 700;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 2px 6px;
    border-radius: var(--md-sys-shape-corner-full);
    margin-left: var(--md-sys-spacing-xs);
}

.comment-score {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    color: var(--md-sys-color-on-surface);
}

.comment-action.upvoted {
    color: var(--md-sys-color-tertiary);
}

.comment-action.upvoted .icon {
    fill: var(--md-sys-color-tertiary);
}

.comment-action.downvoted {
    color: var(--md-sys-color-error);
}

.comment-action.downvoted .icon {
    fill: var(--md-sys-color-error);
}

/* Ocultar texto en acciones en móvil */
@media (max-width: 600px) {
    .comment-action .action-text {
        display: none;
    }
    
    .comment-reply {
        margin-left: var(--md-sys-spacing-sm);
        padding-left: var(--md-sys-spacing-sm);
    }
}

/* Formulario de edición inline */
.edit-form-inline {
    margin-top: var(--md-sys-spacing-sm);
}

.edit-form-inline textarea {
    width: 100%;
    padding: var(--md-sys-spacing-sm);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: var(--md-sys-spacing-sm);
}

.edit-form-inline textarea:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

/* ====================================
   COMUNIDADES MODULE
   ==================================== */

/* Comunidad Card */
.comunidad-card {
    position: relative;
}

.comunidad-card.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comunidad-card.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.comunidad-card .card-img-link {
    display: block;
}

.comunidad-card .card-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.comunidad-card .card-badge {
    position: absolute;
    top: var(--md-sys-spacing-sm);
    right: var(--md-sys-spacing-sm);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
}

/* Lista de mis comunidades */
.comunidades-list {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-sm);
}

.comunidad-item {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    padding: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.comunidad-item:hover {
    background: var(--md-sys-color-surface-variant);
}

.comunidad-item.unread {
    background: var(--md-sys-color-primary-container);
}

.comunidad-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--md-sys-shape-corner-full);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.comunidad-info {
    flex: 1;
    min-width: 0;
}

.comunidad-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
}

.comunidad-rol {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Vista privada/preview */
.comunidad-privada-view,
.comunidad-preview {
    min-height: 100vh;
}

.comunidad-header {
    height: 300px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comunidad-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}

.comunidad-header-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
}

.comunidad-header-content h1 {
    font-size: 2rem;
    margin-bottom: var(--md-sys-spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--md-sys-spacing-sm);
}

.comunidad-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--md-sys-shape-corner-full);
    background-size: cover;
    background-position: center;
    margin: 0 auto var(--md-sys-spacing-md);
    border: 3px solid white;
}

/* Layout del chat de comunidad */
.comunidad-chat-layout {
    display: flex;
    height: calc(100vh - 64px);
    background: var(--md-sys-color-surface);
}

.comunidad-sidebar {
    width: 280px;
    background: var(--md-sys-color-surface-container-low);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    padding: var(--md-sys-spacing-md);
}

.comunidad-sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    padding-bottom: var(--md-sys-spacing-md);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: var(--md-sys-spacing-md);
}

.comunidad-icon-sm {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.comunidad-sidebar-info {
    flex: 1;
    min-width: 0;
}

.comunidad-sidebar-info h2 {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comunidad-sidebar-menu {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: var(--md-sys-spacing-sm);
    margin-bottom: var(--md-sys-spacing-md);
}

.comunidad-sidebar-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--md-sys-shape-corner-small);
}

.comunidad-sidebar-menu button:hover {
    background: var(--md-sys-color-surface-variant);
}

.comunidad-sidebar-menu hr {
    border: none;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin: var(--md-sys-spacing-sm) 0;
}

.comunidad-descripcion {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
    margin-bottom: var(--md-sys-spacing-md);
}

/* Chat principal */
.comunidad-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--md-sys-spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-sm);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.chat-empty .icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--md-sys-spacing-md);
    opacity: 0.5;
}

/* Mensajes */
.mensaje {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    max-width: 70%;
    position: relative;
}

.mensaje-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--md-sys-shape-corner-full);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.mensaje-content {
    background: var(--md-sys-color-surface-container);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    border-radius: var(--md-sys-shape-corner-medium);
    border-top-left-radius: var(--md-sys-shape-corner-extra-small);
}

.mensaje-propio {
    margin-left: auto;
    flex-direction: row-reverse;
}

.mensaje-propio .mensaje-content {
    background: var(--md-sys-color-primary-container);
    border-top-left-radius: var(--md-sys-shape-corner-medium);
    border-top-right-radius: var(--md-sys-shape-corner-extra-small);
}

.mensaje-autor {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    display: block;
    margin-bottom: var(--md-sys-spacing-xs);
}

.mensaje-texto {
    margin: 0;
    word-wrap: break-word;
    line-height: 1.4;
}

.mensaje-texto a {
    color: var(--md-sys-color-primary);
}

.mensaje-meta {
    font-size: 0.6875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: var(--md-sys-spacing-xs);
    display: flex;
    gap: var(--md-sys-spacing-sm);
}

.mensaje-editado {
    font-style: italic;
}

.mensaje-actions {
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    gap: var(--md-sys-spacing-xs);
}

.mensaje-propio .mensaje-actions {
    left: -60px;
    right: auto;
}

.mensaje:hover .mensaje-actions {
    display: flex;
}

.btn-tiny {
    padding: 4px;
    opacity: 0.7;
}

.btn-tiny:hover {
    opacity: 1;
}

/* Respuesta preview */
.mensaje-respuesta-preview {
    background: var(--md-sys-color-surface-container-high);
    padding: var(--md-sys-spacing-xs) var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-extra-small);
    margin-bottom: var(--md-sys-spacing-xs);
    border-left: 3px solid var(--md-sys-color-primary);
    cursor: pointer;
    font-size: 0.75rem;
}

.respuesta-autor {
    font-weight: 500;
    color: var(--md-sys-color-primary);
}

.respuesta-texto {
    color: var(--md-sys-color-on-surface-variant);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Media en mensajes */
.mensaje-imagen img,
.mensaje-gif img {
    max-width: 300px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
}

.mensaje-video video {
    max-width: 300px;
    border-radius: var(--md-sys-shape-corner-small);
}

.mensaje-archivo {
    margin-top: var(--md-sys-spacing-xs);
}

.archivo-link {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    padding: var(--md-sys-spacing-sm);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-small);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
}

.archivo-link:hover {
    background: var(--md-sys-color-surface-variant);
}

.mensaje-caption {
    margin: var(--md-sys-spacing-xs) 0 0;
    font-size: 0.875rem;
}

.mensaje-sistema {
    text-align: center;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    padding: var(--md-sys-spacing-sm);
}

.mensaje-highlighted {
    animation: highlight-pulse 2s ease;
}

@keyframes highlight-pulse {
    0%, 100% { background: transparent; }
    50% { background: var(--md-sys-color-secondary-container); }
}

/* Input area */
.chat-input-area {
    padding: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container-low);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--md-sys-color-surface-container);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    border-radius: var(--md-sys-shape-corner-small);
    margin-bottom: var(--md-sys-spacing-sm);
    border-left: 3px solid var(--md-sys-color-primary);
}

.reply-content {
    flex: 1;
    min-width: 0;
}

.reply-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
}

.reply-text {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: var(--md-sys-spacing-sm);
}

.chat-input-wrapper {
    flex: 1;
}

.chat-input {
    width: 100%;
    resize: none;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--md-sys-color-surface);
    max-height: 150px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

/* Modal miembros */
.miembros-list {
    max-height: 400px;
    overflow-y: auto;
}

.miembro-item {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-md);
    padding: var(--md-sys-spacing-sm);
    border-radius: var(--md-sys-shape-corner-small);
}

.miembro-item:hover {
    background: var(--md-sys-color-surface-variant);
}

.miembro-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    background-size: cover;
    background-position: center;
}

.miembro-info {
    flex: 1;
}

.miembro-nombre {
    font-weight: 500;
}

.miembro-rol {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Responsive */
@media (max-width: 768px) {
    .comunidad-chat-layout {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    .comunidad-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        padding: var(--md-sys-spacing-sm);
        border-right: none;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }
    
    .comunidad-sidebar-header {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    
    .comunidad-descripcion,
    .comunidad-sidebar > .btn {
        display: none;
    }
    
    .mensaje {
        max-width: 85%;
    }
    
    .mensaje-actions {
        position: static;
        transform: none;
        display: flex;
        margin-top: var(--md-sys-spacing-xs);
    }
    
    .mensaje-propio .mensaje-actions {
        left: auto;
        right: auto;
    }
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: var(--md-sys-spacing-sm);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding-bottom: var(--md-sys-spacing-sm);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-xs);
    padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--md-sys-shape-corner-full);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--md-sys-color-surface-variant);
}

.tab-btn.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.tab-content {
    padding-top: var(--md-sys-spacing-lg);
}

/* Form crear comunidad */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-md);
}

.radio-label {
    display: flex;
    flex-direction: column;
    padding: var(--md-sys-spacing-md);
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-medium);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.radio-label:has(input:checked) {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
}

.radio-label input {
    position: absolute;
    opacity: 0;
}

.radio-label span {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-sm);
    font-weight: 500;
}

.radio-label small {
    margin-top: var(--md-sys-spacing-xs);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}