/* Butler AI - Stylesheet */

/* Dark Mode (Default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0A0A0A;
    --bg-secondary: #151515;
    --bg-tertiary: #1E1E1E;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-tertiary: #6B6B6B;
    --accent: rgb(133, 88, 185);
    --border: #2A2A2A;
    --hover: #252525;

    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', sans-serif;
}

/* Light Mode */
[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --bg-tertiary: #E8E8E8;
    --text-primary: #0A0A0A;
    --text-secondary: #404040;
    --text-tertiary: #6B6B6B;
    --accent: rgb(133, 88, 185);
    --border: #E0E0E0;
    --hover: #F0F0F0;
}

/* Light mode specific adjustments */
[data-theme="light"] header {
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .hero h1 {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .table-wrapper::after {
    background: linear-gradient(to right, transparent, var(--bg-primary) 30%);
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent selection on UI elements */
button,
.logo,
.section-label {
    -webkit-user-select: none;
    user-select: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    backdrop-filter: blur(8px);
    background: rgba(10, 10, 10, 0.8);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Theme Toggle Switch (Cursor-style) */
.theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--hover);
    border-color: var(--text-tertiary);
}

.theme-toggle:active .theme-toggle-slider {
    width: 26px;
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--text-primary);
    border-radius: 11px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .theme-toggle-slider {
    transform: translateX(24px);
    background: var(--text-primary);
}

[data-theme="dark"] .theme-toggle {
    background: var(--bg-tertiary);
}

[data-theme="light"] .theme-toggle {
    background: var(--bg-tertiary);
}

.theme-icon {
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
    user-select: none;
}

/* Add smooth color transitions for the toggle */
.theme-toggle,
.theme-toggle-slider {
    will-change: transform, background-color;
}

/* Sections */
section {
    padding: 120px 0;
    border-bottom: 1px solid var(--border);
}


.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 24px;
    font-weight: 600;
}

.section-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
}

/* Hero */
.hero {
    padding: 200px 0 160px;
    text-align: center;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 48px;
}

.hero .tagline {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 16px;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--text-tertiary);
}

.card-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.card-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 48px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 0.9rem;
}

thead {
    border-bottom: 1px solid var(--border);
}

th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

td {
    padding: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

/* Highlight */
.highlight {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    padding: 24px;
    margin: 32px 0;
    border-radius: 4px;
}

.highlight-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: 16px 0;
}

/* Stats */
.stat {
    text-align: center;
    padding: 32px 24px;
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* List */
ul,
ol {
    margin-left: 24px;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    margin-left: 0;
}

.feature-list li {
    padding-left: 24px;
    position: relative;
}

.feature-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Button */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent);
    color: var(--text-primary);
    border-radius: 6px;
    font-weight: 500;
    transition: opacity 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    min-height: 44px;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

/* Touch-friendly */
@media (hover: none) and (pointer: coarse) {

    a,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-links a,
    .mobile-nav a {
        padding: 12px 0;
    }
}

/* Metric Box */
.metric-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}

.metric-box .label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.metric-box .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.metric-box .description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Comparison */
.comparison-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

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

.comparison-label {
    font-weight: 500;
}

.comparison-value {
    font-family: var(--font-mono);
    color: var(--accent);
}

/* Quote */
.quote {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--text-secondary);
    margin: 48px 0;
    padding: 32px;
    border-left: 3px solid var(--border);
}

/* Footer */
footer {
    padding: 48px 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 24px;
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
    z-index: 999;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    margin-bottom: 16px;
}

.mobile-nav a {
    color: var(--text-secondary);
    font-size: 1rem;
    display: block;
    padding: 8px 0;
}

/* Table Responsive */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.table-wrapper table {
    min-width: 600px;
}

/* Scroll indicator for tables on mobile */
@media (max-width: 768px) {
    .table-wrapper {
        box-shadow: inset -10px 0 10px -10px rgba(255, 255, 255, 0.1);
    }

    .table-wrapper::after {
        content: "→ Vuốt để xem thêm";
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(to right, transparent, var(--bg-primary) 30%);
        padding: 8px 16px 8px 32px;
        color: var(--text-tertiary);
        font-size: 0.75rem;
        pointer-events: none;
        opacity: 1;
        transition: opacity 0.3s;
    }

    .table-wrapper.scrolled::after {
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 120px 0 80px;
    }

    .hero h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 1.1rem;
        padding: 0 16px;
    }

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

    .grid,
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .nav-links {
        display: none;
    }

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

    section {
        padding: 60px 0;
    }

    .container,
    .container-narrow {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .card {
        padding: 20px;
    }

    .metric-box {
        padding: 20px;
    }

    .metric-box .value {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .quote {
        font-size: 1.2rem;
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 8px;
    }

    .highlight {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

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

    .metric-box .value {
        font-size: 1.8rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    body {
        font-size: 14px;
    }
}

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

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Performance optimization for mobile */
@media (max-width: 768px) {
    * {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

