/**
 * Friendly AI Playbook Theme
 *
 * Custom theme overrides inspired by the Friendly AI Playbook design:
 * Dark navy backgrounds, cyan accents, vibrant category colors,
 * with decorative circles and a warm, approachable feel.
 */

/* ============================================
   Override SmallStack CSS Variables
   ============================================ */

:root {
    --primary: #00b8b8;
    --primary-hover: #009999;
    --secondary: #7c3aed;
    --accent: #e91e8f;

    --body-bg: #f0f4f8;
    --body-fg: #1e1b4b;
    --content-bg: #ffffff;
    --header-bg: #1e1b4b;
    --header-fg: #ffffff;

    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-header-bg: #f8fafc;

    --button-bg: #00b8b8;
    --button-fg: #ffffff;
    --button-hover-bg: #009999;

    --sidebar-bg: #1e1b4b;
    --sidebar-fg: #ffffff;
    --sidebar-active-bg: #00b8b8;
    --sidebar-active-fg: #ffffff;

    --topbar-height: 56px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

[data-theme="dark"] {
    --primary: #00d4d4;
    --primary-hover: #00b8b8;
    --secondary: #a78bfa;
    --accent: #f472b6;

    --body-bg: #0f0d24;
    --body-fg: #f0f4f8;
    --content-bg: #1e1b4b;
    --header-bg: #0f0d24;
    --header-fg: #f0f4f8;

    --card-bg: #1e1b4b;
    --card-border: #2d2a5e;
    --card-header-bg: #252252;

    --button-bg: #00d4d4;
    --button-fg: #0f0d24;
    --button-hover-bg: #00b8b8;

    --sidebar-bg: #0f0d24;
    --sidebar-fg: #f0f4f8;

    --input-bg: #252252;
    --input-border: #3d3a6e;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #2d1b69 50%, #1e1b4b 100%);
    color: #ffffff;
    padding: 80px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    margin: -20px -20px 40px -20px;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
}

.hero::before {
    width: 400px;
    height: 400px;
    background: #1a5276;
    top: -100px;
    left: -100px;
}

.hero::after {
    width: 300px;
    height: 300px;
    background: #7c3aed;
    bottom: -80px;
    right: -60px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.25em;
    position: relative;
    z-index: 1;
}

.hero h1 .accent-cyan {
    color: #00d4d4;
}

.hero h1 .accent-magenta {
    color: #e91e8f;
}

.hero .subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2em;
    position: relative;
    z-index: 1;
}

.hero .stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero .stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Category Cards (Grid)
   ============================================ */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-decoration: none;
    color: var(--body-fg);
    display: block;
}

/* Override base a / a:hover styles — card is the link, not the text */
a.category-card,
a.category-card:link,
a.category-card:visited,
a.category-card:hover,
a.category-card:focus,
a.category-card:active {
    text-decoration: none !important;
    color: inherit;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--card-border));
}

[data-theme="dark"] .category-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.category-card .card-accent {
    height: 5px;
}

.category-card .card-body {
    padding: 20px 24px;
}

/* Icon + title on one line */
.category-card .card-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.category-card .card-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    line-height: 1;
}

.category-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--body-fg);
}

.category-card .card-description {
    font-size: 0.88rem;
    color: color-mix(in srgb, var(--body-fg) 65%, var(--body-bg));
    line-height: 1.5;
    margin: 0 0 16px 0;
}

[data-theme="dark"] .category-card .card-description {
    color: color-mix(in srgb, var(--body-fg) 75%, var(--body-bg));
}

.category-card .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-card .prompt-count {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    color: #ffffff;
}

.category-card .arrow {
    font-size: 1.2rem;
    color: color-mix(in srgb, var(--body-fg) 35%, var(--body-bg));
    transition: color 0.2s, transform 0.2s;
}

.category-card:hover .arrow {
    color: var(--primary);
    transform: translateX(4px);
}

/* ============================================
   Prompt Cards
   ============================================ */

.prompt-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.prompt-card .card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.prompt-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.prompt-card .card-header .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
}

.prompt-card .helps-with {
    padding: 16px 24px;
    background: var(--card-header-bg);
    font-size: 0.9rem;
    line-height: 1.5;
}

.prompt-card .helps-with .label {
    color: #00b8b8;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

[data-theme="dark"] .prompt-card .helps-with .label {
    color: #00d4d4;
}

.prompt-template-box {
    margin: 20px 24px;
    background: #1e1b4b;
    color: #e0e0e0;
    border-radius: 8px;
    padding: 20px 24px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    position: relative;
}

.prompt-template-box .bracket {
    color: #00d4d4;
    font-weight: 600;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #00b8b8;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #009999;
}

.copy-btn.copied {
    background: #22c55e;
}

.prompt-card .example-section {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
}

.prompt-card .example-section .label {
    color: #00b8b8;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

[data-theme="dark"] .prompt-card .example-section .label {
    color: #00d4d4;
}

.prompt-card .example-section .example-text {
    background: var(--card-header-bg);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid #00b8b8;
    font-size: 0.9rem;
    line-height: 1.5;
}

.prompt-card .pro-tip {
    padding: 16px 24px;
    background: linear-gradient(90deg, #ffc107 0%, #ffca2c 100%);
    color: #1e1b4b;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
}

.prompt-card .pro-tip strong {
    font-weight: 700;
}

/* ============================================
   Category Detail Header
   ============================================ */

.category-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #2d1b69 100%);
    color: #ffffff;
    padding: 48px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    margin: -20px -20px 40px -20px;
}

.category-header::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    opacity: 0.12;
    top: -80px;
    right: -60px;
}

.category-header .cat-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

.category-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 12px 0;
}

.category-header .cat-description {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto;
}

.category-header .section-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ============================================
   Cheat Sheet
   ============================================ */

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

.cheatsheet-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--body-fg);
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
}

a.cheatsheet-card,
a.cheatsheet-card:link,
a.cheatsheet-card:visited,
a.cheatsheet-card:hover,
a.cheatsheet-card:focus,
a.cheatsheet-card:active {
    text-decoration: none !important;
    color: inherit;
}

.cheatsheet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.cheatsheet-card .card-num {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.cheatsheet-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    padding-right: 36px;
}

.cheatsheet-card .mini-prompt {
    font-size: 0.8rem;
    color: color-mix(in srgb, var(--body-fg) 65%, var(--body-bg));
    line-height: 1.4;
    font-family: 'Courier New', monospace;
}

[data-theme="dark"] .cheatsheet-card .mini-prompt {
    color: color-mix(in srgb, var(--body-fg) 75%, var(--body-bg));
}

[data-theme="dark"] .cheatsheet-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border-color: var(--primary);
}

/* ============================================
   Power Tips
   ============================================ */

.power-tips {
    background: var(--card-bg);
    border: 2px solid #00b8b8;
    border-radius: var(--border-radius-md);
    padding: 32px;
    margin: 40px 0;
}

.power-tips h2 {
    color: #00b8b8;
    margin-top: 0;
}

[data-theme="dark"] .power-tips h2 {
    color: #00d4d4;
}

.power-tips .tip {
    margin-bottom: 16px;
    padding-left: 20px;
    border-left: 3px solid var(--card-border);
    line-height: 1.6;
}

.power-tips .tip strong {
    color: var(--primary);
}

/* ============================================
   Navigation / Breadcrumbs
   ============================================ */

.section-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.section-nav a {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff;
    transition: opacity 0.2s;
}

.section-nav a:hover {
    opacity: 0.85;
}

/* ============================================
   How-To Steps
   ============================================ */

.how-to-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px auto;
    max-width: 800px;
}
@media (max-width: 768px) {
    .how-to-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .how-to-steps { grid-template-columns: 1fr; }
}

.how-to-step {
    text-align: center;
    padding: 16px 10px;
}

.how-to-step .step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

[data-theme="dark"] .how-to-step .step-num {
    color: #0f0d24;
}

.how-to-step h4 {
    margin: 0 0 4px 0;
    font-size: 0.85rem;
    color: var(--body-fg);
}

.how-to-step p {
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--body-fg) 70%, var(--body-bg));
    line-height: 1.4;
    margin: 0;
}

[data-theme="dark"] .how-to-step p {
    color: color-mix(in srgb, var(--body-fg) 80%, var(--body-bg));
}

/* ============================================
   Homepage Sections
   ============================================ */

.fai-section-heading {
    text-align: center;
    margin-top: 48px;
    margin-bottom: 0;
    color: var(--body-fg);
}

.fai-section-subtext {
    text-align: center;
    margin-bottom: 32px;
    color: color-mix(in srgb, var(--body-fg) 60%, var(--body-bg));
}

[data-theme="dark"] .fai-section-subtext {
    color: color-mix(in srgb, var(--body-fg) 70%, var(--body-bg));
}

/* CTA buttons */
.fai-cta-bar {
    text-align: center;
    margin: 48px 0 24px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.fai-cta-primary,
.fai-cta-primary:link,
.fai-cta-primary:visited,
.fai-cta-primary:hover,
.fai-cta-primary:active {
    display: inline-block;
    background: var(--primary);
    color: #fff !important;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.15s;
}

.fai-cta-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

[data-theme="dark"] .fai-cta-primary,
[data-theme="dark"] .fai-cta-primary:link,
[data-theme="dark"] .fai-cta-primary:visited,
[data-theme="dark"] .fai-cta-primary:hover,
[data-theme="dark"] .fai-cta-primary:active {
    color: #0f0d24 !important;
}

.fai-cta-outline {
    display: inline-block;
    background: transparent;
    color: var(--primary);
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--primary);
    transition: background 0.2s, transform 0.15s;
}

.fai-cta-outline:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    transform: translateY(-2px);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .hero {
        padding: 48px 20px;
    }

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

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

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

    .prompt-template-box {
        margin: 16px;
        padding: 16px;
        font-size: 0.8rem;
    }

    .category-header {
        padding: 32px 20px;
    }

    .category-header h1 {
        font-size: 1.6rem;
    }
}
