/* Estilos existentes... */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.header {
    width: 100%;
    height: 100px;
    position: relative;
    overflow: hidden;
    background-image: url('../imagenes/cabecera4.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.logo {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 90px;
    height: 90px;
    z-index: 10;
}
.title-image {
    position: absolute;
    top: 50%;
    left: 95px;
    transform: translateY(-50%);
    height: 80px;
    z-index: 10;
    max-width: 500px;
    object-fit: contain;
}

.main-content {
    flex: 1;
    /* CAMBIO CLAVE: Eliminamos todo el padding para controlarlo manualmente */
    padding: 0;
    margin-top: 0;
    position: relative;
    z-index: 1;
    background-color: transparent;
}

/* ========== MENÚ ACCESIBLE Y EFECTOS CORREGIDO ========== */
.menu-container {
    width: 100%;
    background: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%);
    box-shadow: 0 8px 16px rgba(0,0,0,.4);
    position: relative;
    z-index: 5;
    padding: 4px 0;
}
.menu {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.menu li {
    position: relative;
    margin: 0 5px;
    /* perspective: 1000px;  Quitar si no haces transform 3D */
}
.menu a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 15px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: background .3s, color .3s, box-shadow .3s, outline .2s;
    position: relative;
    border-radius: 6px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    box-shadow: 3px 3px 6px rgba(0,0,0,.5), -3px -3px 6px rgba(255,255,255,.1), inset 1px 1px 2px rgba(255,255,255,.2);
width: auto;
height: auto;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,.2);
}
.menu a:focus,
.menu a:focus-visible {
    outline: 3px solid #FFD700;
    background: #331212;
    color: #FFD700;
    z-index: 2;
}
.menu a:hover,
.menu a:active {
    background: linear-gradient(145deg, #c04306, #8B0000);
    color: #FFD700;
    box-shadow: 5px 5px 10px rgba(0,0,0,.6), -5px -5px 10px rgba(255,255,255,.15), inset 1px 1px 3px rgba(255,255,255,.3);
    text-shadow: 0 1px 0 #ccc;
    /* transform eliminado para evitar desplazamiento y efecto borroso */
}

.menu a .ripple,
.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255,215,0,.6);
    transform: scale(0);
    animation: ripple .6s linear;
    pointer-events: none;
}
@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* Solo menú para reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    .menu-container .menu a,
    .menu-container .menu .ripple,
    .menu-container .menu a::before,
    .menu-container .menu a::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

@media screen and (-ms-high-contrast: none) {
    .menu a::before {
        content: '';
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: linear-gradient(145deg, #c04306, #8B0000);
        border-radius: 6px;
        opacity: 0;
        transition: opacity .4s ease;
        z-index: -1;
    }
    .menu a:hover::before, .menu a:focus::before { opacity: 1; }
    .menu a:hover, .menu a:focus {
        color: #FFD700;
        box-shadow: 5px 5px 10px rgba(0,0,0,.6), -5px -5px 10px rgba(255,255,255,.15), inset 1px 1px 3px rgba(255,255,255,.3);
        text-shadow: 0 1px 0 #ccc;
        /* transform eliminado para evitar desplazamiento */
    }
}

@media screen and (-ms-high-contrast: active) {
    .menu a {
        background: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    .menu a:hover, .menu a:focus {
        background: Highlight;
        color: HighlightText;
        box-shadow: 0 4px 8px rgba(0,0,0,.5);
        border: 2px solid HighlightText;
        /* transform eliminado */
    }
}
@media screen and (-ms-high-contrast: none) {
    .menu a::after {
        content: '';
        position: absolute;
        top: -50%; left: -50%;
        width: 200%; height: 200%;
        background: linear-gradient(to right,
          rgba(255,255,255,0) 0%,
          rgba(255,255,255,.1) 50%,
          rgba(255,255,255,0) 100%);
        transform: rotate(30deg);
        transition: all .6s ease;
        opacity: 0;
        z-index: 1;
    }
    .menu a:hover::after, .menu a:focus::after { animation: shine3d .6s ease; }
}
@keyframes shine3d {
    0%   { transform: translateX(-100%) translateY(-100%) rotate(30deg); opacity: 0; }
    50%  { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(30deg); opacity: 0; }
}
.menu a {
    position: relative;
    overflow: hidden;
}
@media screen and (-ms-high-contrast: none) {
    .menu a {
        border-bottom: 1px solid rgba(0,0,0,.3);
        border-right: 1px solid rgba(0,0,0,.3);
    }
    .menu a:hover, .menu a:focus {
        border-bottom: 1px solid rgba(0,0,0,.5);
        border-right: 1px solid rgba(0,0,0,.5);
    }
}

/* ---------- FOOTER ---------- */
.footer {
    width: 100%;
    height: 40px;
    min-height: 40px;
    background: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%);
    background-image: linear-gradient(to right, #191970 0%, #8B0000 50%, #c04306 100%),
                      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><polygon points="50,5 90,25 90,75 50,95 10,75 10,25" fill="none" stroke="rgba(255,255,255,.05)" stroke-width="2"/></svg>');
    box-shadow: 0 -4px 8px rgba(0,0,0,.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    margin-top: auto;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}
.footer-logo {
    height: 35px;
    margin-right: 10px;
    object-fit: contain;
}

.showcase-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Eliminamos el gap y el margin-bottom de aquí para controlarlo manualmente */
    margin-bottom: 30px;
    /* CAMBIO CLAVE: Añadimos padding lateral para que el contenido no toque los bordes */
    padding: 0 20px;
    background-color: rgba(255, 182, 193, 0.3); /* Un rosa claro para ver el contenedor padre */
/*    border: 2px dashed orange; Un borde discontinuo naranja */
}

.showcase-3d {
    height: 150px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
/* CAMBIO CLAVE: Margen superior de 20px para separarlo de las pestañas */
    margin-top: 0;
    /* CAMBIO CLAVE: Margen inferior de 20px para separarlo del contenido */
    margin-bottom: 0;
    /* CAMBIO TEMPORAL PARA DIAGNÓSTICO */
/*    border: 3px solid red;  Un borde rojo sólido y grueso */
}

margin-top: 20px; #canvas-container {
 
    width: 100%;
    height: 100%;
    position: relative;
}

.showcase-controls {
    display: none; /* Ocultar controles del carrusel */
}

.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover, .product-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #f9f9f9;
    padding: 10px;
    box-sizing: border-box;
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.product-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.project-status {
    font-size: 14px;
    font-weight: bold;
    color: #8B0000;
    margin-bottom: 15px;
    font-style: italic;
}

.product-button {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #191970;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.product-button:hover, .product-button:focus {
    background-color: #8B0000;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.focus-visible {
    outline: 2px solid #c04306;
    outline-offset: 2px;
}

@media screen and (-ms-high-contrast: active) {
    .showcase-3d, .product-card {
        border: 2px solid WindowText;
    }
    
    .showcase-controls {
        background-color: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    
    .showcase-controls button, .product-button {
        background-color: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    
    .showcase-controls button:hover, .showcase-controls button:focus,
    .product-button:hover, .product-button:focus {
        background-color: Highlight;
        color: HighlightText;
    }
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    /* CAMBIO: Reducimos el margen superior a 0, ya que el carrusel ya da la separación */
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #c04306;
}

.project-card {
    border-left: 4px solid #8B0000;
}

.tabs-container {
    /* CAMBIO: Margen superior de 10px respecto al menú de navegación */
    margin-top: 10px;
    margin-bottom: 0; /* Nos aseguramos de que no añada espacio extra debajo */
    background: white;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid #ddd;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px 10px 0 0;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 14px;
    margin: 0;
    border-right: 1px solid #ccc;
    position: relative;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.tab-button:last-child {
    border-right: none;
    border-radius: 0 10px 0 0;
}

.tab-button:first-child {
    border-radius: 10px 0 0 0;
}

/* Colores específicos para cada pestaña */
.tab-button[data-category="all"] {
    background: #f0f0f0;
    color: #333;
}

.tab-button[data-category="visual"] {
    background: #e3f2fd;
    color: #0d47a1;
}

.tab-button[data-category="auditiva"] {
    background: #fff3e0;
    color: #e65100;
}

.tab-button[data-category="motriz"] {
    background: #e8f5e9;
    color: #1b5e20;
}

.tab-button[data-category="cognitiva"] {
    background: #f3e5f5;
    color: #4a148c;
}

.tab-button[data-category="mayores"] {
    background: #fff8e1;
    color: #ff6f00;
}

/* Estado activo con colores más intensos */
.tab-button.active[data-category="all"] {
    background: #2196f3;
    color: white;
}

.tab-button.active[data-category="visual"] {
    background: #0d47a1;
    color: white;
}

.tab-button.active[data-category="auditiva"] {
    background: #e65100;
    color: white;
}

.tab-button.active[data-category="motriz"] {
    background: #1b5e20;
    color: white;
}

.tab-button.active[data-category="cognitiva"] {
    background: #4a148c;
    color: white;
}

.tab-button.active[data-category="mayores"] {
    background: #ff6f00;
    color: white;
}

.tab-button:hover:not(.active) {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

/* Fondo del grid según la pestaña activa */
.category-all .products-container {
    background: #f8fdff;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

.category-visual .products-container {
    background: #f5fbff;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

.category-auditiva .products-container {
    background: #fffaf5;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

.category-motriz .products-container {
    background: #f5fff5;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

.category-cognitiva .products-container {
    background: #fbf5ff;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

.category-mayores .products-container {
    background: #fffdf5;
    padding: 15px;
    border-radius: 0 0 10px 10px;
}

/* Mejoras responsive para pestañas */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ccc;
        border-radius: 0;
    }
    
    .tab-button:first-child {
        border-radius: 10px 10px 0 0;
    }
    
    .tab-button:last-child {
        border-radius: 0 0 10px 10px;
        border-bottom: none;
    }
}

/* Estilos para modo alto contraste */
@media screen and (-ms-high-contrast: active) {
    .tab-button {
        background: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    
    .tab-button.active {
        background: Highlight;
        color: HighlightText;
        border: 2px solid HighlightText;
    }
    
    .section-title {
        color: WindowText;
        border-bottom-color: Highlight;
    }
    
    .project-card {
        border-left-color: Highlight;
    }
    
    .project-status {
        color: Highlight;
    }
    
    .products-container {
        background: Window !important;
        border: 1px solid WindowText;
    }
}

/* Indicador de carga para el carrusel */
.carousel-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 18px;
    color: #666;
}

/* ESTILOS PARA EL MODAL - NUEVOS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(to right, #191970, #8B0000);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
    padding-right: 40px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close:hover, .modal-close:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.modal-image-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    background-color: #f9f9f9;
    padding: 10px;
    box-sizing: border-box;
}

.modal-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-section {
    margin-bottom: 15px;
}

.modal-section-title {
    font-size: 18px;
    font-weight: bold;
    color: #191970;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.modal-section-title::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 18px;
    background-color: #c04306;
    margin-right: 10px;
    border-radius: 3px;
}

.modal-section-content {
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}

.modal-video-container {
    grid-column: 1 / -1;
    margin-top: 15px;
}

.modal-video {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.modal-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.modal-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    grid-column: 1 / -1;
}

.modal-nav-button {
    background: linear-gradient(to right, #191970, #8B0000);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-nav-button:hover, .modal-nav-button:focus {
    background: linear-gradient(to right, #8B0000, #c04306);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.modal-nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Botón cerrar ficha en el modal */
.modal-close-ficha {
    background: #666;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-ficha:hover, .modal-close-ficha:focus {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

/* Responsive para el modal */
@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-section-title {
        font-size: 16px;
    }
    
    .modal-section-content {
        font-size: 14px;
    }
}

/* Estilos para modo alto contraste en el modal */
@media screen and (-ms-high-contrast: active) {
    .modal-container {
        border: 2px solid WindowText;
    }
    
    .modal-header {
        background: Highlight;
        color: HighlightText;
    }
    
    .modal-close {
        background: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    
    .modal-section-title {
        color: WindowText;
    }
    
    .modal-section-title::before {
        background-color: Highlight;
    }
    
    .modal-nav-button, .modal-close-ficha {
        background: Window;
        color: WindowText;
        border: 2px solid WindowText;
    }
    
    .modal-nav-button:hover, .modal-nav-button:focus,
    .modal-close-ficha:hover, .modal-close-ficha:focus {
        background: Highlight;
        color: HighlightText;
    }
}