/* ===== Prompt Ark Hub — Styles ===== */
/* Dark theme with glassmorphism, consistent with the extension popup */

:root {
    --bg-base: #0f1117;
    --bg-surface: #161922;
    --bg-elevated: #1c1f2e;
    --bg-card: rgba(28, 31, 46, 0.7);
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-input: #12141d;

    --text-primary: #e4e6ef;
    --text-secondary: #8b8fa7;
    --text-tertiary: #5a5e75;
    --text-muted: #404358;

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --font-sans: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'DM Mono', 'SF Mono', 'Cascadia Code', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Background Gradient ===== */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -20%;
    width: 80%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -40%;
    right: -20%;
    width: 70%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ===== Layout ===== */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.hub-header {
    padding: 32px 0 24px;
    text-align: center;
}

.hub-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.hub-logo img {
    width: 36px;
    height: 36px;
}

.hub-logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hub-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ===== Search ===== */
.hub-search {
    max-width: 560px;
    margin: 20px auto;
    position: relative;
}

.hub-search input {
    width: 100%;
    padding: 12px 20px 12px 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s;
}

.hub-search input::placeholder {
    color: var(--text-tertiary);
}

.hub-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.hub-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
}

/* ===== Tabs / Filters ===== */
.hub-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hub-categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.hub-cat-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hub-cat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.hub-cat-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.hub-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-sort-label {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.hub-sort select {
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
}

.hub-sort select:focus {
    border-color: var(--accent);
}

/* ===== Stats Bar ===== */
.hub-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.hub-stats-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

.hub-stats-count strong {
    color: var(--text-secondary);
}

/* ===== Prompt Grid ===== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

/* ===== Prompt Card ===== */
.hub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.hub-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    opacity: 0;
    transition: opacity 0.25s;
}

.hub-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hub-card:hover::before {
    opacity: 1;
}

.hub-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.hub-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
}

.hub-card-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.hub-card-type.prompt {
    background: var(--accent-soft);
    color: var(--accent);
}

.hub-card-type.pack {
    background: var(--success-soft);
    color: var(--success);
}

.hub-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hub-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.hub-tag {
    padding: 2px 8px;
    background: var(--bg-hover);
    border-radius: 999px;
    font-size: 10px;
    color: var(--text-secondary);
}

.hub-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.hub-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-card-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-elevated);
}

.hub-card-author-name {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.hub-card-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hub-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.hub-stat-icon {
    font-size: 12px;
}

.hub-card-score {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.hub-card-score.high {
    color: var(--success);
    background: var(--success-soft);
}

.hub-card-score.mid {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.12);
}

.hub-card-score.low {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.12);
}

/* ===== Detail Modal ===== */
.hub-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.hub-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.hub-modal {
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.hub-modal-backdrop.active .hub-modal {
    transform: scale(1) translateY(0);
}

.hub-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.hub-modal-title {
    font-size: 20px;
    font-weight: 700;
}

.hub-modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
}

.hub-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.hub-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.hub-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.hub-modal-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 4px 10px;
    border-radius: 999px;
}

.hub-modal-content {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    color: var(--text-primary);
}

.hub-modal-content h1,
.hub-modal-content h2,
.hub-modal-content h3 {
    margin: 16px 0 8px;
    font-weight: 700;
}

.hub-modal-content h1 {
    font-size: 18px;
}

.hub-modal-content h2 {
    font-size: 16px;
}

.hub-modal-content h3 {
    font-size: 14px;
}

.hub-modal-content code {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
}

.hub-modal-content pre {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

.hub-modal-content pre code {
    padding: 0;
    background: none;
}

.hub-modal-content blockquote {
    margin: 8px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
}

.hub-modal-content ul,
.hub-modal-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.hub-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    gap: 12px;
}

.hub-modal-votes {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-vote-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.hub-vote-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.hub-vote-btn.active.up {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success);
}

.hub-vote-btn.active.down {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
    color: var(--danger);
}

.hub-install-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.hub-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.hub-install-btn:active {
    transform: translateY(0);
}

/* ===== Loading ===== */
.hub-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.hub-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hub-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
}

.hub-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.hub-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ===== Footer ===== */
.hub-footer {
    text-align: center;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 12px;
}

.hub-footer a {
    color: var(--accent);
    text-decoration: none;
}

.hub-footer a:hover {
    text-decoration: underline;
}

/* ===== Pack List (in modal) ===== */
.hub-pack-list {
    margin-top: 16px;
}

.hub-pack-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.15s;
}

.hub-pack-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.hub-pack-item-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.hub-pack-item-preview {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Toast ===== */
.hub-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    padding: 12px 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.hub-toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hub-container {
        padding: 0 16px;
    }

    .hub-grid {
        grid-template-columns: 1fr;
    }

    .hub-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .hub-categories {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .hub-modal {
        width: 95%;
        max-height: 90vh;
    }

    .hub-modal-header {
        padding: 16px;
    }

    .hub-modal-body {
        padding: 16px;
    }

    .hub-modal-footer {
        flex-direction: column;
        gap: 12px;
    }

    .hub-install-btn {
        width: 100%;
    }
}