/**
 * OpenClaw Wiki - Stylesheet
 * Dark theme with amber accents
 */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-amber: #f59e0b;
    --accent-amber-dark: #d97706;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-purple: #a855f7;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-rose: #f43f5e;
    --accent-indigo: #6366f1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --transition: all 0.2s ease;
}

/* Light theme */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

body.light-theme .header {
    background: rgba(248, 250, 252, 0.85);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--accent-amber), var(--accent-amber-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo-text h1 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Navigation */
.nav-desktop {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

@media (min-width: 768px) {
    .nav-desktop {
        display: flex;
    }
}

.nav-link {
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

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

.nav-link.active {
    color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.1);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-lang, .btn-theme, .btn-github, .btn-menu {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-lang:hover, .btn-theme:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-github {
    display: none;
    border: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .btn-github {
        display: flex;
    }
}

.btn-github:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-menu {
    display: flex;
}

@media (min-width: 768px) {
    .btn-menu {
        display: none;
    }
}

.icon {
    font-size: 1rem;
    line-height: 1;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 99;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu .nav-link {
    padding: 0.75rem 1rem;
}

/* Main */
.main {
    flex: 1;
}

/* Hero Section */
.hero {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, transparent 100%);
    padding: 4rem 0;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 9999px;
    color: var(--accent-amber);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .hero-title {
        font-size: 4rem;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 48rem;
    margin: 0 auto 3rem;
}

/* Stats */
.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.stat-card {
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    min-width: 120px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-value.text-amber { color: var(--accent-amber); }
.stat-value.text-blue { color: var(--accent-blue); }
.stat-value.text-green { color: var(--accent-green); }
.stat-value.text-purple { color: var(--accent-purple); }

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Search Section */
.search-section {
    position: sticky;
    top: 4rem;
    z-index: 50;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

body.light-theme .search-section {
    background: rgba(248, 250, 252, 0.9);
}

.search-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .search-row {
        flex-direction: row;
    }
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-amber);
    background: var(--bg-card-hover);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-amber);
    border-color: var(--accent-amber);
    color: #000;
}

/* Content Section */
.content-section {
    padding: 3rem 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

body.light-theme .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-featured {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(234, 88, 12, 0.05));
    border-color: rgba(245, 158, 11, 0.2);
}

.card-featured:hover {
    border-color: rgba(245, 158, 11, 0.4);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-copy, .btn-visit {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-copy:hover, .btn-visit:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

body.light-theme .tag {
    background: #f1f5f9;
}

.tag-outline {
    background: transparent;
    border: 1px solid var(--border-color);
}

/* Category Section */
.category-section {
    margin-bottom: 2rem;
}

.category-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 0;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.category-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.bg-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.bg-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.bg-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.bg-cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.bg-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.bg-green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.bg-rose { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.bg-indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.bg-pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.category-count {
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.category-arrow {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.category-section.collapsed .category-arrow {
    transform: rotate(-90deg);
}

.category-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-section.collapsed .category-content {
    max-height: 0;
}

/* No Results */
.no-results {
    padding: 4rem 0;
    text-align: center;
}

.no-results-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-results h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

@media (min-width: 640px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo {
    font-size: 1.5rem;
}

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

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

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

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

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

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    z-index: 1000;
    display: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .cookie-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cookie-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cookie-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Mobile Cookie Banner Fix */
@media (max-width: 639px) {
    .cookie-banner {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .cookie-actions {
        width: 100%;
    }
    
    .cookie-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--accent-amber);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-amber-dark);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-outline:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: var(--accent-green);
}

/* Page Content Styles */
.page-content {
    max-width: 768px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
}

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.content-card section {
    margin-bottom: 1.5rem;
}

.content-card section:last-child {
    margin-bottom: 0;
}

.content-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.content-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.content-card p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.content-card ul {
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.content-card li {
    margin-bottom: 0.5rem;
}

/* Contact Form */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-amber);
    background: var(--bg-card-hover);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--accent-amber);
    margin-bottom: 1rem;
}

/* Alert Messages */
.alert {
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-align: center;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Selection */
::selection {
    background: rgba(245, 158, 11, 0.3);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* reCAPTCHA Badge Styling */
.grecaptcha-badge {
    visibility: hidden !important;
}
