/* --- Global Styles & Variables --- */
:root {
    --primary-red: #FF2C2C;
    --dark-red: #cc0000;
    --darker-red: #990000;
    --bg-dark: #121212;
    --bg-darker: #050505;
    --text-light: #ffffff;
    --text-gray: #b0b0b0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 180px; /* Offset for fixed header & sticky nav */
}

body {
    background-color: var(--bg-dark);
    background-image: url('bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    position: relative;
    cursor: none;
}

main {
    padding-top: 100px;
}

/* --- Custom Cursor Styles --- */
#custom-cursor { position: fixed; left: 0; top: 0; width: 32px; height: 32px; background-color: var(--primary-red); border-radius: 50%; mix-blend-mode: difference; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%); transition: width 0.3s ease, height 0.3s ease; }
.cursor-particle { position: fixed; background: var(--primary-red); border-radius: 50%; pointer-events: none; z-index: 9998; transform-origin: center; animation: spray 0.6s ease-out forwards; }
@keyframes spray { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0); } }

/* --- Dynamic Effects Styles --- */
.particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.particle { position: absolute; background: var(--primary-red); border-radius: 50%; opacity: 0.3; animation: float 15s infinite linear; }
@keyframes float { 0% { transform: translateY(100vh) rotate(0deg); opacity: 0; } 10% { opacity: 0.3; } 90% { opacity: 0.3; } 100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; } }
.loading { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-dark); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.5s ease; }
.loading.hidden { opacity: 0; pointer-events: none; }
.loader { width: 50px; height: 50px; border: 3px solid rgba(255, 44, 44, 0.3); border-top: 3px solid var(--primary-red); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.scroll-progress { position: fixed; top: 0; left: 0; width: 0%; height: 3px; background: linear-gradient(90deg, var(--primary-red), var(--darker-red)); z-index: 1001; transition: width 0.1s ease; }

/* --- Header Styles --- */
.main-header { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; position: fixed; top: 0; width: 100%; z-index: 1000; transition: all 0.3s ease; }
.main-header.scrolled { background: rgba(0, 0, 0, 0.8); box-shadow: 0 8px 32px rgba(255, 44, 44, 0.1); }
.nav-link-home { background: linear-gradient(135deg, var(--primary-red), var(--darker-red)); border-radius: 50px; color: white; padding: 0.75rem 2rem; text-decoration: none; font-weight: 600; transition: all 0.3s ease; position: relative; overflow: hidden; }
.nav-link-home::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transition: left 0.6s ease; }
.nav-link-home:hover::before { left: 100%; }
.nav-link-home:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(255, 44, 44, 0.4); }
.nav-links { list-style: none; display: flex; gap: 2rem; align-items: center; }
.nav-link { color: var(--text-light); text-decoration: none; padding: 0.5rem 1rem; position: relative; font-weight: 500; transition: all 0.3s ease; }
.nav-link::after { content: ''; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); width: 0; height: 2px; background: linear-gradient(90deg, var(--primary-red), var(--darker-red)); transition: width 0.3s ease; }
.nav-link:hover::after { width: 100%; }
.nav-link:hover { color: var(--primary-red); transform: translateY(-1px); }
.hamburger-menu { display: none; flex-direction: column; justify-content: space-around; width: 2rem; height: 2rem; background: transparent; border: none; cursor: pointer; padding: 0; z-index: 10; }
.hamburger-menu span { width: 2rem; height: 0.25rem; background: white; border-radius: 10px; transition: all 0.3s linear; position: relative; transform-origin: 1px; }
.hamburger-menu.is-active span:nth-child(1) { transform: rotate(45deg); }
.hamburger-menu.is-active span:nth-child(2) { opacity: 0; transform: translateX(20px); }
.hamburger-menu.is-active span:nth-child(3) { transform: rotate(-45deg); }

/* --- Floating Action Button Styles --- */
.floating-elements { position: fixed; top: 50%; right: 2rem; transform: translateY(-50%); display: flex; flex-direction: column; gap: 1rem; z-index: 100; }
.floating-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--glass-bg); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); color: var(--text-light); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; font-size: 1.5rem; }
.floating-btn:hover { background: var(--primary-red); transform: scale(1.1); box-shadow: 0 10px 25px rgba(255, 44, 44, 0.4); }

/* --- Footer Styles --- */
.main-footer { background: var(--bg-darker); border-top: 1px solid var(--glass-border); padding: 3rem 5%; }
.footer-container { max-width: 1400px; margin: 0 auto; }
.footer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.social-icons { display: flex; gap: 1rem; }
.social-icons a { color: var(--text-gray); border: 1px solid var(--glass-border); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.social-icons a:hover { color: var(--text-light); background-color: var(--primary-red); border-color: var(--primary-red); transform: translateY(-3px); }
.social-icons svg { width: 20px; height: 20px; }
.language-switcher { display: flex; align-items: center; gap: 0.5rem; color: var(--text-gray); font-weight: 500; }
.language-switcher svg { width: 24px; height: 24px; }
.language-switcher span { cursor: pointer; transition: color 0.3s ease; }
.language-switcher span:hover { color: var(--primary-red); }
.footer-divider { border: 0; height: 1px; background: var(--glass-border); margin-bottom: 2rem; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem; color: var(--text-gray); }
.footer-logo { height: 70px; width: auto; }
.footer-contact p { margin: 0; }
.footer-contact a { color: var(--primary-red); text-decoration: none; font-weight: 500; transition: color 0.3s ease; }
.footer-contact a:hover { color: var(--dark-red); }
.footer-copyright { text-align: right; }


/* --- START: TOS Page Specific Styles & Improvements --- */

.page-content {
    padding: 0 2rem 4rem 2rem; /* Removed top padding */
}

/* NEW: Sticky Table of Contents Navigation */
.toc-sticky-nav {
    position: sticky;
    top: 84px; /* Height of the main header */
    z-index: 999;
    background: rgba(18, 18, 18, 0.65); /* Slightly less transparent for readability */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 2rem;
    margin-bottom: 2rem; /* Space between nav and content */
}

.toc-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allows links to wrap on smaller screens */
    gap: 0.5rem 2rem; /* Row and column gap */
}

.toc-container a {
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    padding: 1rem 0.5rem;
    transition: color 0.3s ease;
    position: relative;
}

.toc-container a:hover {
    color: var(--primary-red);
}

.toc-container a::after {
    content: '';
    position: absolute;
    bottom: 0.75rem; /* Position underline */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-red);
    transition: width 0.3s ease;
}

.toc-container a:hover::after {
    width: 50%;
}


.page-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 2rem 3rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.page-container h1, .page-container h2 {
    font-family: 'Kanit', sans-serif;
    color: var(--primary-red);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.page-container h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.page-container h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
}

.page-container p, .page-container li {
    color: var(--text-gray);
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.page-container ul {
    list-style-position: inside;
    padding-left: 1rem;
}

.page-container a {
    color: var(--primary-red);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.page-container a:hover {
    text-decoration: underline;
    color: var(--dark-red);
}

/* Accessibility focus state */
.page-container a:focus, .floating-btn:focus, .nav-link:focus, .toc-container a:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
    border-radius: 4px; /* Added for clarity */
}

/* Last Updated Date */
.last-updated {
    text-align: center;
    color: var(--text-gray);
    margin-top: -1rem; /* Pull it up closer to the H1 */
    margin-bottom: 3rem;
    font-style: italic;
}

/* FAQ Section Improved Styles */
.faq-section {
    margin-top: 4rem;
}

.faq-item {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: background-color 0.3s ease;
}

.faq-item:hover {
    background-color: rgba(255, 44, 44, 0.1);
}

.faq-question {
    padding: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    display: block;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: var(--primary-red);
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--primary-red);
    transition: transform 0.3s ease;
}

.faq-item[open] > .faq-question {
    color: var(--primary-red);
}

.faq-item[open] > .faq-question::after {
    transform: translateY(-50%) rotate(45deg);
}

.faq-answer {
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    max-height: 0;
}

.faq-item[open] > .faq-answer {
    max-height: 500px;
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-gray);
}

/* --- END: TOS Page Specific Styles --- */


/* --- Responsive Styles --- */
@media (max-width: 768px) {
    html { scroll-padding-top: 100px; } /* Adjust anchor link offset for mobile */
    .main-header { padding: 1rem; }
    .main-nav { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); }
    .main-nav.is-active { display: flex; }
    .nav-links { flex-direction: column; width: 100%; padding: 1rem 0; }
    .nav-link { padding: 1.5rem; text-align: center; width: 100%; }
    .hamburger-menu { display: flex; }
    .floating-elements { display: none; }
    .footer-top, .footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 1.5rem; }
    .footer-bottom { flex-direction: column-reverse; }

    /* Hide sticky nav on mobile */
    .toc-sticky-nav {
        display: none;
    }

    /* Responsive adjustments for TOS page */
    .page-content {
        padding: 1rem;
    }
    .page-container {
        padding: 1.5rem;
    }
    .page-container h1 {
        font-size: 2rem;
    }
    .page-container h2 {
        font-size: 1.5rem;
    }
}