/* ============================================================
   LAB HUB — Design System
   Bonga University

   Palette carries the institutional forest+gold from BULMS for
   family continuity, plus a coffee-brown signature accent — a nod
   to Kaffa Zone, the historical birthplace of coffee. Paper texture
   throughout nods to the lab-notebook subject matter.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,500;1,6..72,600&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    /* Color */
    --forest:       #155e2f;
    --forest-deep:  #0c3d1e;
    --forest-mid:   #1f7a40;
    --forest-pale:  #d9ecdf;

    --coffee:       #6b3226;
    --coffee-pale:  #ecdfd8;

    --gold:         #c9971e;
    --gold-pale:    #f5e9c9;

    --paper:        #fbf8f2;
    --card:         #ffffff;
    --ink:          #1c2620;
    --ink-soft:     #52605a;
    --ink-faint:    #8b978f;
    --line:         #e5ded0;
    --line-soft:    #efe9dd;

    --red:          #b3261e;
    --red-bg:       #fbe9e7;
    --amber:        #9a6400;
    --amber-bg:     #fbf0d9;
    --green-ok:     #1f7a40;
    --green-ok-bg:  #dcf0e2;

    /* Type */
    --font-display: 'Newsreader', Georgia, serif;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    /* Shape / motion */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(28, 38, 32, .06), 0 2px 8px rgba(28, 38, 32, .04);
    --shadow-md: 0 4px 16px rgba(28, 38, 32, .10);
    --ease: cubic-bezier(.4, 0, .2, 1);

    --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--forest-deep);
    margin: 0 0 .4em;
    line-height: 1.2;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--forest); }
code, .mono { font-family: var(--font-mono); }

/* Subtle dot-grid "lab notebook" texture, used behind hero/branding panels */
.paper-grid {
    background-image: radial-gradient(var(--line) 1px, transparent 1px);
    background-size: 22px 22px;
}

/* Visible keyboard focus everywhere — accessibility floor, not optional */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--forest-mid);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .92rem;
    padding: .68em 1.3em;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .12s var(--ease);
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-mid); }
.btn-gold { background: var(--gold); color: var(--forest-deep); }
.btn-gold:hover { box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 1.1rem; }
.field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: .4em;
    letter-spacing: .01em;
}
.field .hint { font-size: .78rem; color: var(--ink-faint); margin-top: .35em; }
input[type="text"], input[type="password"], input[type="email"],
input[type="tel"], input[type="date"], input[type="number"],
select, textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: .95rem;
    padding: .65em .8em;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--forest-mid);
    box-shadow: 0 0 0 3px var(--forest-pale);
    outline: none;
}
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }

/* ============================================================
   Alerts / flash messages
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    padding: .8em 1em;
    font-size: .88rem;
    margin-bottom: 1.2rem;
    border: 1px solid transparent;
}
.alert-error   { background: var(--red-bg);     color: var(--red);     border-color: #f0c9c5; }
.alert-success { background: var(--green-ok-bg); color: var(--green-ok); border-color: #bfe4cb; }
.alert-info    { background: var(--gold-pale);  color: var(--coffee);  border-color: #e8d3a0; }

/* ============================================================
   Badges (role pills)
   ============================================================ */
.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .25em .7em;
    border-radius: 999px;
    background: var(--forest-pale);
    color: var(--forest-deep);
    letter-spacing: .02em;
}
.badge-gold { background: var(--gold-pale); color: var(--coffee); }

/* ============================================================
   Auth screens (login / register)
   ============================================================ */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.auth-brand {
    background: var(--forest-deep);
    color: #f4f8f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3.5rem;
    position: relative;
    overflow: hidden;
}
.auth-brand::before {
    content: "";
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: .6;
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 420px; }
.auth-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 2.5rem; }
.auth-logo img { height: 42px; width: 42px; border-radius: 8px; background: #fff; object-fit: contain; }
.auth-logo span { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.auth-brand h1 { color: #fff; font-size: 2.6rem; font-style: italic; margin-bottom: .3em; }
.auth-brand p { color: rgba(244,248,245,.78); font-size: 1.02rem; }
.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--paper);
}
.auth-card {
    width: 100%;
    max-width: 380px;
}
.auth-card h2 { margin-bottom: .2em; }
.auth-card .lead { color: var(--ink-soft); font-size: .9rem; margin-bottom: 1.8rem; }
.auth-links { display: flex; justify-content: space-between; font-size: .85rem; margin-top: 1.2rem; }

@media (max-width: 860px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { padding: 2.5rem 1.75rem; min-height: 220px; }
    .auth-brand h1 { font-size: 2rem; }
}

/* ============================================================
   App shell — sidebar + content
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--forest-deep);
    color: rgba(244,248,245,.82);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform .2s var(--ease);
}
.sidebar-brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.3rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand img { height: 34px; width: 34px; border-radius: 7px; background: #fff; object-fit: contain; }
.sidebar-brand strong { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: #fff; }
.sidebar-brand small { display: block; font-size: .68rem; color: var(--gold); letter-spacing: .07em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .9rem .7rem; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .62rem .8rem;
    margin-bottom: .15rem;
    border-radius: var(--radius-sm);
    color: rgba(244,248,245,.82);
    text-decoration: none;
    font-size: .89rem;
    font-weight: 500;
    transition: background-color .12s var(--ease);
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); }
.sidebar-nav a.active { background: rgba(201,151,30,.2); color: #fff; }
.sidebar-nav .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }

.sidebar-foot {
    padding: 1rem 1.2rem 1.3rem;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .78rem;
    color: rgba(244,248,245,.55);
}

.topbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.6rem;
}
.topbar h1 { font-size: 1.35rem; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: .7rem; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--forest); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .82rem;
    font-family: var(--font-body);
}
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: .4rem; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}
.content { padding: 1.8rem 1.6rem 3rem; max-width: 1180px; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.card-tab {
    border-top: 3px solid var(--gold);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

/* Placeholder ("coming soon") state for pages not yet built */
.placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ink-soft);
}
.placeholder .stamp {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .74rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--coffee);
    background: var(--coffee-pale);
    padding: .3em .8em;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ink-faint);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
}

/* Utility */
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.gap-2 { gap: .5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
