/* ========================================
   AI Agent DIY — Styles
   Dark-mode, glassmorphism, responsive
   ======================================== */

/* ---------- Custom Properties ---------- */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(255, 255, 255, 0.16);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --accent-1: #6366f1;
    /* indigo */
    --accent-2: #8b5cf6;
    /* violet */
    --accent-3: #a78bfa;
    /* lavender */
    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #a78bfa 50%, #f472b6 100%);
    --gradient-badge: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(167, 139, 250, .15));
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, .25);
    --shadow-glow: 0 0 80px 20px rgba(99, 102, 241, .12);
    --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
    --max-width: 1200px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
}

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

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    background: rgba(10, 10, 15, 0.75);
    border-bottom: 1px solid var(--border-card);
    transition: background var(--transition);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
}

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

.logo-accent {
    color: var(--accent-3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
}

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

.nav-link-gh {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    transition: background var(--transition), border-color var(--transition);
}

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

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: 140px 24px 80px;
    text-align: center;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(99, 102, 241, .18) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--gradient-badge);
    border: 1px solid rgba(99, 102, 241, .25);
    color: var(--accent-3);
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

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

.hero-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-3);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---------- Main / Controls ---------- */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 80px;
}

.controls {
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    max-width: 480px;
    margin: 0 auto 24px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 0.95rem;
    font-family: var(--font);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

.search-input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* Filters */
.filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-card);
    transition: all var(--transition);
    white-space: nowrap;
}

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

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

/* ---------- Project Grid ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ---------- Project Card ---------- */
.project-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity var(--transition);
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-card-hover);
    box-shadow: var(--shadow-card);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-name {
    font-size: 1.15rem;
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-card);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-stars svg {
    color: #facc15;
}

.card-description {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.card-tag {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, .1);
    color: var(--accent-3);
    border: 1px solid rgba(99, 102, 241, .15);
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-card);
}

.card-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    flex: 1;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-3);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .18);
    transition: all var(--transition);
}

.card-link:hover {
    background: var(--accent-1);
    color: #fff;
    border-color: var(--accent-1);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border-card);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-3);
    transition: color var(--transition);
}

.footer a:hover {
    color: var(--accent-1);
}

.footer-powered {
    margin-top: 8px;
    font-size: 0.78rem;
}

.footer-powered a {
    font-weight: 600;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.project-card {
    animation: fadeUp 0.4s ease both;
}

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

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

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .nav-container {
        padding: 0 16px;
    }

    .main {
        padding: 0 16px 60px;
    }

    .controls {
        margin-bottom: 28px;
    }

    .filter-btn {
        padding: 7px 14px;
        font-size: 0.78rem;
    }
}

@media (max-width: 400px) {
    .hero {
        padding: 110px 16px 44px;
    }

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

    .project-card {
        padding: 20px 18px 18px;
    }

    .card-name {
        font-size: 1rem;
    }
}