/* ============================================================
   Oak-Ed – Web Awesome base styles
   ============================================================ */

html, body {
    min-height: 100%;
    padding: 0;
    margin: 0;
}

/* wa-page banner — logo strip above the header */
.site-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.8125rem;
}
.site-banner-logo {
    height: 52px;
    width: auto;
}

/* Header layout: brand left, user dropdown right */
.site-header {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.25rem;
    padding: 0 1.5rem;
}
.site-header .brand {
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Sidebar width */
wa-page {
    --menu-width: 200px;
}

/* Main layout */
.page-main {
    padding: 2rem 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

/* Page header row */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1,
.page-header h2 {
    margin: 0;
}

/* Grid layouts */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
.centered {
    max-width: 900px;
    margin: 0 auto;
}
.centered-sm {
    max-width: 560px;
    margin: 0 auto;
}

/* Content cards */
.content-card {
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.content-card-light {
    border-radius: 0.5rem;
    padding: 1rem;
}
.content-card-flush {
    padding: 0;
    overflow: hidden;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    text-align: left;
    padding: 0.625rem 0.875rem;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-table td {
    padding: 0.75rem 0.875rem;
    vertical-align: middle;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Form fields (for Django-rendered native inputs) */
.form-field {
    margin-bottom: 1rem;
}
.form-field > label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field input[type="url"],
.form-field select,
.form-field textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field select[multiple] {
    height: auto;
    padding: 0.25rem;
}
.form-field select[multiple] option {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}
.form-field input[type="checkbox"] {
    width: auto;
    margin-right: 0.375rem;
}
.field-error {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}
.field-help {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Input with addon button (e.g. ISBN + Fetch) */
.input-addon {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.input-addon > *:first-child {
    flex: 1;
}

/* Badge lists */
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

/* Button rows */
.button-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.875rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
}
.breadcrumb li {
    display: flex;
    align-items: center;
}
.breadcrumb li + li::before {
    content: '/';
    margin: 0 0.5rem;
}
.breadcrumb a {
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb .active a {
    pointer-events: none;
}

/* Meta info flex row (title + date) */
.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* htmx indicator */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* Dialogs */
wa-dialog {
    --width: 520px;
}

/* Text helpers */
.text-muted {
    font-size: 0.875rem;
}
.text-sm  { font-size: 0.875rem; }
.text-xs  { font-size: 0.75rem; }
.text-base { font-size: 1rem; }
.text-lg  { font-size: 1.1rem; }
.text-center { text-align: center; }

/* Spacing */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* Layout */
.w-full  { width: 100%; }
.hidden  { display: none; }
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.font-mono { font-family: monospace; font-size: 0.85rem; }

/* Empty table / list state */
.empty-state {
    text-align: center;
    padding: 2rem;
}

/* Prose / markdown-rendered content */
.content { line-height: 1.7; }
.content p { margin: 0 0 0.875rem; }
.content p:last-child { margin-bottom: 0; }
.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6 {
    font-weight: 600;
    line-height: 1.3;
    margin: 1.5rem 0 0.5rem;
}
.content h1 { font-size: 1.75rem; }
.content h2 { font-size: 1.4rem; }
.content h3 { font-size: 1.15rem; }
.content ul, .content ol { padding-left: 1.5rem; margin: 0 0 0.875rem; }
.content li { margin-bottom: 0.25rem; }
.content code {
    font-family: monospace;
    font-size: 0.875em;
    padding: 0.1em 0.35em;
    border-radius: 0.25rem;
}
.content pre {
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 0 0 0.875rem;
}
.content blockquote {
    margin: 0 0 0.875rem;
    padding: 0.25rem 0 0.25rem 1rem;
}
.content a {
    text-decoration: none;
}
.content a:hover { text-decoration: underline; }
.content hr {
    border: none;
    margin: 1.25rem 0;
}
.content strong { font-weight: 600; }

/* Subtitle style */
.page-subtitle {
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

/* ============================================================
   Sidebar navigation (wa-page navigation slot)
   ============================================================ */

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
}
.drawer-nav a {
    text-decoration: none;
    padding: 0.75rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    min-height: 44px;
}

/* ============================================================
   Responsive (desktop-first: max-width overrides)
   ============================================================ */

/* Table scroll wrapper — always active so overflow:hidden on the card never clips content */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 768px — grids collapse to single column */
@media (max-width: 768px) {
    .grid-3, .grid-2-1, .grid-2 { grid-template-columns: 1fr; }
}

/* 480px — phone portrait adjustments */
@media (max-width: 480px) {
    .page-main { padding: 1.25rem 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    wa-dialog { --width: min(520px, calc(100vw - 2rem)); }
}

/* Dashboard overdue alert */
.dashboard-overdue {
    border-left: 4px solid var(--wa-color-warning-600, #d97706);
    background: var(--wa-color-warning-50, #fffbeb);
}

/* Filterable checkbox tag selector */
.filterable-checkbox-list {
    border: 1px solid var(--wa-color-neutral-200, #e5e7eb);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.filterable-checkbox-search {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--wa-color-neutral-300, #d1d5db);
    border-radius: 0.25rem;
    font-size: 0.875rem;
    box-sizing: border-box;
}

.filterable-checkbox-list .checkbox-scroll {
    max-height: 180px;
    overflow-y: auto;
}

.filterable-checkbox-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
