/* ============================================
   CHERRYWOOD PORTAL — v6
   ============================================ */

:root {
  --green:       #1C3320;
  --green-mid:   #2D5A3D;
  --burgundy:    #7A1E2E;
  --cream:       #F5F0E8;
  --cream-dark:  #EDE5D2;
  --surface:     #FFFFFF;
  --border:      #E0D8CC;
  --text:        #1A1A1A;
  --text-muted:  #6B6259;
  --sidebar-w:   210px;
  --radius:      10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Lora', Georgia, serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--burgundy); color: #fff; }
.btn--ghost   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--sm      { padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.btn--full    { width: 100%; justify-content: center; }
.btn:hover    { opacity: 0.85; }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  padding: 1rem;
}
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.login-title { font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--green); text-align: center; }
.login-sub   { text-align: center; color: var(--text-muted); margin-top: -0.8rem; font-size: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.field input  { padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 1rem; }
.error-msg { color: #c0392b; font-size: 0.85rem; }

/* ── HEADER ── */
.portal-header {
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.portal-header__title { font-family: 'Playfair Display', serif; font-size: 1.3rem; }
.portal-header__right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.user-email { font-size: 0.8rem; opacity: 0.7; }
.portal-header .btn--ghost { border-color: rgba(255,255,255,0.3); color: #fff; }

/* ── APP LAYOUT ── */
.app-body {
  display: flex;
  min-height: calc(100vh - 52px);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--green);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.8rem 1.3rem;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.58);
  cursor: pointer;
  text-align: left;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.tab-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}
.tab-btn--active {
  color: #fff;
  background: rgba(255,255,255,0.13);
  border-left-color: var(--burgundy);
  font-weight: 600;
}

.content-area {
  flex: 1;
  overflow: auto;
  background: var(--cream);
}

/* ── TAB PANELS ── */
.tab-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.panel-title { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--green); }
.empty-msg { text-align: center; color: var(--text-muted); padding: 2rem; font-style: italic; }

/* ── FILTERS ── */
.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}
.filter-btn--active { background: var(--green); color: #fff; border-color: var(--green); }
.filter-btn--ghost  { font-size: 0.72rem; opacity: 0.5; border-style: dashed; margin-left: auto; }
.filter-btn--ghost.filter-btn--active { opacity: 1; background: #666; border-color: #666; border-style: solid; }

/* ── DATA CARDS ── */
.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.data-card--muted { opacity: 0.5; }
.data-card--past  { opacity: 0.7; border-left: 3px solid #c8b896; }

.bookings-divider {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 0 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
}

.data-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap; }
.data-card__title  { font-weight: 600; font-size: 0.95rem; }
.data-card__badge  { font-size: 0.75rem; font-family: monospace; color: var(--text-muted); }
.data-card__body   { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.88rem; color: var(--text-muted); }
.data-card__notes  { font-style: italic; }
.tag { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tag--cancelled { color: #c0392b; }
.tag--complete  { color: #2e7d32; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--green);
  margin-bottom: 0.5rem;
}

/* ── INLINE FORMS ── */
.inline-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.inline-form input { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 0.95rem; width: 100%; }
.inline-form__actions { display: flex; gap: 0.5rem; }

/* ── VTO ── */
.vto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .vto-grid { grid-template-columns: 1fr; } }
.vto-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.vto-block h3 { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--green); border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.vto-block p  { font-size: 0.9rem; line-height: 1.6; }
.vto-block ul { padding-left: 1.2rem; font-size: 0.9rem; line-height: 1.8; }

/* ── COURSE STATUS ── */
.course-open   { background: #2e7d32; color: #fff; border: none; }
.course-closed { background: #c0392b; color: #fff; border: none; }

/* ── PROCESS LIBRARY ── */
.drive-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.drive-banner h3 { font-family: 'Playfair Display', serif; font-size: 1.05rem; margin-bottom: 0.25rem; }
.drive-banner p  { font-size: 0.85rem; opacity: 0.72; }
.drive-banner .btn { background: var(--burgundy); color: #fff; border: none; flex-shrink: 0; }

.lib-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--green);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--cream-dark);
}

.lib-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.lib-category__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  background: var(--cream-dark);
  padding: 0.55rem 1rem;
}
.lib-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  cursor: default;
  transition: background 0.12s;
}
.lib-item:hover { background: #faf7f2; }
.lib-badge {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.lib-badge--doc   { background: #e4ede8; color: #2a5a3a; }
.lib-badge--video { background: #f5e8eb; color: var(--burgundy); }
.lib-coming { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); font-style: italic; }

.training-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.training-card__info { display: flex; flex-direction: column; gap: 0.2rem; }
.training-card__name  { font-weight: 600; font-size: 0.92rem; }
.training-card__track { font-size: 0.8rem; color: var(--text-muted); }
.training-card__prog  {
  font-size: 0.75rem;
  background: var(--cream-dark);
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ── PERMISSION TOGGLES ── */
.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.4rem;
}
.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 1rem;
}
.perm-row:last-child { border-bottom: none; }
.perm-row__label { font-size: 0.88rem; color: var(--text); }

.perm-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.perm-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.perm-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}
.perm-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.perm-toggle input:checked + .perm-slider { background: var(--green); }
.perm-toggle input:checked + .perm-slider::after { transform: translateX(18px); }

/* ── ROLE SELECT ── */
.role-select {
  font-family: inherit;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.85rem;
  background: #fff;
}

/* ── HAMBURGER (mobile only) ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: opacity 0.2s;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 149;
}
.sidebar-overlay--visible { display: block; }

/* ── MOBILE ── */
@media (max-width: 700px) {
  .hamburger { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100vh;
    z-index: 150;
    padding-top: 3.5rem;
    transition: left 0.25s ease;
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar--open { left: 0; }

  .portal-header { position: sticky; top: 0; z-index: 100; }
  .tab-panel { padding: 1.25rem 1rem 3rem; }
  .drive-banner { flex-direction: column; align-items: flex-start; }
}
