
/* =========================================
   1. CORE LAYOUT & VARIABLES
   ========================================= */
:root {
    --primary-color: #6c5ce7;
    --primary-hover: #5b4bc4;
    --accent-color: #a29bfe;
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.12);
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --text-dark: #2d3436;
    --text-light: #636e72;
}

[data-theme="dark"] {
    --bg-body: #0f0f12;
    --bg-card: #1e1e24;
    --text-main: #dfe6e9;
    --text-secondary: #b2bec3;
    --border-color: #2d3436;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* =========================================
   2. SIDEBAR (RESTORED)
   ========================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

[data-theme="dark"] .sidebar {
    background: #1e1e2e;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
}

.sidebar-menu { flex: 1; padding: 20px 0; }

.menu-item {
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dark);
    transition: all 0.2s;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] .menu-item { color: #ccc; }

.menu-item:hover, .menu-item.active {
    background: rgba(108, 92, 231, 0.08);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

[data-theme="dark"] .menu-item:hover, [data-theme="dark"] .menu-item.active {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.menu-item i { width: 20px; text-align: center; }

.sidebar-footer {
    padding: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* =========================================
   3. HEADER & LAYOUT FIXES (CRITICAL)
   ========================================= */
@media (min-width: 1025px) {
    .top-header {
        position: fixed;
        top: 0;
        left: 260px;
        width: calc(100% - 260px);
        height: 70px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 30px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    [data-theme="dark"] .top-header {
        background: rgba(30, 30, 46, 0.95);
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .main-container {
        margin-left: 260px;
        padding-top: 90px;
        padding-left: 30px;
        padding-right: 30px;
        padding-bottom: 40px;
        min-height: 100vh;
        width: auto;
        position: relative;
        z-index: 10;
    }
}

.mobile-toggle { display: none; }
@media (max-width: 1024px) {
    .mobile-toggle { display: block; font-size: 1.4rem; cursor: pointer; }
    .top-header {
        position: fixed; top: 0; left: 0; width: 100%; height: 70px;
        padding: 0 20px; z-index: 900; display: flex; align-items: center; justify-content: space-between;
        background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
    }
    .main-container {
        margin-left: 0; padding-top: 90px; padding-left: 20px; padding-right: 20px;
    }
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.active { transform: translateX(0); }
}

.header-right { display: flex; align-items: center; gap: 20px; }
.search-container { position: relative; display: flex; align-items: center; }
.search-container input {
    padding: 8px 16px 8px 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    width: 240px;
    transition: all 0.3s;
}
.search-container i { position: absolute; left: 14px; color: var(--text-secondary); }

/* =========================================
   4. ORIGINAL CARD STYLES & ANIMATIONS (RESTORED)
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 25px;
    width: 100%;
    max-width: 100% !important;
}

@media (min-width: 1200px) {
    .grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* Breathing Card Animation (V11) */
@keyframes cardBreatheEnter {
    0% { 
        opacity: 0; 
        transform: translateY(40px) scale(0.96);
        filter: blur(4px);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.01);
        filter: blur(0);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    
    /* Critical Animation Properties */
    opacity: 0;
    animation: cardBreatheEnter 1.0s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    transform-style: preserve-3d;
    will-change: transform;
}

/* Staggered Delays */
.card:nth-child(1) { animation-delay: 0.1s !important; }
.card:nth-child(2) { animation-delay: 0.2s !important; }
.card:nth-child(3) { animation-delay: 0.3s !important; }
.card:nth-child(4) { animation-delay: 0.4s !important; }
.card:nth-child(5) { animation-delay: 0.5s !important; }
.card:nth-child(6) { animation-delay: 0.6s !important; }
.card:nth-child(7) { animation-delay: 0.7s !important; }
.card:nth-child(8) { animation-delay: 0.8s !important; }
.card:nth-child(9) { animation-delay: 0.9s !important; }
.card:nth-child(10) { animation-delay: 1.0s !important; }
.card:nth-child(11) { animation-delay: 1.1s !important; }
.card:nth-child(12) { animation-delay: 1.2s !important; }

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    /* Transform is handled by JS tilt script usually, but we add basic hover here just in case */
}

.card-img {
    width: 100%;
    aspect-ratio: 16/9;
    background: #eee;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-img img { transform: scale(1.05); }

.card-content { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-cat { font-size: 0.75rem; color: var(--primary-color); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-main); margin-bottom: 8px; line-height: 1.4; }
.card-date { font-size: 0.8rem; color: var(--text-secondary); margin-top: auto; }

/* =========================================
   5. HERO SECTION (RESTORED & FIXED)
   ========================================= */
#hero-section {
    position: fixed !important;
    top: 0;
    left: 260px;
    right: 0;
    bottom: 0;
    height: 100vh !important;
    z-index: 0;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s, visibility 0.2s;
    background: radial-gradient(circle at 50% 50%, rgba(108, 92, 231, 0.05) 0%, transparent 70%);
}

@media (max-width: 1024px) {
    #hero-section { left: 0; position: relative !important; height: auto !important; min-height: 100vh; padding-top: 100px; }
}

.hero-content {
    text-align: center;
    max-width: 800px;
    padding: 20px;
    /* Ensure it's visible */
    opacity: 1;
    transform: translateY(-5%);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.highlight-text { color: var(--primary-color); -webkit-text-fill-color: var(--primary-color); }
.hero-subtitle { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 40px; }

.hero-search-box { margin-bottom: 30px; display: flex; justify-content: center; }
.hero-input-wrapper { position: relative; width: 500px; max-width: 100%; }
#hero-search-input {
    width: 100%; padding: 16px 20px 16px 50px; border-radius: 50px;
    border: 1px solid var(--border-color); background: var(--bg-card);
    font-size: 1.1rem; box-shadow: var(--shadow-md); color: var(--text-main);
}
.hero-search-icon { position: absolute; left: 20px; top: 18px; color: var(--text-secondary); }
#hero-search-btn {
    position: absolute; right: 8px; top: 8px; bottom: 8px; padding: 0 24px;
    border-radius: 40px; background: var(--primary-color); color: #fff; border: none; cursor: pointer;
}

.hero-tags { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.hero-tag {
    padding: 6px 16px; border-radius: 20px; background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color); cursor: pointer; transition: all 0.2s;
}
.hero-tag:hover { background: var(--primary-color); color: #fff; }

.hero-actions { display: flex; gap: 20px; justify-content: center; }

/* View Toggle Utilities */
.view-hidden {
    visibility: hidden !important;
    opacity: 0;
    pointer-events: none;
}

/* =========================================
   6. GUIDE BUTTON (RESTORED)
   ========================================= */
.guide-entry-btn {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: #fff !important;
    border: none !important;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.guide-entry-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(108, 92, 231, 0.4);
    filter: brightness(1.1);
}

/* =========================================
   7. FOOTER
   ========================================= */
.site-footer {
    margin-top: 60px;
    padding-bottom: 20px;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.hero-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 5;
}

/* =========================================
   8. RESTORED MODAL & INTERACTION STYLES
   ========================================= */

/* Modal Overlay */
.modal-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 3000; /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(8px);
}

.modal-wrap.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Box */
.modal-box {
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    background: var(--bg-card);
    border-radius: 24px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--border-color);
}

.modal-wrap.active .modal-box {
    transform: scale(1) translateY(0);
}

/* Close Button */
.m-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    color: var(--text-main);
    font-size: 1.2rem;
}

.m-close:hover {
    background: #ff7675;
    color: white;
    transform: rotate(90deg);
}

/* Modal Layout */
.modal-image-area {
    width: 55%;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.modal-content-area {
    width: 45%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    overflow-y: auto;
    position: relative;
}

/* Modal Typography */
.m-meta-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.m-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
}

.m-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--text-main);
}

.m-desc {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Favorite Button in Modal */
.m-fav-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.2s;
    color: #ccc;
}

.m-fav-btn.active {
    color: #ff7675;
    transform: scale(1.1);
}

.m-fav-btn:hover {
    transform: scale(1.1);
}

/* Ticket / QR Section */
.ticket-card {
    margin-top: auto;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

[data-theme="dark"] .ticket-card {
    background: linear-gradient(135deg, #2d3436 0%, #1e1e2e 100%);
}

.ticket-header {
    padding: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.ticket-header:hover {
    background: rgba(0,0,0,0.02);
}

.ticket-icon-box {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 15px;
    font-size: 1.2rem;
}

.ticket-text { flex: 1; }
.ticket-label { font-weight: 700; color: var(--text-main); font-size: 1rem; }
.ticket-sub { font-size: 0.8rem; color: var(--text-secondary); }

.ticket-arrow {
    transition: transform 0.3s;
    color: var(--text-secondary);
}

.ticket-card.expanded .ticket-arrow {
    transform: rotate(180deg);
}

.ticket-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ticket-card.expanded .ticket-body {
    max-height: 500px; /* Arbitrary large height */
}

.qr-panel {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.qr-header {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.qr-code-img {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    padding: 5px;
    background: #fff;
}

.typewriter-text-area {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
    min-height: 20px;
}

/* Mobile Modal Adaptation */
@media (max-width: 768px) {
    .modal-box {
        flex-direction: column;
        height: 95vh;
        width: 95%;
    }
    
    .modal-image-area {
        width: 100%;
        height: 30%;
    }
    
    .modal-content-area {
        width: 100%;
        height: 70%;
        padding: 20px;
    }
    
    .m-title { font-size: 1.5rem; }
}

/* =========================================
   9. SCROLL FIXES
   ========================================= */
body {
    overflow-y: auto !important; /* Force scroll */
    height: auto !important;
}

.main-container {
    overflow: visible !important;
    height: auto !important;
}

/* Resource ID Badge on Card */
.card-id-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 5;
    backdrop-filter: blur(4px);
    font-family: monospace;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .card-id-badge {
    opacity: 1;
}
