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

:root {
    --primary-color: #00b4d8;
    --secondary-color: #0077b6;
    --accent-color: #48cae4;
    --text-dark: #023e8a;
    --text-light: #ffffff;
    --bg-light: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: var(--bg-light);
    padding-top: 140px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-gradient);
    color: var(--text-light);
    padding: 20px 0;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.back-link:hover {
    transform: translateX(-5px);
}

.back-link i {
    font-size: 18px;
}

.logo-section {
    flex: 1;
    text-align: center;
}

.language-switcher {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lang-btn i {
    font-size: 14px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.logo-image {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    padding: 40px 0 80px;
}

.terms-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    align-items: start;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    grid-column: 1 / -1;
}

.page-header h1 {
    font-size: 36px;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.page-header .subtitle {
    font-size: 18px;
    color: #666;
    font-style: italic;
}

/* Terms Content */
.terms-content {
    background: white;
    padding: 50px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.terms-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--bg-light);
}

.terms-section:last-of-type {
    border-bottom: none;
}

.terms-section h2 {
    font-size: 28px;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.terms-section h3 {
    font-size: 24px;
    color: var(--secondary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: var(--bg-gradient);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
}

.terms-section p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.terms-section strong {
    color: var(--text-dark);
    font-weight: 600;
}

.effective-date {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.intro-text {
    background: #f0f8ff;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.intro-text h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
}

.notice {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 15px;
}

.terms-section ul {
    margin: 15px 0;
    padding-left: 30px;
}

.terms-section ul li {
    margin: 10px 0;
    line-height: 1.8;
}

/* Contact Section */
.contact-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 40px;
    border-radius: 16px;
}

.contact-info-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--bg-light);
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-item i {
    font-size: 20px;
    color: var(--primary-color);
    min-width: 24px;
    margin-top: 3px;
}

.contact-item div {
    flex: 1;
}

.contact-item strong {
    display: block;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.contact-item a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.contact-item a:hover {
    text-decoration: underline;
}

.contact-item .note {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* Terms Footer */
.terms-footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--bg-light);
}

.thank-you {
    font-size: 18px;
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 20px;
}

.last-updated {
    font-size: 14px;
    color: #999;
}

/* Quick Navigation */
.quick-nav {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 160px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.quick-nav h4 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.quick-nav ul {
    list-style: none;
}

.quick-nav ul li {
    margin-bottom: 12px;
}

.quick-nav ul li a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.quick-nav ul li a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    padding-left: 20px;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--text-light);
    padding: 30px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.copyright {
    font-size: 14px;
    opacity: 0.9;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: background 0.3s ease;
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .terms-container {
        grid-template-columns: 1fr;
    }

    .quick-nav {
        position: relative;
        top: 0;
        max-height: none;
        order: -1;
    }

    .page-header {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 120px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .back-link {
        align-self: flex-start;
    }

    .logo-section {
        width: 100%;
    }

    .language-switcher {
        width: 100%;
        justify-content: center;
    }

    .terms-content {
        padding: 30px 20px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .page-header .subtitle {
        font-size: 16px;
    }

    .terms-section h2 {
        font-size: 24px;
    }

    .terms-section h3 {
        font-size: 20px;
    }

    .contact-info-box {
        padding: 20px;
    }

    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .terms-content {
        padding: 20px 15px;
    }

    .page-header {
        padding: 30px 15px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .terms-section h3 {
        font-size: 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .section-number {
        min-width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .contact-item {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .header,
    .quick-nav,
    .footer,
    .scroll-top-btn {
        display: none;
    }

    body {
        padding-top: 0;
    }

    .terms-content {
        box-shadow: none;
        padding: 0;
    }

    .terms-section {
        page-break-inside: avoid;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.quick-nav::-webkit-scrollbar {
    width: 6px;
}

.quick-nav::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 10px;
}

.quick-nav::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.quick-nav::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}