:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161f;
    --accent-primary: #7c5cff;
    --accent-secondary: #a78bfa;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --accent-green: #22c55e;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --glow-purple: rgba(124, 92, 255, 0.4);
    --glow-pink: rgba(236, 72, 153, 0.3);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(10, 10, 15, 0.8);
    --shadow: rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    --gradient-dark: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-subtle: rgba(0, 0, 0, 0.1);
    --border: rgba(0, 0, 0, 0.1);
    --glow-purple: rgba(124, 92, 255, 0.3);
    --glow-pink: rgba(236, 72, 153, 0.2);
    --card-bg: rgba(0, 0, 0, 0.02);
    --card-border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --shadow: rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.nav.scrolled,
body:not([data-page="home"]) .nav,
[data-theme="light"] .nav {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav.scrolled {
    padding: 12px 0;
}

body.admin-bar .nav {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .nav {
        top: 46px;
    }
}

.nav .container.nav-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
}

.nav-logo svg {
    width: 32px;
    height: 32px;
}

.nav-logo .logo-icon {
    position: relative;
    width: 32px;
    height: 32px;
}

.nav-logo .logo-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    border-radius: 10px;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.nav-logo:hover .logo-icon::after {
    opacity: 0.5;
}

.nav-logo span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 24px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-pink));
    transition: width 0.3s ease;
}

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

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

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

.nav-user-menu {
    position: relative;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 8px 4px 4px;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-user:hover,
.nav-user.active,
.nav-user[aria-expanded="true"] {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-user[hidden],
[data-auth-link][hidden] {
    display: none;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 13px;
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-card);
    box-shadow: 0 24px 70px var(--shadow);
    backdrop-filter: blur(20px);
}

.nav-user-dropdown[hidden] {
    display: none;
}

.nav-user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.nav-user-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.nav-user-summary strong,
.nav-user-summary span {
    display: block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-summary strong {
    color: var(--text-primary);
    font-size: 14px;
}

.nav-user-summary span {
    color: var(--text-muted);
    font-size: 12px;
}

.nav-user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-user-dropdown a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-user-dropdown a svg {
    color: var(--accent-secondary);
}

.nav-user-dropdown .nav-user-logout {
    margin-top: 4px;
    color: #f87171;
}

.nav-user-dropdown .nav-user-logout svg {
    color: #f87171;
}

.nav-cta {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-cta::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.5s ease;
}

.nav-cta:hover::before {
    left: 100%;
}

.nav-cta:hover,
.nav-cta.active {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-purple);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #ffffff;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
}

.icon-muted {
    opacity: 0.3;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 1120px) {
    .nav .container.nav-inner {
        gap: 14px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-link {
        padding: 8px 10px;
    }

    .nav-cta {
        padding: 10px 14px;
    }
}

@media (max-width: 1024px) {
    .nav-links {
        display: none;
        position: absolute;
        top: calc(100% + 16px);
        left: 24px;
        right: 24px;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 16px;
        background: var(--nav-bg);
        border: 1px solid var(--border-subtle);
        border-radius: 16px;
        backdrop-filter: blur(20px);
        box-shadow: 0 20px 60px var(--shadow);
    }

    body.nav-open .nav-links {
        display: flex;
    }

    .nav-links li a {
        display: block;
        padding: 12px 4px;
    }

    .nav-links a::after {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.footer {
    border-top: 1px solid var(--border-subtle);
    padding: 28px 0;
    background: var(--bg-primary);
}

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

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-logo span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

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

.footer-copy {
    color: var(--text-muted);
    font-size: 13px;
}

.cf-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100;
    font-family: inherit;
}

.cf-chat-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--gradient-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 40px rgba(124, 58, 237, 0.34);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cf-chat-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 52px rgba(124, 58, 237, 0.42);
}

.cf-chat-trigger-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
}

.cf-chat-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(380px, calc(100vw - 48px));
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: var(--bg-card);
    box-shadow: 0 24px 80px var(--shadow);
}

.cf-chat-panel[hidden] {
    display: none;
}

.cf-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(236, 72, 153, 0.14));
    border-bottom: 1px solid var(--border-subtle);
}

.cf-chat-header strong,
.cf-chat-header span {
    display: block;
}

.cf-chat-header strong {
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
}

.cf-chat-header span {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 3px;
}

.cf-chat-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.cf-chat-messages {
    max-height: 300px;
    padding: 18px;
    display: grid;
    gap: 12px;
    overflow-y: auto;
}

.cf-chat-message {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.cf-chat-message.bot {
    justify-self: start;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-top-left-radius: 4px;
}

.cf-chat-message.user {
    justify-self: end;
    background: var(--gradient-primary);
    color: #fff;
    border-top-right-radius: 4px;
}

.cf-chat-quick {
    padding: 0 18px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cf-chat-quick button {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.cf-chat-quick button:hover {
    color: var(--text-primary);
    border-color: rgba(124, 92, 255, 0.36);
}

.cf-chat-form {
    display: grid;
    grid-template-columns: 1fr 42px;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.cf-chat-form input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 14px;
    font: inherit;
    outline: none;
}

.cf-chat-form input:focus {
    border-color: rgba(124, 92, 255, 0.62);
}

.cf-chat-form button {
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--gradient-primary);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

body.admin-bar .cf-chat-widget {
    bottom: 24px;
}

@media (max-width: 640px) {
    .cf-chat-widget {
        right: 16px;
        bottom: 16px;
        left: 16px;
    }

    .cf-chat-trigger {
        width: 100%;
        justify-content: center;
    }

    .cf-chat-panel {
        right: 0;
        left: 0;
        width: auto;
        bottom: 66px;
    }

    .cf-chat-message {
        max-width: 94%;
    }
}

@media (max-width: 640px) {
    .nav .container.nav-inner {
        padding: 0 16px;
    }

    .nav-logo span {
        font-size: 18px;
    }

    .nav-actions {
        gap: 6px;
    }

    .nav-user-dropdown {
        right: -44px;
        width: min(240px, calc(100vw - 32px));
    }

    .nav-link {
        display: none;
    }

    .nav-cta {
        padding: 8px 12px;
        font-size: 13px;
    }

    .footer-inner,
    .footer-links {
        flex-direction: column;
    }
}


@media (max-width: 640px) {
    .nav {
        padding: 10px 0;
    }

    .nav.scrolled {
        padding: 8px 0;
    }

    .nav .container.nav-inner {
        justify-content: space-between;
        gap: 8px;
        padding: 0 12px;
    }

    .nav-logo {
        min-width: 0;
        gap: 8px;
        font-size: 18px;
    }

    .nav-logo .logo-icon,
    .nav-logo svg {
        width: 28px;
        height: 28px;
    }

    .nav-actions {
        margin-left: auto;
        gap: 4px;
    }

    .nav-cta {
        padding: 8px 10px;
        border-radius: 9px;
        font-size: 12px;
        line-height: 1;
    }

    .theme-toggle,
    .mobile-menu-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 0;
        border-radius: 9px;
    }

    .nav-links {
        top: calc(100% + 10px);
        left: 12px;
        right: 12px;
        padding: 10px;
        border-radius: 14px;
    }

    .footer {
        padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
    }

    .footer-inner,
    .footer-links {
        align-items: center !important;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        gap: 14px;
    }

    .footer-links {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        gap: 10px 16px;
    }

    .footer-links li {
        display: inline-flex;
    }

    .footer-copy {
        max-width: 260px;
        line-height: 1.6;
    }

    .cf-chat-widget {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: auto;
        width: auto;
    }

    .cf-chat-trigger {
        width: 54px;
        min-width: 54px;
        height: 54px;
        min-height: 54px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
        box-shadow: 0 14px 34px rgba(124, 58, 237, 0.36);
    }

    .cf-chat-trigger > span:not(.cf-chat-trigger-icon) {
        display: none;
    }

    .cf-chat-trigger-icon {
        width: 54px;
        height: 54px;
        background: transparent;
    }

    .cf-chat-trigger-icon svg {
        width: 24px;
        height: 24px;
    }

    .cf-chat-panel {
        right: 0;
        left: auto;
        bottom: 66px;
        width: min(360px, calc(100vw - 32px));
    }
}

@media (max-width: 420px) {
    .nav-logo span {
        display: none;
    }

    .nav-cta {
        padding: 8px 9px;
    }

    .footer-links {
        gap: 8px 14px;
    }
}
