/* Common Styles */
body {
    scroll-behavior: smooth;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-overflow-scrolling: touch;
}

/* Layout */
.h-screen {
    height: auto;
    min-height: 100vh;
}

.flex-1 {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

.w-64 {
    transition: all 0.3s ease;
}

.w-64:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Menu Button */
#mobileMenuBtn {
    padding: 0.5rem;
    font-size: 1.5rem;
    color: #4B5563;
}

/* Navigation */
.hover\:bg-blue-50:hover {
    background-color: rgba(59, 130, 246, 0.05);
    transform: translateX(4px);
    transition: all 0.3s ease;
}

.text-blue-600 {
    position: relative;
}

.text-blue-600::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #2563eb;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.text-blue-600:hover::after {
    transform: scaleX(1);
}

/* Language Switcher */
#langToggle {
    transition: all 0.3s ease;
    position: fixed;  /* fixed로 변경 */
    top: 20px;       /* 상단에서의 거리 */
    right: 20px;     /* 오른쪽에서의 거리 */
    z-index: 1000;   /* 다른 요소들 위에 표시되도록 */
    background-color: #3B82F6;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
}

#langToggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#langToggle:active {
    transform: translateY(0);
}

/* Content Sections */
section {
    transition: opacity 0.3s ease;
}

/* Video Container */
.video-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 20px;
    width: 66.666667%;
    margin: 0 auto;
    max-width: 1200px;
}

.video-section {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
    margin-bottom: 60px;
}

.video-description {
    margin-bottom: 30px;
    text-align: center;
}

/* Images and Figures */
img {
    transition: transform 0.3s ease;
}

img:hover {
    transform: scale(1.02);
}

figcaption {
    font-style: italic;
    color: #666;
    transition: color 0.3s ease;
}

figure:hover figcaption {
    color: #2563eb;
}

/* Lists */
.list-disc li {
    transition: transform 0.2s ease;
    position: relative;
}

.list-disc li:hover {
    transform: translateX(5px);
}

/* Cards */
.shadow-lg {
    transition: all 0.3s ease;
}

.shadow-lg:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .video-container {
        grid-template-columns: 1fr; 
    }
    
    .video-section {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

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

    .ml-64, .ml-0.md\:ml-64 {
        margin-left: 0;
        padding: 0.5rem;
    }

    .grid {
        display: flex;
        flex-direction: column;
    }

    /* Typography */
    .text-3xl {
        font-size: 1.25rem;
        line-height: 1.4;
    }

    .text-lg {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Spacing */
    .p-8 {
        padding: 0.75rem;
    }

    .mb-6 {
        margin-bottom: 0.75rem;
    }

    .gap-8 {
        gap: 0.75rem;
    }

    /* Components */
    .rounded-lg {
        border-radius: 0.5rem;
    }

    .list-disc {
        padding-left: 1rem;
    }

    /* Sidebar */
    #sidebar {
        background-color: white;
        width: 85%;
        height: 100vh;
        overflow-y: auto;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
        position: fixed;
        left: -100%;
        z-index: 40;
        transition: left 0.3s ease;
    }

    #overlay {
        background-color: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
    }

    /* Media */
    img.w-full.md\:w-1\/2, .w-1\/2, .w-1\/3 {
        width: 100%;
        margin-bottom: 1rem;
    }

    .video-container {
        width: 100%;
        padding: 10px;
        margin: 1rem 0;
    }

    .video-section {
        margin-bottom: 2rem;
    }

    .video-description {
        padding: 0.75rem;
    }

    .video-section video {
        width: 100%;
    }

    /* State */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none;
    }
    
    .shadow-lg {
        box-shadow: none !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

@media (max-width: 768px) {
    #langToggle {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 14px;
    }
}

/* 사이드바 transition */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }
}

@media (max-width: 768px) {
    #mobileMenuBtn {
        position: absolute;
        left: 10px;
        top: 10px;
        z-index: 1100; /* 다른 요소보다 높은 z-index */
        padding: 10px;
        touch-action: manipulation;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%; /* 화면의 80%로 조정 */
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
    }

    #overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 900;
    }
}

/* 모바일 메뉴 및 사이드바 관련 스타일 업데이트 */
@media (max-width: 768px) {
    nav {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 0 60px; /* 좌우 버튼을 위한 여백 */
    }

    #mobileMenuBtn {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1100;
    }

    #langToggle {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1100;
    }

    nav .text-xl {
        font-size: 1rem; /* 모바일에서 폰트 크기 조정 */
    }
}