/* Acutelines Protocol Review — UMCG/Acutelines Branding + SuperDoc editor */
:root {
    --umcg-blue: #001158;
    --acutelines-blue: #1B3F7B;
    --acutelines-orange: #E88A1A;
    --primary: var(--umcg-blue);
    --primary-light: var(--acutelines-blue);
    --primary-dark: #000B3A;
    --accent: var(--acutelines-orange);
    --accent-light: #F5A623;
    --success: #27ae60;
    --danger: #c0392b;
    --bg: #F4F6FA;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #d1d5e0;
    --radius: 6px;
    --shadow: 0 1px 6px rgba(0,17,88,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
.logo-bar {
    background: #fff;
    padding: 0.7rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
}
.logo-bar-logos {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.logo-link { display: flex; align-items: center; gap: 1.5rem; text-decoration: none; }
.logo-bar-logos img { height: 42px; width: auto; display: block; }
.logo-bar-logos .divider { width: 1px; height: 30px; background: #d1d5e0; }

.user-chip {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--umcg-blue);
}
.user-chip img { width: 24px; height: 24px; border-radius: 50%; }
.chip-link {
    border: none; background: none; cursor: pointer;
    color: var(--umcg-blue); font-size: 0.82rem;
    padding: 0.2rem 0.5rem; border-radius: 4px;
    text-decoration: none; font-weight: 500;
}
.chip-link:hover { background: #f0f1f5; }

.header {
    background: var(--umcg-blue);
    color: #fff;
    padding: 0.7rem 2rem;
}
.header h1 { font-size: 1.2rem; font-weight: 600; }
.header .subtitle { font-size: 0.78rem; opacity: 0.75; margin-top: 0.1rem; }
.header-accent {
    height: 3px;
    background: linear-gradient(90deg, var(--acutelines-orange), var(--accent-light), var(--acutelines-orange));
}

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }
/* Wide container fills the viewport (used by the editor) */
.container.wide { max-width: none; margin: 0.5rem 0 0; padding: 0 0.75rem; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}
.card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--umcg-blue);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--acutelines-orange);
}
.card h3 {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    color: var(--acutelines-blue);
}

/* ── Upload ─────────────────────────────────────────────── */
.upload-area {
    display: block;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFBFD;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--acutelines-orange);
    background: rgba(232,138,26,0.04);
}
.upload-area .icon { font-size: 2.5rem; color: var(--text-light); margin-bottom: 0.5rem; }
.upload-area p { color: var(--text-light); font-size: 0.9rem; }
.upload-area .filename {
    color: var(--acutelines-orange);
    font-weight: 600;
    margin-top: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
}
.upload-area .filename.active { display: inline-flex; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
    font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--umcg-blue); color: #fff; }
.btn-primary:hover { background: var(--acutelines-blue); }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-accent { background: var(--acutelines-orange); color: #fff; }
.btn-accent:hover { background: #d07a15; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-outline {
    background: transparent;
    color: var(--umcg-blue);
    border: 1px solid var(--umcg-blue);
}
.btn-outline:hover { background: var(--umcg-blue); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
textarea, select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem; font-family: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--acutelines-blue);
    box-shadow: 0 0 0 3px rgba(27,63,123,0.12);
}

/* ── Badges/alerts ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-pending  { background: #fef3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-admin    { background: #dbe8ff; color: var(--umcg-blue); }
.badge-revoked  { background: #f8d7da; color: #721c24; }
.badge-processing { background: #dbe8ff; color: var(--umcg-blue); }
.badge-completed  { background: #d4edda; color: #155724; }
.badge-failed     { background: #f8d7da; color: #721c24; }

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin: 1rem 0;
}
.alert-info { background: #E8EDF8; color: var(--umcg-blue); border: 1px solid #C5CEE0; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.comments-box {
    background: #F7F8FC;
    border-left: 3px solid var(--acutelines-orange);
    padding: 1rem 1.2rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}
.comments-box.text-muted { color: var(--text-light); }

/* ── Spinner / loading ─────────────────────────────────────────────── */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--acutelines-orange);
    border-right-color: var(--umcg-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.loading-content {
    text-align: center;
    background: #fff;
    padding: 2rem 3rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,17,88,0.15);
    border-top: 3px solid var(--acutelines-orange);
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--umcg-blue);
    color: #fff;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,17,88,0.2);
    z-index: 9999;
    font-size: 0.9rem;
}

/* ── Editor grid ─────────────────────────────────────────────── */
.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 0.75rem;
    margin-top: 0.25rem;
    height: calc(100vh - 180px);
    min-height: 600px;
}
.editor-doc {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;  /* allow shrinking inside grid */
    height: 100%;
}
.doc-actions-row {
    display: flex; gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #FAFBFD;
    flex-shrink: 0;
}
.editor-toolbar-row {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0;
    min-height: 40px;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}
.sd-toolbar-slot {
    padding: 4px 8px;
    display: inline-block;
    min-width: max-content;
}
/* Make sure SuperDoc's toolbar children don't wrap */
.sd-toolbar-slot > * {
    white-space: nowrap;
    flex-wrap: nowrap !important;
}
/* Hide SuperDoc native save / download buttons — we use our own Download button */
.sd-toolbar-slot [title*="save" i],
.sd-toolbar-slot [title*="download" i],
.sd-toolbar-slot [aria-label*="save" i],
.sd-toolbar-slot [aria-label*="download" i],
.sd-toolbar-slot [data-test*="save" i],
.sd-toolbar-slot [data-test*="download" i] {
    display: none !important;
}
.sd-container {
    flex: 1;
    min-height: 0;        /* required for flex+overflow:auto to work */
    overflow: auto;       /* only the document area scrolls */
    background: #f5f7fa;
    padding: 1rem;
}
.editor-side {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    height: 100%;
}
.editor-side .side-section { padding: 1rem; margin-bottom: 0; }
.editor-side .side-section h3 { margin-bottom: 0.4rem; }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: 2rem;
}

/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.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; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
th { background: #EBEEF5; font-weight: 600; color: var(--umcg-blue); }
tr:hover td { background: rgba(0,17,88,0.02); }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}
.tab {
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--umcg-blue); border-bottom-color: var(--acutelines-orange); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 980px) {
    .editor-grid { grid-template-columns: 1fr; }
    .editor-side { display: contents; }
}
@media (max-width: 768px) {
    .logo-bar { padding: 0.6rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .logo-bar-logos img { height: 32px; }
    .header { padding: 0.5rem 1rem; }
    .container { padding: 0 1rem; }
    .card { padding: 1.25rem; }
    .upload-area { padding: 1.5rem; }
}
