/**
 * Author System — frontend styles (Author Studio + Become-an-Author tab).
 * Theme color via var(--madara-main-color) per CLAUDE.md §5. No hardcoded brand colors.
 */

.as-studio,
.as-become-author {
    --as-accent: var(--madara-main-color, #eb3349);
    color: #f0ebe3;
    line-height: 1.6;
}

/* ---- Flash messages ---- */
.as-flash {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 4px solid var(--as-accent);
    background: color-mix(in srgb, var(--as-accent) 12%, transparent);
    font-size: 14px;
}
.as-flash.as-msg-error {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.12);
}
.as-flash.as-msg-info {
    border-left-color: color-mix(in srgb, var(--as-accent) 60%, #888);
    background: color-mix(in srgb, var(--as-accent) 8%, transparent);
}

/* ---- Header row ---- */
.as-studio-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.as-studio-head h2 { margin: 6px 0 0; font-size: 22px; }

/* ---- Buttons ---- */
.as-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #f0ebe3 !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}
.as-btn:hover { background: rgba(255, 255, 255, 0.12); }
.as-btn-sm { padding: 5px 12px; font-size: 13px; }
.as-btn-primary {
    background: var(--as-accent);
    border-color: var(--as-accent);
    color: #fff !important;
}
.as-btn-primary:hover { background: color-mix(in srgb, var(--as-accent) 85%, #000); }
.as-btn-danger {
    background: transparent;
    border-color: rgba(231, 76, 60, 0.5);
    color: #e74c3c !important;
}
.as-btn-danger:hover { background: rgba(231, 76, 60, 0.15); }

/* ---- Badges ---- */
.as-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.as-badge-pending, .as-st-pending  { background: color-mix(in srgb, var(--as-accent) 20%, #333); color: #fff; }
.as-badge-approved, .as-st-publish { background: var(--as-accent); color: #fff; }
.as-badge-suspended                { background: rgba(231, 76, 60, 0.25); color: #ff9b91; }
.as-st-draft, .as-st-private       { background: rgba(255, 255, 255, 0.12); color: #ccc; }

/* ---- Story grid ---- */
.as-story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.as-story-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}
.as-story-cover { aspect-ratio: 3 / 4; background: #111; }
.as-story-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-no-cover {
    display: flex; align-items: center; justify-content: center;
    height: 100%; font-size: 48px; color: rgba(255, 255, 255, 0.2);
}
.as-story-body { padding: 12px; }
.as-story-body h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.35; }
.as-story-meta { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: #b5b5b5; }
.as-story-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Forms ---- */
.as-form { max-width: 760px; }
.as-field { margin-bottom: 18px; }
.as-field label { display: block; margin-bottom: 6px; }
.as-field small { display: block; margin-top: 5px; color: #9a9a9a; font-size: 12px; }
.as-form .form-control,
.as-become-author .form-control {
    width: 100%;
    padding: 9px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #f0ebe3;
    font-size: 14px;
}
.as-form .form-control:focus,
.as-become-author .form-control:focus {
    outline: none;
    border-color: var(--as-accent);
}
.as-price-input { max-width: 140px; }

/* ---- Term checkboxes ---- */
.as-term-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px 12px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}
.as-term { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; margin: 0; cursor: pointer; }
.as-term input { margin: 0; }

.as-cover-preview { margin-bottom: 8px; }
.as-cover-preview img { max-width: 140px; border-radius: 6px; }

/* ---- Editor ---- */
.as-editor-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}
.as-ed-btn {
    width: 34px; height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #f0ebe3;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}
.as-ed-btn:hover { background: var(--as-accent); border-color: var(--as-accent); color: #fff; }
.as-editor { font-family: inherit; line-height: 1.7; resize: vertical; }

/* ---- Chapter table ---- */
.as-chapter-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.as-chapter-table th,
.as-chapter-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
}
.as-chapter-table th { color: #b5b5b5; font-size: 12px; text-transform: uppercase; }
.as-row-actions { display: flex; gap: 6px; align-items: center; }
.as-inline-form { display: inline; margin: 0; }

.as-danger-zone {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.as-empty { padding: 24px; text-align: center; color: #9a9a9a; }
.as-form-actions { margin-top: 24px; }

/* Become-an-Author tab */
.as-become-author h3 { margin-top: 0; }
.as-become-author .as-intro { color: #b5b5b5; margin-bottom: 18px; }
.as-progress { margin: 14px 0; }

@media (max-width: 600px) {
    .as-studio-head { flex-direction: column; align-items: flex-start; }
    .as-story-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
