/* Estilos personalizados para el mural 9x9 mobile-first */

/* Contenedor principal del mural - entre header y footer */
.mural-container {
    position: fixed;
    top: 64px; /* Altura exacta del header */
    left: 0;
    width: 100vw;
    height: calc(100vh - 128px); /* Restar header (64px) y footer (64px) */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 0; /* Detrás de todo */
}

/* Grid 9x9 como mural completo manteniendo proporción 4:3 */
#artGrid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 100%;
    height: 100%;
    max-width: calc(100vw - 40px); /* Margen lateral */
    max-height: calc(100vh - 168px); /* Espacio exacto para header/footer */
    gap: 1px;
    background: #000;
    aspect-ratio: 4/3; /* Mantiene proporción 4:3 del mural completo */
}

/* Header y Footer - header encima del mural, footer debajo */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    margin: 0;
    padding: 0;
    background: rgba(79, 70, 229, 0.85); /* Más transparente */
    backdrop-filter: blur(8px); /* Efecto glassmorphism sutil */
    -webkit-backdrop-filter: blur(8px); /* Soporte Safari */
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    margin: 0;
    padding: 0;
    background: rgba(31, 41, 55, 0.85); /* Más transparente */
    backdrop-filter: blur(8px); /* Efecto glassmorphism sutil */
    -webkit-backdrop-filter: blur(8px); /* Soporte Safari */
}

/* Ajustar z-index de los modales para que estén por encima de todo */
.fixed {
    z-index: 200 !important;
}

/* En móviles: el mural mantiene proporción 4:3 */
@media (max-width: 768px) {
    .mural-container {
        top: 64px; /* Altura exacta del header móvil */
        height: calc(100vh - 128px); /* Restar header (64px) y footer (64px) móvil */
    }
    
    #artGrid {
        gap: 0.5px;
        width: 100%;
        height: 100%;
        max-width: calc(100vw - 20px); /* Menor margen lateral móvil */
        max-height: calc(100vh - 148px); /* Ajuste preciso para móviles */
        aspect-ratio: 4/3; /* Mantiene proporción 4:3 */
    }
    
    .art-item {
        position: relative;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.3s ease;
        aspect-ratio: 4/3; /* Cada pieza mantiene 4:3 */
    }
    
    .art-item:hover {
        transform: scale(1.05);
        z-index: 10;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .art-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .art-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
        color: white;
        padding: 4px;
        font-size: 8px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .art-item:hover .art-overlay {
        opacity: 1;
    }
}

/* En tablets y desktops: el mural mantiene proporción 4:3 */
@media (min-width: 769px) {
    .mural-container {
        top: 64px; /* Altura exacta del header desktop */
        height: calc(100vh - 128px); /* Restar header (64px) y footer (64px) desktop */
    }
    
    #artGrid {
        gap: 1px;
        width: 100%;
        height: 100%;
        max-width: calc(100vw - 40px); /* Margen lateral desktop */
        max-height: calc(100vh - 168px); /* Espacio exacto para header/footer desktop */
        aspect-ratio: 4/3; /* Mantiene proporción 4:3 */
    }
    
    .art-item {
        position: relative;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.3s ease;
        aspect-ratio: 4/3; /* Cada pieza mantiene 4:3 */
        border: none;
    }
    
    .art-item:hover {
        transform: scale(1.1);
        z-index: 10;
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    }
    
    .art-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .art-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
        color: white;
        padding: 8px;
        font-size: 12px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .art-item:hover .art-overlay {
        opacity: 1;
    }
}

/* Indicadores de tipo de venta */
.sale-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: bold;
    color: white;
}

@media (min-width: 769px) {
    .sale-indicator {
        top: 4px;
        right: 4px;
        padding: 4px 6px;
        border-radius: 4px;
        font-size: 10px;
    }
}

.venta-directa {
    background: #10b981;
}

.subasta {
    background: #f59e0b;
}

.rifa {
    background: #ef4444;
}

/* Botones de filtro */
.filter-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.filter-btn.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Touch-friendly para móviles */
@media (max-width: 768px) {
    .modal-content {
        margin: 8px;
        max-height: calc(100vh - 16px);
    }
    
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    input, textarea, select {
        min-height: 44px;
        font-size: 16px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Estados de las obras */
.art-item.sold {
    opacity: 0.6;
    position: relative;
}

.art-item.sold::after {
    content: 'VENDIDA';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 10px;
    z-index: 20;
}

.art-item.auction-ended {
    opacity: 0.7;
}

.art-item.raffle-ended {
    opacity: 0.7;
}

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Factura styles */
.invoice {
    background: white;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
}

.invoice-header {
    text-align: center;
    border-bottom: 2px solid #374151;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.invoice-details {
    margin-bottom: 20px;
}

.invoice-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.invoice-total {
    font-weight: bold;
    font-size: 18px;
    text-align: right;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 2px solid #374151;
}

/* Share buttons */
.share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.share-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-whatsapp {
    background: #25d366;
}

.share-whatsapp:hover {
    background: #128c7e;
}

.share-email {
    background: #ea4335;
}

.share-email:hover {
    background: #d33b2c;
}

.share-copy {
    background: #6b7280;
}

.share-copy:hover {
    background: #4b5563;
}
