/* Agents First Repo Docs — components.css
   Botones, cards, hero, badges, árbol de archivos,
   prompt-viewer, modelos, markdown-body, toast.
   ======================================================= */

/* ─── Buttons ─────────────────────────────────────────── */

.copy-prompt-trigger,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 650;
    font-size: 14px;
    transition: background-color 0.18s ease, border-color 0.18s ease,
                color 0.18s ease, transform 0.18s ease;
}

.copy-prompt-trigger,
.btn-primary,
.btn-accent {
    background: var(--accent);
    color: #ffffff;
}

.copy-prompt-trigger:hover,
.btn-primary:hover,
.btn-accent:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

.btn-sm {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 12px;
}

/* ─── Cards ───────────────────────────────────────────── */

.glass-card,
.hero-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.glass-card {
    padding: clamp(18px, 3vw, 28px);
}

.hero-card {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 6vw, 56px);
}

.hero-overlay {
    display: none;
}

.hero-content {
    max-width: 760px;
}

/* ─── Badges ──────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 18px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
}

.badge-outline {
    margin: 0;
    background: var(--surface-muted);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* ─── Hero ────────────────────────────────────────────── */

.hero-content h2 {
    max-width: 820px;
    font-size: clamp(30px, 5vw, 56px);
    line-height: 1.05;
    font-weight: 760;
    letter-spacing: 0;
}

.hero-content p {
    max-width: 680px;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

/* ─── Feature Grid ────────────────────────────────────── */

.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.feature-box {
    min-height: 190px;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    margin-bottom: 18px;
}

.bg-cyan,
.bg-purple,
.bg-blue {
    background: var(--accent-soft);
    color: var(--accent);
}

.feature-box h3 {
    font-size: 16px;
    font-weight: 720;
}

.feature-box p,
.card-header p,
.subtitle,
.model-desc,
#file-description,
.markdown-body {
    color: var(--text-secondary);
}

.feature-box p {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
}

/* ─── Card Header ─────────────────────────────────────── */

.full-page-card,
.model-selector-card {
    gap: 18px;
}

.card-header,
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.file-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.icon-title {
    color: var(--accent);
    font-size: 20px;
}

.card-header h3,
.tree-card h3,
.model-selector-card h3,
.preview-header h4 {
    font-size: 18px;
    font-weight: 740;
}

.card-header p,
.subtitle {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
}

/* ─── Prompt Viewer ───────────────────────────────────── */

.prompt-viewer-container,
.code-preview-box,
.markdown-body pre {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--code-bg);
}

.prompt-viewer-container {
    max-height: min(68vh, 720px);
    overflow: auto;
    padding: 24px;
    background: var(--surface);
}

.prompt-viewer-container pre,
.code-preview-box pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--code-text);
    font-size: 13px;
    line-height: 1.65;
}

/* ─── Structure / File Tree ───────────────────────────── */

.split-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.tree-card,
.preview-card {
    height: min(70vh, 680px);
    min-height: 520px;
    overflow: hidden;
}

.tree-card {
    display: flex;
    flex-direction: column;
}

.file-tree {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    overflow: auto;
    padding-right: 4px;
}

.tree-node {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    min-height: 32px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.35;
    user-select: none;
}

.tree-node span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-node:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

.tree-node.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

.toggle-icon {
    width: 12px;
    color: var(--text-muted);
    font-size: 10px;
    transition: transform 0.18s ease;
}

.tree-node.directory:not(.expanded) .toggle-icon {
    transform: rotate(-90deg);
}

.tree-icon,
.txt-yellow,
.txt-blue,
.txt-purple,
.txt-cyan,
.txt-green {
    color: var(--text-muted);
}

.tree-children {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-left: 13px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.tree-node.directory:not(.expanded) + .tree-children {
    display: none;
}

/* ─── Preview Panel ───────────────────────────────────── */

.preview-card,
.preview-content,
.code-preview-box,
.model-content-area {
    display: flex;
    flex-direction: column;
}

.preview-content,
.code-preview-box {
    min-height: 0;
    flex: 1;
}

#file-description {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.55;
}

.code-preview-box {
    overflow: hidden;
}

.code-preview-box > .markdown-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background: var(--surface);
}

.code-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-color);
}

.code-header span {
    overflow: hidden;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-preview-box pre {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

/* ─── Model Tabs ──────────────────────────────────────── */

.tabs-control {
    display: flex;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 650;
    font-size: 13px;
}

.tab-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.model-content-area {
    gap: 14px;
}

.model-desc,
.markdown-body {
    font-size: 14px;
    line-height: 1.7;
}

/* ─── Markdown Body ───────────────────────────────────── */

.markdown-body {
    min-width: 0;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: var(--text-primary);
    margin: 20px 0 10px;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 24px; }

.markdown-body h2 {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 19px;
}

.markdown-body h3 { font-size: 16px; }
.markdown-body h4 { font-size: 15px; }

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
    margin-bottom: 14px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 22px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body pre {
    margin: 14px 0;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.markdown-body code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--surface-muted);
    color: var(--text-primary);
    font-size: 13px;
}

.markdown-body pre code {
    padding: 0;
    background: transparent;
    color: var(--code-text);
}

.markdown-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.markdown-body blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--accent-soft);
}

.markdown-body hr {
    margin: 24px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

.markdown-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: var(--radius);
}

.markdown-body .table-scroll {
    max-width: 100%;
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13px;
}

.markdown-body th,
.markdown-body td {
    min-width: 130px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.markdown-body th {
    background: var(--surface-muted);
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-body tr:last-child td {
    border-bottom: 0;
}

.markdown-body .task-item {
    list-style: none;
}

/* ─── Toast ───────────────────────────────────────────── */

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(360px, calc(100vw - 36px));
    padding: 12px 14px;
    border-radius: var(--radius);
    background: #111827;
    color: #ffffff;
    box-shadow: var(--shadow-md);
    font-weight: 650;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}
