/* Reset y estilos generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Contenedor principal */
.gallery-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
}

/* Sidebar - Índice */
.sidebar {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.sidebar h2 {
    color: #2a5298;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #667eea;
}

/* Estilo de los índices */
.style-item {
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    transition: all 0.3s ease;
}

.style-item:hover {
    border-left-color: #764ba2;
    transform: translateX(5px);
}

.style-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #1e3c72;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.style-title:hover {
    background-color: #f0f4ff;
    color: #667eea;
}

.style-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background-color: #f9f9f9;
    border-radius: 5px;
    line-height: 1.5;
}

/* Sub-índices (Artistas) */
.artists-list {
    margin-top: 0.8rem;
    padding-left: 0.5rem;
}

.artist-item {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.artist-item:hover {
    background-color: #e3f2fd;
    border-color: #2196f3;
    transform: translateX(5px);
}

.artist-name {
    font-weight: bold;
    color: #2a5298;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.artist-history {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    margin-top: 0.3rem;
}

/* Área central - Display de obras */
.main-content {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

/* Mensaje de bienvenida */
.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.welcome-message h2 {
    font-size: 2rem;
    color: #2a5298;
    margin-bottom: 1rem;
}

.welcome-message p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.art-icon {
    font-size: 5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Display de obras de arte */
.artwork-container {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.artwork-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.artwork-title {
    font-size: 2rem;
    color: #1e3c72;
    margin-bottom: 0.5rem;
}

.artwork-artist {
    font-size: 1.3rem;
    color: #667eea;
    margin-bottom: 0.3rem;
}

.artwork-style {
    font-size: 1rem;
    color: #999;
}

/* Iframe/Imagen para mostrar las obras */
.artwork-image-container {
    position: relative;
    width: 100%;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px;
    margin: 1.5rem 0;
}

.artwork-frame {
    max-width: 100%;
    max-height: 600px;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    object-fit: contain;
}

/* Loader de imagen */
.image-loader {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-loader p {
    color: #666;
    font-size: 1rem;
}

/* Error de carga de imagen */
.image-error {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}

.image-error p {
    color: #e74c3c;
    font-size: 1.2rem;
    font-weight: bold;
}

.external-link-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.external-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Navegación entre obras */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.nav-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.nav-button:active {
    transform: translateY(0);
}

.nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.artwork-counter {
    font-size: 1.1rem;
    color: #666;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .gallery-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .artwork-frame {
        height: 400px;
    }
    
    .nav-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}