/* CSS Variables */
:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --sidebar-bg: #0a0a0a;
    --sidebar-text: #535353;
    --sidebar-active: #ffffff;
    --accent-color: #ffffff;
    --title-font: inherit;
    --body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    --subtitle-font: inherit;
}

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

body {
    font-family: var(--body-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.main-content {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
}

/* Page Content Transition */
#page-content {
    transition: opacity 0.3s ease;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-right: 1px solid #333;
    padding: 40px 0;
    z-index: 100;
}

.sidebar-content {
    padding: 0 30px;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    font-size: 18px;
    color: var(--sidebar-text);
    margin-bottom: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-menu li:hover {
    color: var(--sidebar-active);
}

.nav-menu li.active {
    color: var(--sidebar-active);
    font-weight: 500;
}

/* Sidebar Contact Info */
.sidebar-contact {
    position: absolute;
    bottom: 40px;
    left: 30px;
    right: 30px;
    border-top: 1px solid #333;
    padding-top: 16px;
}

.sidebar-contact .contact-name {
    font-size: 13px;
    color: var(--sidebar-active);
    font-weight: 500;
    margin-bottom: 6px;
}

.sidebar-contact .contact-item {
    font-size: 12px;
    color: var(--sidebar-text);
    margin-bottom: 4px;
    line-height: 1.4;
}

.sidebar-contact .contact-instagram {
    display: inline-block;
    margin-top: 8px;
    color: var(--sidebar-text);
    transition: color 0.3s;
}

.sidebar-contact .contact-instagram:hover {
    color: var(--sidebar-active);
}

/* Main Page Styles */
.main-page {
    width: 100%;
    min-height: 100vh;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error State */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #888;
}

.retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: transparent;
    color: #fff;
    border: 1px solid #555;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.retry-btn:hover {
    border-color: #fff;
}

/* Artwork Page Styles */
.artwork-container {
    width: 100%;
    padding: 60px 80px;
}

.artwork-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 80px;
    max-width: 1200px;
}

.artwork-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.artwork-image-placeholder {
    width: 100%;
    aspect-ratio: 16/10;
    background-color: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
    overflow: hidden;
}

.artwork-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.artwork-item:hover .artwork-image-placeholder img {
    transform: scale(1.02);
}

.placeholder-text {
    color: #555;
    font-size: 18px;
}

.artwork-info {
    padding: 5px 0;
}

.artwork-title {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-color);
    font-family: var(--title-font);
    margin-bottom: 10px;
    line-height: 1.4;
}

.artwork-details {
    font-size: 16px;
    color: #888;
    line-height: 1.6;
}

/* CV Page Styles */
.cv-container {
    width: 100%;
    padding: 60px 80px;
}

.cv-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 80px;
    max-width: 1200px;
}

.exhibition-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.exhibition-poster {
    width: 100%;
    aspect-ratio: 16/10;
    background-color: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
}

.exhibition-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-placeholder {
    color: #555;
    font-size: 18px;
}

.exhibition-info {
    padding: 5px 0;
}

.exhibition-title {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-color);
    font-family: var(--title-font);
    margin-bottom: 8px;
    line-height: 1.4;
}

.exhibition-title-ko {
    font-size: 18px;
    font-weight: 300;
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.4;
}

.exhibition-year {
    font-size: 16px;
    color: #888;
    margin-bottom: 5px;
}

.exhibition-location {
    font-size: 16px;
    color: #888;
    margin-bottom: 5px;
}

.exhibition-organizer {
    font-size: 16px;
    color: #888;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    background-color: #1a1a1a;
    margin: 2% auto;
    padding: 2rem;
    border: 1px solid #333;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.modal-content p {
    color: #888;
    margin-bottom: 1.5rem;
}

.modal-content .description {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.close-modal {
    color: #fff;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #888;
}

.detail-images {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.detail-images img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Detail Container - PowerPoint Style Split Layout */
.detail-container {
    display: flex;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    margin: 5vh auto;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Left Panel - Thumbnail Strip */
.detail-left {
    width: 180px;
    min-width: 180px;
    background-color: #111;
    border-right: 1px solid #333;
    overflow-y: auto;
    padding: 1rem 0.5rem;
}

.thumb-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thumb-item {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
}

.thumb-item:hover {
    opacity: 0.85;
}

.thumb-item.active {
    border-color: #fff;
    opacity: 1;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.5rem;
    text-shadow: 0 0 6px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Right Panel - Content */
.detail-right {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
}

.detail-main-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 1rem;
}

.main-view-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    cursor: zoom-in;
}

.main-view-desc {
    color: #aaa;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* 이미지 설명 - detail-info 영역 내 우측 표시 */
.image-desc-in-info {
    color: #aaa;
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.6;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 1rem;
}

.main-video-wrapper {
    width: 100%;
    height: 95%;
}

.main-video-wrapper iframe {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Layout: Right (50/50 side-by-side, default) */
.detail-right.layout-right {
    flex-direction: row;
}
.detail-right.layout-right .detail-main-view {
    width: 50%;
    min-width: 50%;
}

/* Layout: Fullwidth (no description) */
.detail-right.layout-fullwidth {
    flex-direction: row;
}
.detail-right.layout-fullwidth .detail-main-view {
    width: 100%;
    min-width: 100%;
}
.detail-right.layout-fullwidth .detail-info {
    display: none;
}

/* Layout: Bottom (image top, description below) */
.detail-right.layout-bottom {
    flex-direction: column;
}
.detail-right.layout-bottom .detail-main-view {
    width: 100%;
    min-width: 100%;
}
.detail-right.layout-bottom .detail-info {
    max-height: 30vh;
    overflow-y: auto;
}

/* Detail Info Section */
.detail-info {
    flex: 1;
    overflow-y: auto;
    padding-top: 1rem;
}

.detail-title {
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text-color);
    font-family: var(--title-font);
    margin-bottom: 0.6rem;
}

.detail-meta {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 1.2rem;
}

.detail-description {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.8;
}

.detail-description p {
    color: #ccc;
    margin-bottom: 0.8rem;
}

/* HTML Fullwidth Mode */
.detail-html-fullwidth {
    flex-direction: column;
}

.detail-html-content {
    flex: 1;
    padding: 1rem;
}

/* Lightbox Overlay */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 2001;
    line-height: 1;
}

.lightbox-close:hover {
    color: #888;
}

.lightbox-image-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
    z-index: 2001;
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-counter {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #888;
    font-size: 0.9rem;
    z-index: 2001;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, background-color 0.3s;
    z-index: 50;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

/* CV Pages (PDF.js 렌더링) */
.cv-pages {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.cv-page-canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-to-top:hover {
    background: #555;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #888;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .artwork-container,
    .cv-container {
        padding: 40px 50px;
    }

    .artwork-item,
    .exhibition-item {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-left {
        width: 140px;
        min-width: 140px;
    }

    .detail-right {
        padding: 1.5rem;
    }
}

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

    .main-content {
        margin-left: 0;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 20px 0;
    }

    .sidebar-content {
        padding: 0 20px;
    }

    .nav-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }

    .nav-menu li {
        margin-bottom: 0;
        font-size: 16px;
    }

    .artwork-container,
    .cv-container {
        padding: 30px 20px;
    }

    .artwork-grid,
    .cv-grid {
        gap: 50px;
    }

    .artwork-title,
    .exhibition-title {
        font-size: 18px;
    }

    .artwork-details,
    .exhibition-year,
    .exhibition-location,
    .exhibition-organizer {
        font-size: 14px;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    /* Detail split → vertical on mobile */
    .detail-container {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .detail-left {
        width: 100%;
        min-width: unset;
        height: auto;
        max-height: 120px;
        border-right: none;
        border-bottom: 1px solid #333;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.5rem;
    }

    .thumb-strip {
        flex-direction: row;
        gap: 6px;
    }

    .thumb-item {
        width: 80px;
        min-width: 80px;
        aspect-ratio: 16/10;
    }

    .detail-right {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .detail-main-view {
        width: 100%;
        min-width: unset;
    }

    .main-view-image {
        max-height: 35vh;
    }

    .detail-title {
        font-size: 1.2rem;
    }

    .detail-meta {
        font-size: 0.85rem;
    }

    /* Lightbox mobile */
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }
}
