/**
 * AI Content Bridge - Frontend Styles
 * Nice default styles for AI-generated content features
 * 
 * Enqueue this in your theme or let the plugin handle it.
 */

:root {
    --ai-primary: #14b8a6;
    --ai-primary-dark: #0f766e;
    --ai-text: #1e2937;
    --ai-muted: #64748b;
    --ai-bg: #f8fafc;
    --ai-border: #e2e8f0;
}

/* ========================================
   TABLE OF CONTENTS
   ======================================== */
.ai-content-toc {
    background: var(--ai-bg);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 32px 0;
    max-width: 640px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.ai-content-toc h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ai-text);
    letter-spacing: -0.02em;
}

.ai-content-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-content-toc li {
    margin: 6px 0;
    line-height: 1.5;
}

.ai-content-toc a {
    color: var(--ai-text);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
}

.ai-content-toc a:hover {
    color: var(--ai-primary);
    text-decoration: underline;
}

/* ========================================
   HEADING ANCHORS
   ======================================== */
.ai-content-heading-anchor {
    opacity: 0;
    margin-left: 8px;
    font-size: 0.75em;
    color: var(--ai-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
    user-select: none;
}

h1:hover .ai-content-heading-anchor,
h2:hover .ai-content-heading-anchor,
h3:hover .ai-content-heading-anchor,
h4:hover .ai-content-heading-anchor,
h5:hover .ai-content-heading-anchor,
h6:hover .ai-content-heading-anchor {
    opacity: 1;
}

.ai-content-heading-anchor:hover {
    color: var(--ai-primary-dark);
}

/* ========================================
   ENHANCED CODE BLOCKS
   ======================================== */
.ai-code-block {
    position: relative;
    margin: 24px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--ai-border);
    background: #0f172a; /* Dark code background */
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.ai-code-lang {
    position: absolute;
    top: 12px;
    left: 16px;
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
    z-index: 2;
}

.ai-copy-button {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.ai-copy-button:hover {
    background: var(--ai-primary);
    border-color: var(--ai-primary);
    color: white;
}

.ai-code-block pre {
    margin: 0;
    padding: 60px 20px 20px 20px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-code-block code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #e2e8f0;
}

/* ========================================
   RESPONSIVE TABLES
   ======================================== */
.ai-table-wrapper {
    overflow-x: auto;
    margin: 28px 0;
    border-radius: 12px;
    border: 1px solid var(--ai-border);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.ai-responsive-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.ai-responsive-table th,
.ai-responsive-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--ai-border);
}

.ai-responsive-table th {
    background: var(--ai-bg);
    font-weight: 600;
    color: var(--ai-text);
    position: sticky;
    top: 0;
}

.ai-responsive-table tr:last-child td {
    border-bottom: none;
}

.ai-responsive-table tr:hover {
    background: #f1f5f9;
}

/* ========================================
   VIDEO EMBEDS
   ======================================== */
.ai-video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 32px 0;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    background: #000;
}

.ai-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ========================================
   GENERAL POLISH FOR AI CONTENT
   ======================================== */
.ai-content-bridge-content h2,
.ai-content-bridge-content h3 {
    scroll-margin-top: 80px; /* Nice offset when clicking TOC links */
}

.ai-content-bridge-content img {
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .ai-content-toc {
        background: #1e2937;
        border-color: #334155;
    }
    
    .ai-content-toc a {
        color: #e2e8f0;
    }
}
