/* ============================================================
   Reflact AI Plugin Store – Global Stylesheet
   ============================================================ */

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

:root {
    --bg:         #0b0d12;
    --bg-card:    #131720;
    --bg-card2:   #1a1f2e;
    --border:     #252c3f;
    --primary:    #6366f1;
    --primary-h:  #4f51d6;
    --accent:     #06b6d4;
    --success:    #22c55e;
    --danger:     #ef4444;
    --warning:    #f59e0b;
    --text:       #e2e8f0;
    --text-muted: #64748b;
    --text-dim:   #94a3b8;
    --radius:     12px;
    --radius-sm:  8px;
    --shadow:     0 4px 24px rgba(0,0,0,.45);
    --font:       'Inter', 'Segoe UI', system-ui, sans-serif;
    --mono:       'JetBrains Mono', 'Fira Code', monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }
img { max-width: 100%; display: block; }

/* ── Google Font import ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .18s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-h); color: #fff; transform: translateY(-1px); }
.btn-accent   { background: var(--accent);   color: #000; }
.btn-accent:hover  { filter: brightness(1.1); color: #000; transform: translateY(-1px); }
.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover  { background: var(--bg-card2); color: var(--text); }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover  { background: #c83232; color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px 10px; }

/* ── Form Controls ──────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.form-control {
    width: 100%;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: var(--font);
    transition: border-color .15s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon .form-control { padding-left: 40px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .9rem;
}
.alert-danger  { background: #2b1111; border-left: 3px solid var(--danger);  color: #fca5a5; }
.alert-success { background: #0d2b1a; border-left: 3px solid var(--success); color: #86efac; }
.alert-warning { background: #2b1e00; border-left: 3px solid var(--warning); color: #fcd34d; }
.alert-info    { background: #0c1f2b; border-left: 3px solid var(--accent);  color: #67e8f9; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-primary { background: rgba(99,102,241,.18); color: #a5b4fc; }
.badge-success { background: rgba(34,197,94,.15);  color: #86efac; }
.badge-warning { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #fca5a5; }
.badge-muted   { background: rgba(100,116,139,.15); color: #94a3b8; }

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page { background: radial-gradient(ellipse at 30% 20%, #1a1040 0%, #0b0d12 60%); }
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg,var(--primary),var(--accent)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.logo-text { font-size: 1.1rem; color: var(--text-dim); }
.logo-text strong { color: var(--text); }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }
.auth-back { margin-top: 20px; text-align: center; font-size: .85rem; color: var(--text-muted); }

/* ============================================================
   PUBLIC STORE – NAVBAR
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11,13,18,.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.navbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.navbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.navbar-brand .logo-text { font-size: 1rem; }
.navbar-search { flex: 1; max-width: 380px; position: relative; }
.navbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.navbar-search input { width: 100%; background: var(--bg-card2); border: 1px solid var(--border); color: var(--text); padding: 9px 14px 9px 40px; border-radius: 999px; font-size: .875rem; outline: none; }
.navbar-search input:focus { border-color: var(--primary); }
.navbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ============================================================
   PUBLIC STORE – HERO
   ============================================================ */
.hero {
    background: radial-gradient(ellipse at 60% 0%, #1e1060 0%, transparent 60%),
                radial-gradient(ellipse at 10% 80%, #062040 0%, transparent 50%);
    padding: 80px 24px;
    text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; background: linear-gradient(135deg, #fff 30%, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 16px; }
.hero p  { color: var(--text-dim); font-size: 1.125rem; max-width: 520px; margin: 0 auto 32px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.hero-stat  { text-align: center; }
.hero-stat .num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.hero-stat .lbl { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ============================================================
   PUBLIC STORE – CATEGORIES BAR
   ============================================================ */
.categories-bar {
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    overflow-x: auto;
    scrollbar-width: none;
}
.categories-bar::-webkit-scrollbar { display: none; }
.categories-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; }
.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all .15s;
    text-decoration: none;
    background: none;
    border-left: none; border-right: none; border-top: none;
    cursor: pointer;
    font-family: var(--font);
}
.cat-btn:hover   { color: var(--text); }
.cat-btn.active  { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   PUBLIC STORE – PLUGIN GRID
   ============================================================ */
.store-wrap   { max-width: 1280px; margin: 0 auto; padding: 40px 24px; }
.store-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.store-header h2 { font-size: 1.1rem; color: var(--text-dim); }
.store-header h2 strong { color: var(--text); }
.sort-select { background: var(--bg-card2); border: 1px solid var(--border); color: var(--text); padding: 8px 32px 8px 12px; border-radius: var(--radius-sm); font-size: .875rem; appearance: none; cursor: pointer; outline: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

.plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.plugin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .2s, border-color .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.plugin-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.4); box-shadow: 0 12px 40px rgba(0,0,0,.5); }

.plugin-screenshot {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-card2);
}
.plugin-screenshot img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.plugin-card:hover .plugin-screenshot img { transform: scale(1.04); }
.plugin-screenshot-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all .2s;
}
.plugin-card:hover .plugin-screenshot-overlay { background: rgba(0,0,0,.4); opacity: 1; }

.plugin-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.plugin-category { font-size: .75rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.plugin-name { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.plugin-description { font-size: .85rem; color: var(--text-muted); line-height: 1.5; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plugin-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.plugin-meta span { font-size: .75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.plugin-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.version-badge { font-family: var(--mono); font-size: .75rem; color: var(--primary); background: rgba(99,102,241,.12); padding: 3px 10px; border-radius: 999px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 48px; flex-wrap: wrap; }
.page-btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
}
.page-btn:hover  { background: var(--bg-card2); color: var(--text); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .35; pointer-events: none; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-state .icon { font-size: 4rem; color: var(--border); margin-bottom: 20px; }
.empty-state h3 { font-size: 1.25rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { border-top: 1px solid var(--border); padding: 32px 24px; text-align: center; color: var(--text-muted); font-size: .85rem; margin-top: 60px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .hero { padding: 48px 16px; }
    .store-wrap { padding: 24px 16px; }
    .auth-card { padding: 32px 24px; }
    .plugins-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (max-width: 420px) {
    .plugins-grid { grid-template-columns: 1fr; }
}
