/* ═══════════════════════════════════════════════════════════════════════════════
   SGraph Send — Shared Component Styles
   v0.2.0 — Loaded by SendComponent.loadResources() into every Shadow DOM

   Contains buttons, status badges, form elements, cards, and typography
   that are shared across all components. Component-specific CSS lives in
   each component's own .css file.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Typography Inside Shadow DOM ─────────────────────────────────────── */

* {
    font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
    box-sizing: border-box;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2, 8px);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-family, system-ui);
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--weight-semibold, 600);
    border: none;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: background-color var(--transition, 150ms ease),
                transform 0.1s ease,
                box-shadow var(--transition, 150ms ease);
    text-decoration: none;
    line-height: 1;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent, #4ECDC4);
    color: var(--bg-primary, #1A1A2E);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover, #3DBDB4);
}

.btn-secondary {
    background: transparent;
    color: var(--accent, #4ECDC4);
    border: 1px solid var(--color-border, rgba(78, 205, 196, 0.15));
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent, #4ECDC4);
    background: var(--accent-subtle, rgba(78, 205, 196, 0.12));
}

.btn-copy {
    background: var(--bg-secondary, #16213E);
    color: var(--color-text, #E0E0E0);
    border: 1px solid var(--color-border, rgba(78, 205, 196, 0.15));
}

.btn-copy:hover:not(:disabled) {
    background: var(--bg-surface, #1E2A4A);
    border-color: var(--accent, #4ECDC4);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-small, 0.8rem);
    border-radius: var(--radius-sm, 6px);
}

/* ─── Form Elements ────────────────────────────────────────────────────── */

.input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary, #16213E);
    color: var(--color-text, #E0E0E0);
    border: 1px solid var(--color-border, rgba(78, 205, 196, 0.15));
    border-radius: var(--radius-sm, 6px);
    font-family: var(--font-body, system-ui);
    font-size: var(--text-body, 1rem);
    transition: border-color var(--transition, 150ms ease),
                box-shadow var(--transition, 150ms ease);
}

.input::placeholder {
    color: var(--color-text-secondary, #8892A0);
    opacity: 0.7;
}

.input:focus {
    border-color: var(--accent, #4ECDC4);
    box-shadow: 0 0 0 3px var(--accent-subtle, rgba(78, 205, 196, 0.12));
    outline: none;
}

textarea.input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

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

.status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid transparent;
    font-size: var(--text-sm, 0.875rem);
}

.status--info {
    background: rgba(78, 205, 196, 0.08);
    color: var(--accent, #4ECDC4);
    border-color: rgba(78, 205, 196, 0.15);
}

.status--success {
    background: rgba(78, 205, 196, 0.1);
    color: var(--accent, #4ECDC4);
    border-color: rgba(78, 205, 196, 0.2);
}

.status--error {
    background: rgba(233, 69, 96, 0.1);
    color: var(--danger, #E94560);
    border-color: rgba(233, 69, 96, 0.2);
}

.status--warning {
    background: rgba(224, 124, 79, 0.08);
    color: var(--color-warning, #E07C4F);
    border-color: rgba(224, 124, 79, 0.2);
}

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

.card {
    background: var(--bg-surface, #1E2A4A);
    border: 1px solid var(--color-border, rgba(78, 205, 196, 0.15));
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow, 0 4px 24px rgba(0, 0, 0, 0.3));
    padding: var(--space-6, 24px);
    margin-bottom: var(--space-4, 16px);
}

/* ─── Progress Bar ─────────────────────────────────────────────────────── */

.progress-bar {
    height: 4px;
    background: var(--bg-secondary, #16213E);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--accent, #4ECDC4);
    border-radius: 2px;
    transition: width 300ms ease;
}

/* ─── Result Panel ─────────────────────────────────────────────────────── */

.result-panel {
    margin-top: var(--space-4, 16px);
}

.result-row {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    margin-bottom: var(--space-2, 8px);
    flex-wrap: wrap;
}

.result-row label {
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--weight-semibold, 600);
    color: var(--color-text-secondary, #8892A0);
    min-width: 100%;
    margin-bottom: var(--space-1, 4px);
}

.result-row .value {
    flex: 1;
    font-family: var(--font-mono, monospace);
    font-size: var(--text-sm, 0.875rem);
    background: var(--bg-secondary, #16213E);
    border: 1px solid var(--color-border, rgba(78, 205, 196, 0.15));
    color: var(--color-text, #E0E0E0);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    border-radius: var(--radius-sm, 6px);
    word-break: break-all;
    min-width: 0;
}

/* ─── Guidance Callout ─────────────────────────────────────────────────── */

.guidance {
    background: rgba(224, 124, 79, 0.08);
    border: 1px solid rgba(224, 124, 79, 0.2);
    color: var(--color-warning, #E07C4F);
    border-radius: var(--radius-sm, 6px);
    padding: 0.75rem 1rem;
    font-size: var(--text-sm, 0.875rem);
    margin-top: var(--space-3, 12px);
}

/* ─── Hidden Utility ───────────────────────────────────────────────────── */

[hidden] {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* ─── Browse Overrides for Vault Layout ─────────────────────────────────
   send-browse.css caps .sb-file__markdown at max-width: 800px for the
   wide-screen Send share view. Inside vault chrome the file panel is
   already narrower, so the cap leaves a ~40% empty column on the right.
   Let markdown fill the available width in vault. App Mode applies the
   same override via sg-app-banner.js — this makes it the default. */
.sb-file__markdown {
    max-width: 100% !important;
}

/* ─── Markdown Print Page-Break Marker ───────────────────────────────────
   .md-pb-marker is injected by MarkdownParser in two cases:
     1. front matter page_break_before: [h1, h2]  — auto before heading levels
     2. inline directive <!-- page-break -->         — explicit manual break

   SCREEN: renders as a labelled dashed rule so authors see where breaks fall.
   PRINT:  becomes an invisible zero-height element with page-break-after:always
           so the content after it starts on the next printer page.

   The <style class="md-print-css"> inserted by MarkdownRenderer for print_css
   front matter values lands BEFORE all other content inside .sb-file__markdown,
   so author overrides win over everything below. */

.md-pb-marker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem 0 0.5rem;
    color: #aaa;
    font-size: 10px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    user-select: none;
    pointer-events: none;
}

.md-pb-marker::before,
.md-pb-marker::after {
    content: '';
    flex: 1;
    border-top: 1px dashed #ccc;
}

.md-pb-marker__label {
    flex-shrink: 0;
    padding: 1px 6px;
    border: 1px dashed #ccc;
    border-radius: 3px;
    color: #bbb;
}

/* ─── Front Matter Badge (screen only) ──────────────────────────────────────
   .md-frontmatter is generated by MarkdownParser._fmBadgeHtml() when a file
   has YAML front matter. Shown as a compact settings strip above the content.
   Hidden in print — doc settings are metadata, not content. */
.md-frontmatter {
    display: flex;   /* inline styles also set this; class gives @media print a hook */
}

@media print {
    /* Hidden in print — front-matter settings are not document content */
    .md-frontmatter {
        display: none !important;
    }

    /* The marker becomes an invisible page-break trigger.
       page-break-after:always on a zero-height element = start next page
       immediately before the following content (the heading). */
    .md-pb-marker {
        display: block !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        overflow: hidden !important;
        page-break-after: always;  /* CSS 2.1 */
        break-after: page;         /* CSS 3   */
    }
    .md-pb-marker__label {
        display: none !important;
    }
    /* Prevent orphaned headings: keep h2+ glued to the content that follows */
    .sb-file__markdown h2,
    .sb-file__markdown h3,
    .sb-file__markdown h4 {
        page-break-after: avoid;
        break-after: avoid;
    }
    /* Avoid breaking inside code blocks, blockquotes, and tables */
    .sb-file__markdown pre,
    .sb-file__markdown blockquote,
    .sb-file__markdown table {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
