/* Zchat v3.1 - Extended UI Styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --bg-card: rgba(26, 26, 36, 0.8);
    --color-primary: #ec4899;
    --color-secondary: #8b5cf6;
    --color-accent: #22d3ee;
    --color-gold: #fbbf24;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.1);
    --gradient-primary: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    --font: 'Outfit', sans-serif;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

[hidden] {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 200;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
}

.logo-emoji {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
    background: rgba(236, 72, 153, 0.1);
}

.nav-icon {
    font-size: 1.1rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.energy-display {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-full);
}

.energy-icon {
    color: var(--color-accent);
}

.energy-count {
    font-weight: 600;
    color: var(--color-accent);
    min-width: 30px;
    text-align: center;
}

.energy-buy-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-accent);
    color: var(--bg-primary);
    font-weight: 700;
    cursor: pointer;
}

.user-menu {
    position: relative;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-primary);
}

.user-name {
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 200px;
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: rgba(236, 72, 153, 0.1);
    color: var(--text-primary);
}

.dropdown-item.premium {
    color: var(--color-gold);
}

.dropdown-item.danger {
    color: #ef4444;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.btn-gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(236, 72, 153, 0.1);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
}

.mobile-nav {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 199;
}

.mobile-nav-link {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
}

.mobile-nav-link.active {
    background: rgba(236, 72, 153, 0.1);
    color: var(--color-primary);
}

/* Main Content */
.main-container {
    padding-top: 70px;
    min-height: 100vh;
}

.section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header-large {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header-large h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header-large p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
}

.see-all-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    min-height: calc(100vh - 150px);
    gap: 3rem;
    padding: 2rem 0;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
}

.floating-cards {
    display: flex;
    gap: 1rem;
    perspective: 1000px;
}

.floating-card {
    width: 160px;
    height: 220px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: float 6s ease-in-out infinite;
    animation-delay: var(--delay);
}

.floating-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-20px) rotate(2deg);
    }
}

/* Featured Grid */
.featured-section {
    margin-top: 4rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Preview Chats */
.preview-chats-section {
    margin-top: 4rem;
}

.preview-badge {
    background: rgba(236, 72, 153, 0.2);
    color: var(--color-primary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.preview-chats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.preview-chat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.preview-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preview-chat-header img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.preview-char-name {
    font-weight: 600;
    display: block;
}

.preview-char-anime {
    font-size: 0.75rem;
    color: var(--color-primary);
}

.preview-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-msg {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    max-width: 85%;
}

.preview-msg.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
}

.preview-msg.assistant {
    background: var(--bg-tertiary);
}

.preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-chat-card:hover .preview-overlay {
    opacity: 1;
}

.lock-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Gallery */
.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.sort-options label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.select-input,
.select-input-sm {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.select-input-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Characters Grid */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.character-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.2);
}

.character-image-wrapper {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.character-card:hover .character-image {
    transform: scale(1.05);
}

.character-popularity {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--color-accent);
}

.character-info {
    padding: 1rem;
}

.character-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.character-anime {
    color: var(--color-primary);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.character-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.character-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.25rem 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--color-secondary);
}

.character-cta {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.character-cta .btn-primary {
    width: 100%;
    justify-content: center;
}

.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Create Section */
.create-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card h3 {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    display: block;
    margin-top: 0.25rem;
}

.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selectable-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.selectable-tag.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.personality-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.image-upload-area:hover {
    border-color: var(--color-primary);
}

.upload-icon {
    font-size: 3rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
}

.generate-image-option {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.create-notice {
    text-align: center;
    padding: 1rem;
    color: var(--color-accent);
}

.create-preview {
    position: sticky;
    top: 90px;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.preview-card-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.preview-card-info {
    padding: 1rem;
}

.preview-card-info h4 {
    margin-bottom: 0.25rem;
}

.preview-card-info span {
    color: var(--color-primary);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Chats Section */
.chats-container {
    max-width: 800px;
    margin: 0 auto;
}

.login-required-card {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.big-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.login-required-card h3 {
    margin-bottom: 0.5rem;
}

.login-required-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.chats-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Store Section */
.store-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.store-tab {
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.store-tab:hover,
.store-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.store-content {
    max-width: 1000px;
    margin: 0 auto;
}

.current-energy-card {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.energy-display-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.energy-icon-large {
    font-size: 2.5rem;
}

.energy-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-accent);
}

.energy-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.energy-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.energy-package {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.energy-package:hover {
    border-color: var(--color-accent);
    transform: translateY(-4px);
}

.energy-package.popular {
    border-color: var(--color-primary);
    background: rgba(236, 72, 153, 0.05);
}

.energy-package.ultra {
    border-color: var(--color-gold);
}

.package-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}

.package-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.package-price {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.package-value {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.package-savings {
    font-size: 0.75rem;
    color: #22c55e;
    margin-bottom: 0.75rem;
}

/* Plans */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    transition: all 0.2s;
}

.plan-card.pro {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.plan-card.unlimited {
    border-color: var(--color-gold);
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    padding: 0.25rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.plan-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.plan-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.plan-price {
    font-size: 2rem;
    font-weight: 700;
}

.plan-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.plan-features li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.plan-card button {
    width: 100%;
}

.plans-comparison {
    margin-top: 3rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

/* Extras */
.extras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.extra-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.extra-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.extra-card h4 {
    margin-bottom: 0.5rem;
}

.extra-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.extra-price {
    font-weight: 600;
    color: var(--color-accent);
}

/* Settings */
.settings-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.settings-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    height: fit-content;
}

.settings-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.settings-link:hover,
.settings-link.active {
    background: rgba(236, 72, 153, 0.1);
    color: var(--color-primary);
}

.settings-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.settings-panel h3 {
    margin-bottom: 1.5rem;
}

.setting-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.setting-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    outline: none;
    margin: 0.5rem 0;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-label input:checked+.toggle-slider {
    background: var(--color-primary);
}

.toggle-label input:checked+.toggle-slider::after {
    left: 26px;
    background: white;
}

.danger-zone {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.danger-zone h4 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.danger-zone .btn-danger {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.account-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
}

.account-details h4 {
    margin-bottom: 0.25rem;
}

.account-details span {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.account-plan {
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    display: inline-block !important;
    margin-top: 0.5rem;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    display: block;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Chat Fullscreen */
.chat-fullscreen {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: var(--bg-primary);
}

.chat-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100%;
}

.chat-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: background 0.2s;
}

.conversation-item:hover,
.conversation-item.active {
    background: rgba(236, 72, 153, 0.1);
}

.conversation-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
}

.chat-character-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.chat-character-info {
    flex: 1;
}

.chat-character-info h3 {
    font-size: 1rem;
}

.chat-character-anime {
    font-size: 0.8rem;
    color: var(--color-primary);
}

.chat-header-actions {
    display: flex;
    gap: 0.5rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem 1rem;
}

.input-wrapper:focus-within {
    border-color: var(--color-primary);
}

.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 120px;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.05);
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

.input-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--color-primary);
    color: white;
}

/* Auth Modal */
.auth-modal {
    max-width: 420px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.google-login-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.google-login-section p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.google-btn-container {
    display: flex;
    justify-content: center;
}

.google-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.2s;
}

.google-button:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.google-button img {
    width: 20px;
    height: 20px;
}

.auth-divider {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-benefits {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.auth-benefits h4 {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.auth-benefits ul {
    list-style: none;
}

.auth-benefits li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-security-notice {
    display: flex;
    gap: 1rem;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.auth-security-notice span {
    font-size: 1.5rem;
}

.auth-security-notice strong {
    display: block;
    margin-bottom: 0.25rem;
}

.auth-security-notice p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.terms-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.terms-notice a {
    color: var(--color-primary);
}

/* Character Modal */
.character-modal {
    max-width: 500px;
}

.modal-character-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-character-image {
    width: 120px;
    height: 160px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--color-primary);
}

.modal-character-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.modal-character-anime {
    color: var(--color-primary);
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-character-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.modal-character-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-settings {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.modal-settings h4 {
    margin-bottom: 1rem;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.personality-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.personality-option {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.personality-option:hover {
    border-color: var(--color-primary);
}

.personality-option.active {
    background: rgba(236, 72, 153, 0.2);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn-primary {
    flex: 1;
    justify-content: center;
}

.login-required-notice {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-accent);
    font-size: 0.875rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 600;
}

.toast {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 260px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.toast.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-visual {
        display: none;
    }

    .hero-stats {
        justify-content: center;
    }

    .hero-cta {
        justify-content: center;
    }

    .create-container {
        grid-template-columns: 1fr;
    }

    .create-preview {
        display: none;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .plan-card.pro {
        transform: none;
    }

    .settings-container {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .settings-link {
        white-space: nowrap;
    }

    .chat-container {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .user-name {
        display: none;
    }

    .section {
        padding: 1rem;
    }

    .section-header-large h1 {
        font-size: 1.75rem;
    }

    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .character-image-wrapper {
        height: 200px;
    }

    .gallery-controls {
        flex-direction: column;
    }

    .search-box {
        max-width: 100%;
    }

    .comparison-table {
        font-size: 0.8rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
    }
}

/* ==================== NEW STYLES v4.0 ==================== */

/* Dynamic Chat Background */
.chat-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
    z-index: 0;
}

.chat-fullscreen {
    position: relative;
}

.chat-container {
    position: relative;
    z-index: 1;
}

/* Sampler Panel */
.sampler-panel {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sampler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sampler-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.premium-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}

.sampler-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.sampler-group {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

.sampler-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.sampler-group label span {
    color: var(--color-primary);
    font-weight: 600;
}

.sampler-group input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
}

.sampler-hint {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Failover Indicator */
.failover-indicator {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* TTS Button in messages */
.tts-btn {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-size: 0.9rem;
}

.tts-btn:hover {
    opacity: 1;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-time {
    opacity: 0.7;
}

/* Action text in messages */
.message-content .action {
    color: var(--color-secondary);
    font-style: italic;
}

/* Attach button */
.attach-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.attach-btn:hover {
    opacity: 1;
}

/* Conversation time */
.conversation-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Responsive for sampler panel */
@media (max-width: 768px) {
    .sampler-controls {
        grid-template-columns: 1fr;
    }

    .sampler-panel {
        padding: 0.75rem;
    }
}