/* AI Plugin Directory */

:root {
    --primary: #6B21A8;
    --primary-light: #8B5CF6;
    --primary-dark: #581C87;
    --accent: #F97316;
    --accent-light: #FB923C;
    --accent-dark: #EA580C;

    --bg: #FFFFFF;
    --bg-subtle: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --bg-hero: linear-gradient(135deg, #6B21A8 0%, #4C1D95 40%, #1E1B4B 100%);

    --text: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    --border: #E2E8F0;
    --border-hover: #CBD5E1;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 24px rgba(107,33,168,0.12), 0 2px 8px rgba(0,0,0,0.06);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    --success: #16A34A;
    --success-bg: #DCFCE7;
    --warning: #CA8A04;
    --warning-bg: #FEF9C3;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;

    --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #6B21A8 100%);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0F172A;
        --bg-subtle: #1E293B;
        --bg-card: #1E293B;
        --bg-card-hover: #334155;
        --text: #F1F5F9;
        --text-secondary: #CBD5E1;
        --text-muted: #64748B;
        --border: #334155;
        --border-hover: #475569;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
        --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6), 0 8px 10px -6px rgba(0,0,0,0.5);
        --success-bg: #052E16;
        --warning-bg: #422006;
        --danger-bg: #450A0A;
    }
}

[data-theme="dark"] {
    --bg: #0F172A;
    --bg-subtle: #1E293B;
    --bg-card: #1E293B;
    --bg-card-hover: #334155;
    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --border: #334155;
    --border-hover: #475569;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6), 0 8px 10px -6px rgba(0,0,0,0.5);
    --success-bg: #052E16;
    --warning-bg: #422006;
    --danger-bg: #450A0A;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== SKIP LINK ========== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: var(--font);
    text-decoration: none;
    font-size: 0.9rem;
    transition: top 0.1s;
}

.skip-link:focus {
    top: 1rem;
}

/* ========== NAVBAR ========== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.nav-title {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

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

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

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

/* Theme toggle icons */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: none; }
    :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ========== MAIN CONTAINER ========== */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    min-height: calc(100vh - 200px);
}

/* ========== HERO SECTION ========== */
.hero {
    background: var(--bg-hero);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem 2rem;
    margin: 1.5rem 0 0;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero p {
    font-size: 1rem;
    opacity: 0.85;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Hero Search */
.hero-search {
    margin: 1.25rem auto 0;
    max-width: 600px;
    width: 100%;
}

.search-container {
    position: relative;
    width: 100%;
}

.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: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.95);
    color: var(--text);
    outline: none;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(107, 33, 168, 0.2);
}

.search-input::placeholder {
    color: #9ca3af;
}

[data-theme="dark"] .search-input {
    background: rgba(30, 41, 59, 0.95);
    color: var(--text);
    border-color: rgba(255,255,255,0.2);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .search-input {
        background: rgba(30, 41, 59, 0.95);
        color: var(--text);
        border-color: rgba(255,255,255,0.2);
    }
}

.search-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    overflow: hidden;
    display: none;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.search-autocomplete.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
    background: var(--bg-card-hover);
}

.autocomplete-item-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.autocomplete-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Autocomplete section labels */
.autocomplete-section-label {
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

.autocomplete-section-label:first-child {
    border-top: none;
}

/* ========== SECTION HEADERS ========== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0 1rem;
}

.section-title {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

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

/* ========== PERSONA CARDS ========== */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.persona-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    text-align: left;
    box-shadow: var(--shadow-card);
}

.persona-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(107,33,168,0.25);
}

.persona-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.persona-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.persona-card-tagline {
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ========== PLUGIN CARDS GRID ========== */
.plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.plugin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
}

.plugin-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(107, 33, 168, 0.3);
}

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

.plugin-card-name {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.plugin-card-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--warning);
    font-weight: 500;
    flex-shrink: 0;
}

.plugin-card-stars svg {
    width: 14px;
    height: 14px;
    fill: var(--warning);
}

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

/* Meta row: badge + category + tags all in one line */
.plugin-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: auto;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.source-badge.official {
    background: rgba(107, 33, 168, 0.1);
    color: var(--primary);
}

.source-badge.community {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.source-badge.third-party {
    background: rgba(202, 138, 4, 0.1);
    color: var(--warning);
}

[data-theme="dark"] .source-badge.official,
:root:not([data-theme="light"]) .source-badge.official {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-light);
}

[data-theme="dark"] .source-badge.community,
:root:not([data-theme="light"]) .source-badge.community {
    background: rgba(22, 163, 74, 0.2);
}

[data-theme="dark"] .source-badge.third-party,
:root:not([data-theme="light"]) .source-badge.third-party {
    background: rgba(202, 138, 4, 0.2);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .source-badge.official {
        background: rgba(139, 92, 246, 0.2);
        color: var(--primary-light);
    }
    :root:not([data-theme="light"]) .source-badge.community {
        background: rgba(22, 163, 74, 0.2);
    }
    :root:not([data-theme="light"]) .source-badge.third-party {
        background: rgba(202, 138, 4, 0.2);
    }
}

.plugin-card-category {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Rating on card (shown inline in meta row) */
.plugin-card-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.rating-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Add-to-stack button on cards */
.btn-add-stack {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    font-family: var(--font);
}

.btn-add-stack:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(107, 33, 168, 0.08);
}

.btn-add-stack.in-stack {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-size: 0.85rem;
}

/* ========== PERSONA VIEW ========== */
.persona-view-header {
    margin: 2rem 0 1.5rem;
}

.persona-view-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.persona-view-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ========== ACTIVITIES LIST ========== */
.activities-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    transition: border-color var(--transition), background var(--transition);
    min-width: 0;
}

.activity-row:hover {
    border-color: var(--primary-light);
    background: var(--bg-card-hover);
}

.activity-row:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.activity-row-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.activity-row-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.activity-row-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-row-complexity {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 2px 8px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 1.5rem 0 0;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    font-family: var(--font);
    transition: background var(--transition), border-color var(--transition);
}

.back-button:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

/* ========== COVERAGE BAR ========== */
.coverage-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.coverage-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.coverage-bar-container {
    display: flex;
    gap: 3px;
    height: 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.coverage-segment {
    flex: 1;
    position: relative;
    transition: opacity var(--transition);
    border-radius: 3px;
}

.coverage-segment.covered {
    background: var(--success);
}

.coverage-segment.partial {
    background: var(--warning);
    /* striped pattern for colorblind users */
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255,255,255,0.3) 4px,
        rgba(255,255,255,0.3) 6px
    );
    background-color: var(--warning);
}

.coverage-segment.gap {
    background: var(--danger);
    opacity: 0.5;
    /* dotted pattern for colorblind users */
    background-image: radial-gradient(circle, rgba(255,255,255,0.4) 1px, transparent 1px);
    background-size: 6px 6px;
    background-color: var(--danger);
}

.coverage-segment:hover {
    opacity: 0.8;
}

.coverage-segment-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.coverage-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.coverage-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.coverage-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.coverage-legend-dot.green { background: var(--success); }
.coverage-legend-dot.yellow { background: var(--warning); }
.coverage-legend-dot.red { background: var(--danger); opacity: 0.5; }

.coverage-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* Gap callouts */
.gap-callouts {
    margin-top: 1.25rem;
}

.gap-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}

.gap-callout-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--danger);
}

/* Build Your Stack */
.stack-builder {
    margin: 1.5rem 0;
}

.stack-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stack-builder-title {
    font-size: 1rem;
    font-weight: 600;
}

.stack-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stack-plugin-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: border-color var(--transition), background var(--transition);
}

.stack-plugin-item:hover {
    border-color: var(--primary-light);
}

.stack-plugin-item.checked {
    border-color: var(--primary);
    background: rgba(107, 33, 168, 0.04);
}

.stack-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.stack-plugin-name {
    font-weight: 500;
    font-size: 0.9rem;
    flex: 1;
}

.stack-plugin-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms, visibility 200ms;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(10px);
    transition: transform 200ms;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-subtitle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

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

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-subtle);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--bg-card-hover);
}

.modal-body {
    padding: 1.25rem;
}

.modal-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
}

.modal-section {
    margin-bottom: 1rem;
}

.modal-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.modal-compat-grid {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.modal-compat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.modal-compat-item.active {
    background: rgba(107, 33, 168, 0.1);
    color: var(--primary);
}

.modal-compat-item.inactive {
    opacity: 0.4;
}

.modal-pairs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.modal-pair-item {
    padding: 0.4rem 0.625rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.modal-pair-item:hover {
    background: var(--bg-card-hover);
}

.modal-activities-grid {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.modal-activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.625rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.modal-activity-item:hover {
    background: var(--bg-card-hover);
}

.modal-activity-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
}

.modal-activity-persona {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.modal-install {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    justify-content: space-between;
}

.modal-install-code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.78rem;
    color: var(--text);
    line-height: 1.5;
    word-break: break-all;
    flex: 1;
}

.modal-install-unavailable {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.modal-marketplace-hint {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.modal-marketplace-hint code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    color: var(--text-secondary);
}

.modal-source-link {
    display: inline-block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}

.modal-source-link:hover {
    color: var(--primary-light);
}

.stack-script-box {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.stack-script-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stack-script-code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
}


.btn-copy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background var(--transition);
}

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

.modal-review-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* ========== LOADING STATE ========== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ========== FOOTER ========== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 1.5rem;
    text-align: center;
}

.site-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--primary-light);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.filter-bar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ========== PAGINATION / LOAD MORE ========== */
.load-more-container {
    text-align: center;
    margin: 2rem 0;
}

.btn-load-more {
    padding: 0.75rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background var(--transition), transform var(--transition);
}

.btn-load-more:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ========== STACK DRAWER ========== */
.stack-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.stack-drawer.open {
    transform: translateX(0);
}

.stack-drawer[hidden] {
    display: none !important;
}

.stack-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.stack-drawer-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.stack-drawer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stack-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.stack-drawer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.stack-drawer-item:last-child {
    border-bottom: none;
}

.stack-drawer-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stack-drawer-item-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.stack-drawer-item-provider {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stack-drawer-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.stack-drawer-remove:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.stack-drawer-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.stack-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
}

.stack-drawer-close:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

/* Stack nav badge */
.stack-nav-btn {
    position: relative;
}

.stack-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

/* Export button */
.btn-export-stack {
    padding: 0.4rem 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background var(--transition);
}

.btn-export-stack:hover {
    background: var(--primary-dark);
}

/* ========== SEARCH RESULTS ========== */
.search-results-header {
    margin: 2rem 0 1.5rem;
}

.search-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.search-results-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.search-section {
    margin-bottom: 2rem;
}

.search-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.search-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-sort label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ========== USE CASE PILLS (use-case detail + search results only) ========== */
.use-case-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 0 1.5rem;
    margin: 0;
}

.use-case-pill {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 200ms ease;
    text-align: left;
    flex: 1 1 calc(25% - 10px);
    min-width: 180px;
    position: relative;
    overflow: hidden;
}

.use-case-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 200ms ease;
}

.use-case-pill:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.use-case-pill:hover::before {
    opacity: 1;
}

.use-case-pill-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.3;
}

.use-case-pill-persona {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== REVIEW SYSTEM ========== */
.review-aggregate {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.review-aggregate-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.review-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.review-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.review-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.review-verified {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.review-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.review-rating {
    margin-bottom: 0.5rem;
}

.review-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Stars */
.stars-row {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.star-icon {
    flex-shrink: 0;
}

.star-icon .star-filled {
    fill: var(--warning);
}

.star-icon .star-empty {
    fill: var(--border);
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* ========== FOCUS STYLES ========== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========== UTILITIES ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .hero {
        padding: 2rem 1.25rem 1.75rem;
        margin: 1rem 0 0;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .plugins-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        max-height: 92vh;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 0.875rem 1rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .use-case-pill {
        flex: 1 1 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .activities-list {
        grid-template-columns: 1fr;
    }

    .app-container {
        padding: 0 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .persona-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .persona-card {
        padding: 0.875rem 0.75rem;
    }

    .use-case-pill {
        flex: 1 1 100%;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
