/* ================================
   ESTILOS CUERPO DE PAGINA
   ================================ */

body {
    margin-top: 180px !important;
    background:
        url('../imagenes/fondoBuscadoroficial.webp') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
}

#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    background: rgba(0, 0, 0, 1);
    transition: background-color 0.3s ease-in-out;
    will-change: background-color;
    backface-visibility: hidden;
}

#header.transparent {
    background: rgba(0, 0, 0, 0.7);
}

/* ================================
   CONTENEDOR PRINCIPAL
   ================================ */

.object-detail-card {
    background: white;
    border-radius: 15px;
    border: solid 2px #000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;

}

.detail-container {
    margin-top: 30px;
    padding: 10px;
}

/* ================================
   ENCABEZADO DEL OBJETO
   ================================ */
.object-header {
    background: linear-gradient(135deg, #7a322e, #5a241f);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.object-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 600;
    color: white;
}

.object-header .inventario {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ================================
   IMAGEN Y MODELO 3D
   ================================ */
.object-image {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
}

.detail-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.model-viewer-detail {
    width: 100%;
    height: 500px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: #f0f0f0;
}

.model-viewer-help,
.model-viewer-controls {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    z-index: 10;
    text-align: center;
    color: white;
}

.model-viewer-help {
    bottom: 20px;
    background: rgba(0, 0, 0, 0.8);
}

.model-viewer-controls {
    top: 20px;
    background: rgba(122, 50, 46, 0.9);
}

/* ================================
   TABS DE MEDIOS
   ================================ */
.media-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.media-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
    font-size: 1rem;
}

.media-tab.active {
    background: #7a322e;
    color: white;
}

.media-tab:hover {
    background: rgba(122, 50, 46, 0.1);
}

.media-tab.active:hover {
    background: #6b2c28;
}

.media-content {
    display: none;
    position: relative;
}

.media-content.active {
    display: block;
}

/* ================================
   MENSAJES DE NO DISPONIBLE
   ================================ */
.no-media-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    color: #6c757d;
    text-align: center;
    padding: 40px 20px;
}

.no-media-message i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-media-message p {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
}

/* Overlay para imagen no disponible */
.main-image-container {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ================================
   GALERÍA DE IMÁGENES
   ================================ */
.image-gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-image-container img {
    margin: 0 auto;
}

.thumbnail-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 10px 0;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thumbnail:hover,
.thumbnail.active {
    border-color: #7a322e;
}

.thumbnail.active {
    box-shadow: 0 4px 15px rgba(122, 50, 46, 0.3);
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 1.2rem;
}

.gallery-nav-btn:hover {
    background: rgba(122, 50, 46, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-btn.prev {
    left: 20px;
}

.gallery-nav-btn.next {
    right: 20px;
}

.zoom-hint {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-image-container:hover .zoom-hint {
    opacity: 1;
}

/* ================================
   INFORMACIÓN DETALLADA
   ================================ */

.object-info {
    padding: 30px;
}

.info-section {
    margin-bottom: 25px;
}

.info-section h3 {
    color: #7a322e;
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #7a322e;
    padding-bottom: 5px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #7a322e;
}

.info-item strong {
    color: #7a322e;
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.estado-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ================================
   DESCRIPCIONES
   ================================ */
.description-section {
    background: #f8f9fa;
    padding: 25px 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #7a322e;
}

.description-section:last-child {
    margin-bottom: 0;
}

.description-title {
    color: #7a322e;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px dashed #dee2e6;
}

.description-text {
    line-height: 1.9;
    font-size: 1.05rem;
    color: #333;
    text-align: justify;
    hyphens: auto;
}

.description-text p {
    margin: 0 0 15px 0;
    text-indent: 1.5em;
}

.description-text p:first-child {
    text-indent: 0;
}

.description-text p:last-child {
    margin-bottom: 0;
}

/* ================================
   DIMENSIONES
   ================================ */
.dimensions-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.dimension-badge {
    display: inline-block;
    margin: 2px 8px 2px 0;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.9em;
    color: #495057;
}

/* ================================
   BOTONES DE NAVEGACIÓN
   ================================ */
.navigation-buttons {
    text-align: center;
    margin-top: 30px;
}

.btn-museum {
    background: #7a322e;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.btn-museum:hover {
    background: #5a241f;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(122, 50, 46, 0.3);
}

/* ================================
   ESTADOS DE CARGA Y ERROR
   ================================ */
.loading {
    text-align: center;
    padding: 100px 0;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading i {
    font-size: 3rem;
    color: #7a322e;
    animation: spin 2s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.error-message {
    text-align: center;
    padding: 50px;
    color: #dc3545;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-message i {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* ================================
   UTILIDADES
   ================================ */
.hidden {
    display: none !important;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
    body {
        margin-top: 150px !important;
    }

    .object-header {
        padding: 12px 15px;
    }

    .object-header h1 {
        font-size: 1.4rem;
    }

}

@media (max-width: 768px) {

    .object-image,
    .object-info,
    .description-section {
        padding: 20px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .media-tabs {
        flex-direction: column;
    }

    .model-viewer-detail {
        height: 350px;
    }

    .model-viewer-help {
        bottom: 10px;
        font-size: 0.75em;
        padding: 6px 12px;
    }

    .model-viewer-controls {
        top: 10px;
        font-size: 0.75em;
        padding: 6px 12px;
    }

    .btn-museum {
        display: block;
        margin: 10px auto;
        max-width: 200px;
    }

    .dimensions-compact {
        flex-direction: column;
        gap: 4px;
    }

    .thumbnail-container {
        gap: 8px;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 576px) {
    .object-header h1 {
        font-size: 1.2rem;
    }

    .detail-image,
    .model-viewer-detail {
        max-height: 300px;
    }

    .info-item {
        padding: 12px;
    }

    .description-section {
        padding: 18px 20px;
    }

    .description-title {
        font-size: 1.05rem;
    }

    .description-text {
        font-size: 1rem;
        line-height: 1.75;
        text-align: left;
    }

    .description-text p {
        text-indent: 0;
        margin-bottom: 12px;
    }

    .btn-museum {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

/* ================================
   CONTROL DE ACCESO POR ROLES
   ================================ */

/* Badge para indicar informacion restringida (solo visible para admins) */
.admin-only-badge {
    display: inline-block;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Banner informativo para visitantes */
.visitor-notice {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.visitor-notice i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.visitor-notice p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.visitor-notice strong {
    font-weight: 600;
}

/* ================================
   BOTÓN AR (Realidad Aumentada)
   ================================ */
.ar-button {
    background: linear-gradient(135deg, #7a322e, #5a241f);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 15px rgba(122, 50, 46, 0.4);
    transition: all 0.3s ease;
    z-index: 20;
}

.ar-button:hover {
    background: linear-gradient(135deg, #5a241f, #7a322e);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(122, 50, 46, 0.5);
}

.ar-button:active {
    transform: translateX(-50%) scale(0.98);
}

.ar-button i {
    font-size: 1.2rem;
}

/* Estilo cuando AR está activo */
model-viewer[ar-status="session-started"] {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

/* Indicador de carga del modelo 3D */
model-viewer .progress-bar {
    display: block;
    width: 33%;
    height: 10%;
    max-height: 2%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
    border-radius: 25px;
    box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5), 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    background-color: rgba(0, 0, 0, 0.5);
}

model-viewer .progress-bar.hide {
    visibility: hidden;
    transition: visibility 0.3s;
}

model-viewer .update-bar {
    background-color: #7a322e;
    width: 0%;
    height: 100%;
    border-radius: 25px;
    float: left;
    transition: width 0.3s;
}

/* Responsive para botón AR */
@media (max-width: 768px) {
    .ar-button {
        padding: 10px 18px;
        font-size: 0.9rem;
        bottom: 60px;
    }

    .model-viewer-help {
        font-size: 0.75em;
        padding: 6px 12px;
    }
}

/* ================================
   MENSAJE DE ESTADO AR
   ================================ */
.ar-status-message {
    display: none;
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 15px 20px;
    margin-top: 15px;
    align-items: flex-start;
    gap: 15px;
    color: #856404;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ar-status-message.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-color: #f5c6cb;
    color: #721c24;
}

.ar-status-message>i {
    font-size: 2rem;
    margin-top: 5px;
    opacity: 0.8;
}

.ar-status-message strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
}

.ar-status-message p {
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.ar-status-message ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ar-status-message ul li {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.ar-install-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #28a745;
    color: white !important;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.ar-install-link:hover {
    background: #218838;
    transform: scale(1.02);
    text-decoration: none;
}

.ar-install-link i {
    font-size: 1rem;
}

/* Responsive para mensaje AR */
@media (max-width: 768px) {
    .ar-status-message {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .ar-status-message>i {
        margin-top: 0;
    }

    .ar-status-message ul {
        text-align: left;
    }
}