/* ================================
   Terms Page - Additional Interactions & Animations
   ================================ */

/* Copy Notification */
.copy-notification {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #27ae60;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.copy-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.copy-notification::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #27ae60;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #3498db;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #2980b9;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

/* Active Navigation Link */
.nav-link.active {
    color: #3498db;
    background: #e8f4f8;
    font-weight: 600;
    padding-left: 16px;
}

/* Animate In Effect */
.terms-article {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

.terms-article.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Highlight Hash Section */
.terms-article.highlight-hash {
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0%, 100% {
        background: #f8f9fa;
    }
    50% {
        background: #e8f4f8;
    }
}

/* Search Highlight */
.terms-article.highlight-search {
    border-left-color: #f39c12;
    background: #fff9e6;
}

/* Collapsed Article */
.terms-article.collapsed .article-content {
    display: none;
}

.terms-article.collapsed .article-header {
    cursor: pointer;
}

.terms-article.collapsed .article-header::after {
    content: '펼치기';
    display: inline-block;
    margin-left: 12px;
    font-size: 12px;
    color: #3498db;
    font-weight: 500;
}

/* Sticky Navigation (when scrolled) */
.terms-nav-section.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Clickable Article Titles */
.article-title {
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.article-title:hover {
    color: #3498db;
}

.article-title::before {
    content: '🔗';
    position: absolute;
    left: -30px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 16px;
}

.article-title:hover::before {
    opacity: 0.5;
}

/* Mobile Navigation Toggle */
.terms-nav-wrapper .nav-title.expanded::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #1a1a2e;
    margin-left: 12px;
    transition: transform 0.3s ease;
}

.terms-nav-wrapper .nav-title::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #1a1a2e;
    margin-left: 12px;
    transition: transform 0.3s ease;
}

@media (min-width: 769px) {
    .terms-nav-wrapper .nav-title::after,
    .terms-nav-wrapper .nav-title.expanded::after {
        display: none;
    }
}

/* Loading Animation */
.terms-page.loading {
    opacity: 0;
}

.terms-page {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Focus Styles for Accessibility */
.nav-link:focus,
.cta-button:focus,
.back-to-top:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Button (if added to page) */
.print-terms {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    color: #3498db;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.print-terms:hover {
    background: #3498db;
    color: #ffffff;
}

.print-terms svg {
    width: 16px;
    height: 16px;
}

/* Search Input (if added to page) */
#terms-search {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    border: 2px solid #dee2e6;
    border-radius: 50px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#terms-search:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Tooltip for Links */
.nav-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #1a1a2e;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.nav-link[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Section Dividers */
.chapter-header::before {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9);
    margin-bottom: 20px;
    border-radius: 2px;
}

/* Enhanced Hover Effects */
.terms-article:hover .article-title {
    color: #2980b9;
}

/* Gradient Text for Important Headings */
.chapter-title {
    background: linear-gradient(135deg, #1a1a2e 0%, #3498db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================
   Mobile Specific Styles
   ================================ */

@media (max-width: 768px) {
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }

    .back-to-top svg {
        width: 18px;
        height: 18px;
    }

    .article-title::before {
        left: -24px;
        font-size: 14px;
    }

    .terms-nav-wrapper .nav-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 16px;
        right: 16px;
    }

    .copy-notification {
        font-size: 12px;
        padding: 6px 12px;
    }

    .article-title::before {
        display: none;
    }
}

/* ================================
   Dark Mode Support (Optional)
   ================================ */

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* ================================
   Reduced Motion Support
   ================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}