/* ===========================================
   Đông Triều 360 - Virtual Tour Website Styles
   =========================================== */

:root {
    /* Colors - Traditional Vietnamese */
    --primary: #8B0000;
    --primary-light: #B22222;
    --primary-dark: #5c0000;
    --accent: #D4AF37;
    --accent-light: #FFD700;

    /* Neutrals */
    --bg-dark: #0a0a0a;
    --bg-darker: #050505;
    --sidebar-bg: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-subtle: rgba(255, 255, 255, 0.5);

    /* Sidebar */
    --sidebar-width: 320px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Shadows */
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(139, 0, 0, 0.3);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100%;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===========================================
   TOUR PAGE
   =========================================== */

.tour-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger {
    position: relative;
    width: 24px;
    height: 2px;
    background: var(--text-light);
    transition: var(--transition-fast);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-light);
    transition: var(--transition-fast);
}

.hamburger::before { top: -7px; }
.hamburger::after { bottom: -7px; }

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
}

.mobile-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-light);
}

.home-link {
    font-size: 1.5rem;
    text-decoration: none;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: #0e0e0e;
    border-right: 1px solid rgba(212, 175, 55, 0.1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(160deg, rgba(139,0,0,0.18) 0%, rgba(0,0,0,0) 70%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: var(--text-light);
}

.logo-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1.3;
}

.logo-sub {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.38);
    font-weight: 400;
    margin-top: 1px;
}


/* ═══ Tour Navigation ═══ */
.tour-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0.5rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.2) transparent;
}

.tour-nav::-webkit-scrollbar { width: 3px; }
.tour-nav::-webkit-scrollbar-track { background: transparent; }
.tour-nav::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.2); border-radius: 99px; }

.nav-heading {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(212,175,55,0.5);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding: 0 0.5rem 0.6rem;
}

/* ── Groups ── */
.tour-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tour-group {
    margin-bottom: 0.35rem;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem 0.3rem;
}

.group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(212,175,55,0.12);
}

.group-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(212,175,55,0.85);
    text-transform: uppercase;
    letter-spacing: 0.13em;
    white-space: nowrap;
    flex-shrink: 0;
}

.group-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Tour Items ── */
.tour-item {
    border-radius: 5px;
    overflow: hidden;
}

.tour-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem 0.45rem 0.9rem;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: rgba(255,255,255,0.62);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.81rem;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    border-radius: 0 5px 5px 0;
    position: relative;
}

.tour-btn::before {
    content: '';
    position: absolute;
    left: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(212,175,55,0.25);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.tour-btn:hover {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.04);
}

.tour-btn:hover::before {
    background: rgba(212,175,55,0.7);
}

.tour-btn.active {
    color: #fff;
    font-weight: 500;
    border-left-color: rgba(212,175,55,0.75);
    background: rgba(255,255,255,0.04);
}

.tour-btn.active::before {
    background: var(--accent);
    box-shadow: 0 0 5px rgba(212,175,55,0.4);
}

.tour-btn-name {
    flex: 1;
    line-height: 1.35;
    /* Allow wrapping for long names */
    white-space: normal;
    word-break: break-word;
}

/* ── PDF Expand ── */
.pdf-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
}

.pdf-expand.open {
    max-height: 180px;
}

.pdf-expand-inner {
    padding: 0.15rem 0.6rem 0.45rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pdf-link {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
    padding: 0.4rem 0.6rem 0.4rem 0.8rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255,255,255,0.75);
    background: transparent;
    border: none;
    border-left: 2px solid rgba(212,175,55,0.3);
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 38px;
}

.pdf-link span {
    display: block;
    flex: 1;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

.pdf-link:hover {
    color: var(--accent-light);
    background: rgba(212,175,55,0.06);
    border-left-color: var(--accent);
}

.pdf-link .fa-file-pdf {
    color: #e74c3c;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pdf-link:hover .fa-file-pdf {
    transform: scale(1.1) rotate(-3deg);
}

/* ── PDF Drawer (slide from right) ── */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.pdf-modal.open {
    pointer-events: auto;
}

.pdf-modal-background {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pdf-modal.open .pdf-modal-background {
    opacity: 1;
}

.pdf-modal-container {
    position: absolute;
    top: 0;
    right: 0;
    width: 70%;
    max-width: 1400px;
    height: 100%;
    background: #1c1c1c;
    border-left: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.8, 0.32, 1);
}

.pdf-modal.open .pdf-modal-container {
    transform: translateX(0);
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    background: #161616;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    flex-shrink: 0;
    gap: 1rem;
}

.pdf-modal-header h3 {
    margin: 0;
    color: var(--accent);
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-zoom-controls button {
    background: transparent;
    color: var(--text-light);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.pdf-zoom-controls button:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--accent-light);
}

.pdf-zoom-controls span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

.close-pdf-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.close-pdf-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.2);
}

.close-pdf-btn svg {
    width: 16px;
    height: 16px;
}

.pdf-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.pdf-modal-body iframe,
.pdf-modal-body object,
.pdf-modal-body embed {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pdf-canvas-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #404040;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    box-sizing: border-box;
}

.pdf-page-wrapper {
    width: var(--pdf-zoom-width, 100%);
    transition: width 0.25s cubic-bezier(0.2, 0, 0, 1);
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transform-origin: top center;
}

.pdf-page-wrapper canvas {
    width: 100%;
    max-width: none;
    height: auto;
    display: block;
}

.pdf-loading,
.pdf-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    min-height: 200px;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    text-align: center;
    flex-direction: column;
}

.pdf-error a {
    color: var(--accent);
    text-decoration: underline;
}

.pdf-iframe-wrap {
    width: 100%;
    height: 100%;
}

.pdf-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .pdf-modal-container {
        width: 65%;
    }
}

@media (max-width: 640px) {
    .pdf-modal-container {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid rgba(212, 175, 55, 0.25);
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        height: 88vh; /* iOS bottom sheet style */
        transform: translateY(100%); /* Slide from bottom */
        border-radius: 20px 20px 0 0;
        transition: transform 0.4s cubic-bezier(0.32, 0.8, 0.32, 1);
    }
    
    .pdf-modal.open .pdf-modal-container {
        transform: translateY(0);
    }
    
    /* Drag handle indicator for iOS feel */
    .pdf-modal-header {
        position: relative;
        padding-top: 1.5rem;
    }
    
    .pdf-modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 10px;
    }
}


.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    background: linear-gradient(0deg, rgba(139,0,0,0.1) 0%, transparent 100%);
}

.sidebar-footer .footer-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-subtle);
    font-weight: 500;
}

.footer-icon {
    font-size: 1rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    background: var(--bg-darker);
}

.viewer-container {
    position: absolute;
    inset: 0;
}

.tour-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-darker);
}

/* Loading State */
.viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--bg-darker);
    z-index: 10;
    transition: opacity var(--transition-normal);
}

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

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.viewer-loading p {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Current Tour Info */
.current-tour-info {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    z-index: 20;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.tour-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(139, 0, 0, 0.4);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}

.tour-name {
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    font-weight: 600;
}

/* MC Narrator */
.mc-narrator {
    position: absolute;
    bottom: 100px;
    right: 1rem;
    z-index: 25;
    pointer-events: none;
    animation: mc-float 4s ease-in-out infinite;
    opacity: 0;
}

.mc-image {
    height: 220px;
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}

.visible{
    opacity: 1;
}

@keyframes mc-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

@media (max-width: 768px) {
    .mc-image {
        height: 140px;
    }
}

@media (max-width: 480px) {
    .mc-image {
        height: 110px;
    }

    .mc-narrator {
        right: 0.5rem;
    }
}

/* Viewer Controls */
.viewer-controls {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    z-index: 20;
}

.control-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--primary);
    border-color: var(--primary-light);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 1140px) {
    :root {
        --sidebar-width: 300px;
    }

    .sidebar-header {
        padding: 1.25rem;
    }

    .tour-nav {
        padding: 0.875rem;
    }

    .tour-btn {
        padding: 0.8rem 0.875rem;
    }

    .current-tour-info {
        max-width: calc(100% - 8rem);
    }
}

@media (max-width: 980px) {
    :root {
        --sidebar-width: 280px;
    }

    .logo-title {
        font-size: 0.95rem;
    }

    .tour-btn {
        font-size: 0.82rem;
    }

    .current-tour-info {
        gap: 0.6rem;
        padding: 0.65rem 0.85rem;
        max-width: calc(100% - 7rem);
    }

    .tour-name {
        font-size: 0.84rem;
    }
}

@media (max-width: 768px) {
    .tour-page {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .mobile-title {
        flex: 1;
        min-width: 0;
        margin: 0 0.75rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: min(280px, 86vw);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        padding-top: 60px;
    }

    .current-tour-info {
        top: 70px;
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
        justify-content: center;
    }

    .viewer-controls {
        bottom: 1rem;
        right: 1rem;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .pdf-expand.open {
        max-height: 220px;
    }

    .pdf-expand-inner {
        padding-right: 0.5rem;
    }

    .pdf-link {
        padding: 0.45rem 0.55rem 0.45rem 0.7rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 640px) {
    .current-tour-info {
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .tour-number {
        padding: 0.22rem 0.5rem;
    }

    .tour-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .mobile-header {
        padding: 0 0.75rem;
    }

    .mobile-title {
        font-size: 0.92rem;
    }

    .current-tour-info {
        top: 68px;
        left: 0.4rem;
        right: 0.4rem;
        gap: 0.45rem;
        padding: 0.55rem 0.65rem;
    }

    .tour-number {
        font-size: 0.68rem;
    }

    .tour-name {
        font-size: 0.76rem;
    }

    .viewer-controls {
        bottom: 0.75rem;
        right: 0.75rem;
        gap: 0.4rem;
    }

    .control-btn {
        width: 38px;
        height: 38px;
    }

    .control-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 320px) {
    .mobile-header {
        padding: 0 0.55rem;
    }

    .mobile-title {
        margin: 0 0.45rem;
        font-size: 0.84rem;
    }

    .menu-toggle,
    .home-link {
        flex-shrink: 0;
    }

    .current-tour-info {
        padding: 0.5rem 0.55rem;
    }

    .tour-name {
        font-size: 0.72rem;
    }

    .viewer-controls {
        right: 0.5rem;
        bottom: 0.5rem;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }
}

@media (min-width: 1440px) {
    :root {
        --sidebar-width: 340px;
    }

    .logo-title {
        font-size: 1.06rem;
    }

    .tour-btn {
        font-size: 0.88rem;
    }
}

@media (min-width: 1620px) {
    :root {
        --sidebar-width: 360px;
    }

    .tour-btn {
        padding: 0.95rem 1.1rem;
    }

    .tour-name {
        font-size: 0.94rem;
    }

    .current-tour-info {
        padding: 0.85rem 1.15rem;
    }
}

@media (min-width: 1980px) {
    :root {
        --sidebar-width: 390px;
    }

    .logo-title {
        font-size: 1.12rem;
    }

    .tour-btn {
        font-size: 0.96rem;
    }

    .control-btn {
        width: 48px;
        height: 48px;
    }
}

@media (min-width: 2101px) {
    :root {
        --sidebar-width: 420px;
    }

    .sidebar-header,
    .sidebar-footer {
        padding-inline: 1.75rem;
    }

    .tour-nav {
        padding: 1.25rem;
    }

    .tour-name {
        font-size: 1rem;
    }

    .current-tour-info {
        padding: 0.95rem 1.25rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}
