/* BRA Editorial — Dark Theme */
:root {
    --bg: #18181b;
    --bg-card: #27272a;
    --bg-input: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --teal: #007694;
    --orange: #B74B15;
    --green: #22c55e;
    --red: #ef4444;
    --border: #3f3f46;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color 0.2s;
}
.card:hover {
    border-color: var(--teal);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 9999px;
    white-space: nowrap;
}
.badge-draft     { background: var(--bg-input); color: var(--text-muted); }
.badge-editing   { background: rgba(0,118,148,0.2); color: var(--teal); }
.badge-scheduled { background: rgba(183,75,21,0.2); color: var(--orange); }
.badge-published { background: rgba(34,197,94,0.2); color: var(--green); }
.badge-failed    { background: rgba(239,68,68,0.2); color: var(--red); }
.badge-approved  { background: rgba(34,197,94,0.2); color: var(--green); }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
    margin-bottom: 1.5rem;
}
.tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 0.9rem;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--teal);
    border-bottom-color: var(--teal);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Slide grid */
.slide-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.slide-card {
    flex: 0 0 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.slide-card img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    display: block;
}
.slide-card textarea {
    width: 100%;
    resize: vertical;
}

/* Forms */
textarea, input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="datetime-local"], select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s;
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus,
input[type="email"]:focus, input[type="url"]:focus, input[type="datetime-local"]:focus, select:focus {
    outline: none;
    border-color: var(--teal);
}
textarea {
    min-height: 80px;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    color: var(--text);
    transition: opacity 0.15s, filter 0.15s;
    white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--teal); }
.btn-secondary { background: var(--bg-input); }
.btn-success   { background: var(--green); color: #000; }
.btn-danger    { background: var(--red); }
.btn-orange    { background: var(--orange); }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Post sections */
.post-section {
    margin-bottom: 1.5rem;
}
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.schedule-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.schedule-row:last-child { border-bottom: none; }

/* Hero section */
.hero-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.hero-image {
    width: 300px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
}
.hero-image img {
    width: 100%;
    display: block;
}
.hero-info {
    flex: 1;
    min-width: 0;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 20vh auto 0;
    padding: 0 1rem;
}

/* HTMX indicators */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid var(--text-muted);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid var(--red);
    color: var(--red);
}
.flash-success {
    background: rgba(34,197,94,0.15);
    border: 1px solid var(--green);
    color: var(--green);
}

/* Template class aliases */
.platform-tabs { display: flex; border-bottom: 1px solid var(--border); gap: 0; margin-bottom: 1.5rem; }
.tab-btn {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    font-size: 0.9rem;
    transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.pub-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.pub-header h1 { font-size: 1.5rem; }
.back-link { color: var(--text-muted); font-size: 0.85rem; display: block; margin-bottom: 0.5rem; }
.hero-meta { flex: 1; min-width: 0; }
.hero-meta h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.teaser { color: var(--text-muted); margin-bottom: 0.5rem; }
.article-link { font-size: 0.9rem; }
.editor-footer { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); padding: 1rem 0; display: flex; justify-content: center; gap: 0.75rem; z-index: 10; }
.btn-publish { font-size: 1rem; padding: 0.75rem 2rem; }
.publish-spinner { font-size: 0.85rem; }

.caption-block { margin-top: 1rem; }
.caption-text { min-height: 120px; }

.slide-meta { padding: 0.5rem 0.75rem; display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
.slide-number { font-weight: 600; }
.slide-type { text-transform: capitalize; }
.slide-image { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; }
.slide-image-placeholder { width: 100%; aspect-ratio: 4/5; display: flex; align-items: center; justify-content: center; background: var(--bg-input); color: var(--text-muted); font-size: 0.8rem; }
.slide-text { width: 100%; border: none; border-top: 1px solid var(--border); background: var(--bg); color: var(--text); padding: 0.5rem 0.75rem; font-size: 0.8rem; min-height: 60px; resize: vertical; font-family: inherit; }

/* Footer actions */
.footer-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    z-index: 10;
}
