/* Fonts */
@font-face { font-family: 'Libre Baskerville'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/libre-baskerville-400.woff2') format('woff2'); }
@font-face { font-family: 'Libre Baskerville'; font-style: italic; font-weight: 400; font-display: swap; src: url('/static/fonts/libre-baskerville-400i.woff2') format('woff2'); }
@font-face { font-family: 'Libre Baskerville'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/libre-baskerville-700.woff2') format('woff2'); }
@font-face { font-family: 'Almarai'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/almarai-400.woff2') format('woff2'); }
@font-face { font-family: 'Almarai'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/almarai-700.woff2') format('woff2'); }

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

:root {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: hsl(241, 69%, 68%);
    --color-primary-hover: hsl(241, 69%, 58%);
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-success: #16a34a;
    --color-flash-bg: hsl(241, 69%, 95%);
    --color-flash-text: hsl(241, 69%, 35%);
    --radius: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
}

body {
    font-family: 'Almarai', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 0 1rem; width: 100%; }
main.container { flex: 1; padding-top: 2rem; padding-bottom: 2rem; }
main.container img { max-width: 100%; height: auto; }
/* Quill alignment classes (needed in view mode outside the editor). */
.ql-align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
/* Quill resize module alignment classes. */
.ql-resize-style-left { float: left; margin: 0 1em 1em 0; }
.ql-resize-style-center { display: block; margin: auto; text-align: center; }
.ql-resize-style-right { float: right; margin: 0 0 1em 1em; }

/* Nav */
.nav { background: var(--color-surface); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.nav-inner { max-width: 960px; margin: 0 auto; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1.5rem; }
.nav-brand { font-weight: 700; text-decoration: none; color: var(--color-text); font-size: 1.1rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { text-decoration: none; color: var(--color-muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--color-text); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--color-muted); }

/* Footer */
.footer { border-top: 1px solid var(--color-border); padding: 1rem 0; color: var(--color-muted); text-align: center; }

/* Flash messages */
.flash { background: var(--color-flash-bg); color: var(--color-flash-text); padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* Typography */
h1, h2, h3 { font-family: 'Libre Baskerville', Georgia, serif; }
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border-radius: var(--radius); border: 1px solid transparent;
    font-size: 0.875rem; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: var(--color-danger-hover); }
.btn-ghost { background: transparent; color: var(--color-muted); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.9rem; font-family: inherit;
    background: var(--color-surface);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px hsla(241,69%,68%,0.15);
}
.form-group textarea { resize: vertical; min-height: 5rem; }

/* Cards / panels */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.card-question {
    border-left: 4px solid var(--color-primary);
}

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted); }
tr:last-child td { border-bottom: none; }

/* Utility */
.inline { display: inline; }
.text-muted { color: var(--color-muted); }
.text-sm { font-size: 0.85rem; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Radio labels */
.radio-label {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); margin-bottom: 0.5rem;
    cursor: pointer; font-size: 0.9rem;
    transition: background 0.15s, border-color 0.15s;
}
.radio-label:hover { background: var(--color-bg); }
.radio-label input[type="radio"] { display: none; }
.radio-label:has(:checked) { background: var(--color-flash-bg); border-color: var(--color-primary); color: var(--color-flash-text); font-weight: 500; }

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