/* Global Reset and Base Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Avenir Next', 'Avenir', 'Avenir Next World', 'Inter', 'Century Gothic', 'Verdana', sans-serif;
    background-color: #333; /* bg-gray-100 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Responsive Layout (Mobile first, then desktop/tablet) */
@media (min-width: 768px) {
    body {
        flex-direction: row;
    }
}

/* Sidebar Styling - Mobile first (Fixed/Overlay) */
#sidebar {
    position: fixed; /* Overlay on mobile */
    top: 0;
    left: 0;
    width: 80%; /* Takes most of the screen */
    max-width: 16rem; /* Max width for consistency */
    height: 100vh;
    background-color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.4); 
    padding: 1rem;
    overflow-y: auto;
    z-index: 50; /* Above the viewer */
    transform: translateX(-100%); /* Start hidden off-screen */
    transition: transform 0.3s ease-in-out;
}

#sidebar.sidebar-open {
    transform: translateX(0); /* Move into view */
}

@media (min-width: 768px) {
    #sidebar {
        position: relative; /* Back to normal flow */
        width: 16rem; /* md:w-64 */
        max-width: none;
        height: 100vh;
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); 
        transform: translateX(0); /* Always visible on desktop */
    }
}

/* Sidebar Title */
.tour-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #eba123;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eba123;
    padding-bottom: 0.5rem;
}

/* Category Title */
.room-category-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #242b35;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #eba123; /* border-indigo-200 */
    padding-bottom: 0.25rem;
}

/* Room Item (Button) */
.room-item {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* space-x-3 */
    padding: 0.5rem;
    margin: 0.25rem 0;
    background-color: #f2f2f2; /* bg-gray-50 */
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2); /* shadow-sm */
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.room-item:hover {
    background-color: #ffcfd6; /* hover:bg-indigo-100 */
}

.room-item img {
    width: 4rem; /* w-16 */
    height: 3rem; /* h-12 */
    object-fit: cover;
    border-radius: 0.25rem;
}

.room-item span {
    font-size: 0.875rem;
    font-weight: 700;
    color: #242b35;
}

/* Main Viewer Area */
#main-viewer {
    flex-grow: 1;
    position: relative;
    height: 100%;
}

/* Viewer Container and Canvas */
#viewer-container {
    width: 100%;
    height: 100%;
    cursor: grab;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.06); /* shadow-inner */
}

#viewer-container:active {
    cursor: grabbing;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Current Room Display */
#current-room-name {
    position: absolute;
    top: 1rem;
    right: 1rem; /* Adjusted position to avoid clash with menu button */
    background-color: rgba(0, 0, 0, 0.75); /* bg-gray-900 with opacity */
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); /* shadow-lg */
    z-index: 20;
    transition: opacity 0.3s;
}

/* Coordinate Display (NEW) */
#coord-display {
    position: absolute;
    top: 5rem; /* Placed below #current-room-name (1rem + 3rem height) */
    right: 1rem; 
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 20;
    user-select: none;
    pointer-events: none; /* Allows clicks to pass through to the viewer */
    display: none;
    /* display: block or none; Hide, can be toggled later if desired */
}

/* Loading Overlay */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.loading-visible {
    opacity: 1 !important;
}

/* Hamburger Icon Styles */
#menu-toggle-btn {
    position: absolute;
    top: 1rem;
    left: 1rem; 
    width: 40px;
    height: 40px;
    background-color: rgba(17, 24, 39, 0.75);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    z-index: 30; 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

#menu-toggle-btn svg {
    display: block;
    width: 24px;
    height: 24px;
}

/* Scrollbar */
/* Style the entire scrollbar */
::-webkit-scrollbar {
  width: 12px; /* Set width for vertical scrollbar */
  height: 12px; /* Set height for horizontal scrollbar */
}

/* Style the scrollbar track */
::-webkit-scrollbar-track {
  background: #a14f02;
}

/* Style the scrollbar thumb */
::-webkit-scrollbar-thumb {
  background: #eba123;
}

/* Style the scrollbar thumb on hover */
::-webkit-scrollbar-thumb:hover {
  background: #ffdd44;
}

/* Definición del Punto de Mira */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px; /* Tamaño total del crosshair */
    height: 20px;
    /* Centrar perfectamente usando transform */
    transform: translate(-50%, -50%); 
    pointer-events: none; /* Asegura que no bloquee los clics */
    z-index: 20; /* Asegura que esté por encima de todo lo demás */
}

/* Líneas que forman la cruz */
#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background-color: white; /* Color blanco, puedes cambiarlo */
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); /* Sombra para resaltar */
}

/* Línea horizontal */
#crosshair::before {
    width: 100%;
    height: 2px;
    top: 50%;
    margin-top: -1px; /* Ajuste para centrar */
}

/* Línea vertical */
#crosshair::after {
    width: 2px;
    height: 100%;
    left: 50%;
    margin-left: -1px; /* Ajuste para centrar */
}


@media (min-width: 768px) {
    #menu-toggle-btn {
        display: none; /* Hide button on desktop */
    }
    #current-room-name {
        /* On desktop, the name goes back to the left since the button is gone */
        left: 1rem;
        right: auto;
    }
    #coord-display {
        /* On desktop, position relative to the left-side room name */
        top: 5rem;
        left: 1rem;
        right: auto;
    }
}
