/* --- Global & AR Scene Reset --- */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

a-scene {
    height: 100vh;
    width: 100vw;
}

/* --- Loading Screen Styles --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f7f7f7;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.5s ease-out;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    padding: 20px;
    max-width: 90%;
}

#um-logo {
    width: 250px;
    height: auto;
    margin-bottom: 0;
}

.loading-content h1 {
    margin-top: 0;
    margin-bottom: 0;
    color: #222222;
}

#start-button {
    background-color: #004d99;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

#start-button:hover {
    background-color: #003366;
}

.orientation-tip {
    font-size: 1em;
    color: #666;
    margin-top: 5px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* --- UI Overlay --- */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* --- Info Icon (Bottom Right) --- */
#info-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    background: #f5a800;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transition: transform 0.2s;
    padding: 0;
    display: none;
}

/* FIX: Class added by JS to make the button visible */
#info-icon.visible {
    display: block;
}

#info-icon:hover {
    transform: scale(1.05);
}

#info-icon img {
    width: 40px;
    height: 40px;
}

/* --- Info Panel (Covers 70% of screen, slides from LEFT) --- */
#info-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 70%;
    height: 100%;
    background-color: white;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    padding: 0;
    box-sizing: border-box;
    transform: translateX(-100%);
    transition: transform 0.4s ease-out;
    pointer-events: auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#info-panel.visible {
    transform: translateX(0);
}

/* --- Panel Header (Title + Close Button) --- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

#location-title {
    color: #222222;
    margin: 0;
    font-size: 1.5em;
    flex: 1;
    line-height: 1.3;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #333;
    line-height: 1;
    padding: 0;
    margin-left: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #e0e0e0;
}

/* --- Divider --- */
.divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 0;
}

/* --- Current Images Section - Three Columns (NO TITLE) --- */
.current-images-section {
    padding: 20px;
    padding-bottom: 0;
    background-color: #fff;
}

.current-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}

.current-image-link {
    display: block;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    height: auto;
    min-height: 150px;
    /* REMOVED: border-radius: 6px; */
}

.current-image-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.current-building-img {
    width: 100%;
    height: auto;
    /* REMOVED: max-height: 180px; */
    /* REMOVED: border-radius: 6px; */
    object-fit: contain;
    display: block;
}

/* --- Description Section --- */
.description-section {
    padding: 20px;
    background-color: #fff;
    flex: 1;
}

#location-text {
    color: #333;
    line-height: 1.6;
    margin: 0;
    font-size: 1.05em;
    text-align: justify;
}

/* --- Archive Section --- */
.archive-section {
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.archive-section h3 {
    color: #222222;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* UPDATED: Archive grid always shows 3 columns */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.archive-grid a {
    display: block;
    /* REMOVED: border-radius: 6px; */
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    height: auto;
    min-height: 100px;
    background-color: #fff;
    padding: 0; /* Changed from 5px to 0 */
}

.archive-grid a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.archive-grid img {
    width: 100%;
    height: auto;
    /* REMOVED: max-height: 120px; */
    /* REMOVED: border-radius: 4px; */
    object-fit: contain;
    display: block;
}

/* Ensure messages span all 3 columns */
.no-archive-message {
    grid-column: 1 / span 3 !important;
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* --- Scrollbar Styling --- */
#info-panel::-webkit-scrollbar {
    width: 8px;
}

#info-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#info-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#info-panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    #info-panel {
        width: 85%;
    }
    
    .current-images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    /* REMOVED: .current-building-img max-height */
    
    /* UPDATED: Archive grid responsive */
    .archive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    /* REMOVED: .archive-grid img max-height */
}

@media (max-width: 480px) {
    #info-panel {
        width: 95%;
    }
    
    .current-images-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* REMOVED: .current-building-img max-height */
    
    /* UPDATED: Archive grid mobile - 2 columns for better fit */
    .archive-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* REMOVED: .archive-grid img max-height */
}

/* UPDATED: Archive grid row alignment */
.archive-grid a:empty {
    display: none;
}

/* Loading animation for images */
.current-building-img, .archive-grid img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.current-building-img.loaded, .archive-grid img.loaded {
    animation: none;
    background: transparent;
}

/* Development Credit Text */
/* Add this to your existing style.css */
.development-credit {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    opacity: 0.8;
    margin: 0;
    padding: 0 20px;
}