/* ============================================================
   OER Remix Platform - Main Stylesheet
   ============================================================ */

:root {
    --oer-primary: #2563eb;
    --oer-primary-dark: #1d4ed8;
    --oer-secondary: #059669;
    --oer-accent: #d97706;
    --oer-dark: #1e293b;
    --oer-light: #f8fafc;
    --oer-border: #e2e8f0;
    --oer-text: #334155;
    --oer-text-muted: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--oer-text);
    background-color: var(--oer-light);
}

/* ============================================================
   Navigation
   ============================================================ */

.navbar-brand {
    font-size: 1.25rem;
}

.navbar-brand .bi-book {
    color: var(--oer-accent);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    border: 1px solid var(--oer-border);
    border-radius: 0.5rem;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--oer-border);
    font-weight: 600;
}

/* ============================================================
   Book Cards
   ============================================================ */

.book-card {
    height: 100%;
}

.book-card .card-img-top {
    height: 200px;
    object-fit: cover;
    background-color: var(--oer-primary);
}

.book-card .book-placeholder-cover {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--oer-primary) 0%, var(--oer-primary-dark) 100%);
    color: white;
    font-size: 3rem;
}

.license-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e0f2fe;
    color: #0369a1;
}

.license-badge.license-cc0 {
    background-color: #dcfce7;
    color: #166534;
}

.license-badge.license-nd {
    background-color: #fef2f2;
    color: #991b1b;
}

/* ============================================================
   Forms
   ============================================================ */

.form-label {
    font-weight: 500;
    color: var(--oer-dark);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--oer-primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
    background-color: var(--oer-primary);
    border-color: var(--oer-primary);
}

.btn-primary:hover {
    background-color: var(--oer-primary-dark);
    border-color: var(--oer-primary-dark);
}

.btn-success {
    background-color: var(--oer-secondary);
    border-color: var(--oer-secondary);
}

/* ============================================================
   TOC Builder
   ============================================================ */

.toc-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    background: #fff;
    border: 1px solid var(--oer-border);
    border-radius: 0.375rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toc-item:active {
    cursor: grabbing;
}

.toc-item .drag-handle {
    color: var(--oer-text-muted);
    cursor: grab;
}

.toc-item.sortable-ghost {
    opacity: 0.4;
    background-color: #dbeafe;
}

.toc-item.toc-front-matter {
    border-left: 3px solid var(--oer-text-muted);
}

.toc-item.toc-body {
    border-left: 3px solid var(--oer-primary);
}

.toc-item.toc-back-matter {
    border-left: 3px solid var(--oer-accent);
}

/* ============================================================
   Dashboard Stats
   ============================================================ */

.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--oer-primary);
}

.stat-card .stat-label {
    color: var(--oer-text-muted);
    font-size: 0.875rem;
}

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--oer-text-muted);
}

.empty-state .bi {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* ============================================================
   Accessibility
   ============================================================ */

:focus-visible {
    outline: 3px solid var(--oer-primary);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--oer-primary);
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ============================================================
   Utilities
   ============================================================ */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

/* ============================================================
   Parts in TOC
   ============================================================ */

.part-group {
    transition: box-shadow 0.2s ease;
}

.part-group.sortable-ghost {
    opacity: 0.4;
}

.part-group .card-header {
    cursor: default;
    padding: 0.5rem 0.75rem;
}

.part-drag-handle {
    cursor: grab;
}

.part-drag-handle:active {
    cursor: grabbing;
}

.part-title {
    font-size: 0.95rem;
}

.chapter-list-in-part {
    min-height: 40px;
}

.empty-part-msg {
    pointer-events: none;
}

/* TOC list min height for drag targets */
.toc-list {
    min-height: 20px;
}

/* TOC section headers */
.toc-section h2 {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* ============================================================
   Footer Contrast Fix
   ============================================================ */

footer.bg-dark .text-muted {
    color: #94a3b8 !important;
}

footer.bg-dark a.text-muted,
footer.bg-dark .text-muted a {
    color: #cbd5e1 !important;
}

footer.bg-dark a.text-muted:hover,
footer.bg-dark .text-muted a:hover {
    color: #f1f5f9 !important;
}
