/* ===========================================
   PhysicsVN - Design System & Main Styles
   Website học Vật lý trực quan cho cấp 3 & đại học
   =========================================== */

/* ============ CSS VARIABLES ============ */
:root {
    /* Colors - Light Mode - Orange/Amber Theme for Physics */
    --primary: #f97316;
    --primary-light: #fb923c;
    --primary-dark: #ea580c;
    --secondary: #ef4444;
    --accent: #eab308;
    --accent-light: #facc15;

    --background: #fffbf5;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    --border: #e7e5e4;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    --gradient-accent: linear-gradient(135deg, #eab308 0%, #f97316 100%);
    --gradient-hero: linear-gradient(135deg, #f97316 0%, #dc2626 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 40px rgb(249 115 22 / 0.3);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --background: #1c1917;
    --surface: #292524;
    --surface-elevated: #44403c;
    --text: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    --border: #44403c;
    --shadow-glow: 0 0 40px rgb(249 115 22 / 0.4);
}

/* ============ RESET & BASE ============ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition), color var(--transition);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============ TYPOGRAPHY ============ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

/* ============ LAYOUT ============ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.section {
    padding: var(--space-3xl) 0;
}

/* ============ HEADER & NAVIGATION ============ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    background-color: rgb(255 255 255 / 0.9);
}

[data-theme="dark"] .header {
    background-color: rgb(41 37 36 / 0.9);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 1.75rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-sm) 0;
    position: relative;
    transition: color var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: rotate(15deg);
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

/* ============ HERO SECTION ============ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 70px;
    background: var(--background);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 150%;
    background: var(--gradient-primary);
    opacity: 0.05;
    border-radius: 50%;
    filter: blur(100px);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.hero-text {
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--gradient-primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-lg);
}

.hero-title .highlight {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.hero-visual {
    position: relative;
    z-index: 1;
}

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.hero-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition);
}

.hero-card:hover::before {
    opacity: 1;
}

.formula-showcase {
    text-align: center;
}

.formula-showcase h3 {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-lg);
}

.formula-item {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.formula-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.formula-item .katex {
    font-size: 1.5rem !important;
}

.formula-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgb(249 115 22 / 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgb(249 115 22 / 0.5);
    color: white;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-elevated);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============ TOPICS SECTION ============ */
.topics {
    background: var(--background);
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto var(--space-3xl);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
}

.topic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.topic-card:hover::before {
    transform: scaleX(1);
}

.topic-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: var(--space-lg);
    color: white;
}

.topic-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.topic-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
}

.topic-count {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
}

/* ============ FEATURES SECTION ============ */
.features {
    background: var(--surface);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.feature-card {
    text-align: center;
    padding: var(--space-xl);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    background: var(--background);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all var(--transition);
}

.feature-card:hover .feature-icon {
    background: var(--gradient-primary);
    transform: scale(1.1) rotate(5deg);
}

.feature-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-sm);
}

.feature-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ============ CTA SECTION ============ */
.cta {
    background: var(--gradient-hero);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 60%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(80px);
}

.cta-content {
    position: relative;
    z-index: 1;
}

.cta h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.cta p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    margin-bottom: var(--space-xl);
}

.cta .btn-primary {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cta .btn-primary:hover {
    background: var(--background);
}

/* ============ FOOTER ============ */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.footer-brand {
    max-width: 300px;
}

.footer-brand .logo {
    margin-bottom: var(--space-md);
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    color: var(--text);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============ CONTENT PAGE STYLES ============ */
.page-header {
    padding: calc(70px + var(--space-3xl)) 0 var(--space-3xl);
    background: var(--gradient-primary);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.page-header h1 {
    color: white;
    font-size: 3rem;
    position: relative;
    z-index: 1;
}

.page-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    margin-top: var(--space-md);
    position: relative;
    z-index: 1;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-lg);
    position: relative;
    z-index: 1;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.8);
}

.breadcrumb a:hover {
    color: white;
}

.breadcrumb span {
    color: rgba(255, 255, 255, 0.6);
}

/* Content Section */
.content-section {
    padding: var(--space-3xl) 0;
}

.formula-grid {
    display: grid;
    gap: var(--space-xl);
}

.formula-category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.formula-category-header {
    background: var(--gradient-primary);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.formula-category-header h2 {
    color: white;
    font-size: 1.25rem;
}

.formula-category-body {
    padding: var(--space-xl);
}

.formula-box {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition);
}

.formula-box:last-child {
    margin-bottom: 0;
}

.formula-box:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.formula-box h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.formula-box .math {
    display: block;
    text-align: center;
    padding: var(--space-md) 0;
    font-size: 1.25rem;
}

.formula-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--space-sm);
}

/* Theorem & Example Boxes */
.theorem-box {
    background: linear-gradient(135deg, rgb(249 115 22 / 0.05) 0%, rgb(239 68 68 / 0.05) 100%);
    border: 1px solid var(--primary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
}

.theorem-box h4 {
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.example-box {
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-md);
    border-left: 3px solid var(--accent);
}

.example-box h4 {
    color: var(--accent);
    font-size: 0.875rem;
    margin-bottom: var(--space-sm);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .topics-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

/* Floating animation for decorative elements */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}