/* ==========================================================================
   LTIC Theme — unified styling for UBC Learning Technology Hub apps
   Built from ltic-access-request-hub + ltic-operations-hub
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* UBC brand palette */
  --ubc-blue:        #002145;  /* primary navy */
  --ubc-blue-light:  #0055B7;  /* interactive blue */
  --ubc-teal:        #00A499;  /* success / positive */
  --ubc-gold:        #F5A623;  /* warning / in-progress */

  /* Neutrals */
  --ubc-grey-light:  #F8F9FA;  /* card backgrounds, table headers */
  --ubc-grey-border: #DEE2E6;  /* card and divider borders */
  --ubc-bg-app:      #f8fafc;  /* app shell main-area background */
  --ubc-text:        #202020;
  --ubc-text-muted:  #6c757d;

  /* Sidebar */
  --sidebar-width:        220px;
  --sidebar-bg:           var(--ubc-blue);
  --sidebar-active-bar:   #6fa8d6;

  /* Layout */
  --content-padding:      2rem;
  --radius-sm:            0.375rem;
  --radius-md:            0.5rem;
}

/* --------------------------------------------------------------------------
   Bootstrap primary recolor
   -------------------------------------------------------------------------- */
.btn-primary,
.bg-primary {
  background-color: var(--ubc-blue-light) !important;
  border-color:     var(--ubc-blue-light) !important;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--ubc-blue) !important;
  border-color:     var(--ubc-blue) !important;
}
.btn-outline-primary {
  color:        var(--ubc-blue-light) !important;
  border-color: var(--ubc-blue-light) !important;
}
.btn-outline-primary:hover {
  background-color: var(--ubc-blue-light) !important;
  color: #fff !important;
}
a       { color: var(--ubc-blue-light); }
a:hover { color: var(--ubc-blue); }

/* --------------------------------------------------------------------------
   Layout: shared shell
   -------------------------------------------------------------------------- */
html, body { height: 100%; margin: 0; }
body       { color: var(--ubc-text); }

/* Sidebar layout shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.app-shell .main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--ubc-bg-app);
}
.app-shell .main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--content-padding);
  padding-bottom: 3rem;
}

/* Navbar layout: body grows; main is container-bounded with padding */
.navbar-layout main      { padding: 1.5rem 0 2rem; }
.navbar-layout .main-content { /* nothing — container handles width */ }

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
@media (min-width: 992px) {
  .sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--sidebar-bg) !important;
  }
  .sidebar .offcanvas-body {
    flex-direction: column;
    overflow-y: auto;
  }
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.sidebar-logo-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.sidebar-wordmark {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  border-right: 1px solid rgba(255,255,255,0.3);
  padding-right: 0.65rem;
}
.sidebar-app-name {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.03em;
}
.sidebar-nav {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: color 0.15s, background-color 0.15s;
}
.sidebar-nav li a i {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-nav li a:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.07);
}
.sidebar-nav li a.active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.10);
  border-left-color: var(--sidebar-active-bar);
}
.sidebar-user {
  color: rgba(255, 255, 255, 0.65) !important;
}
.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 1.25rem 1rem 0.25rem;
}

/* --------------------------------------------------------------------------
   Mobile toggle bar (visible below lg breakpoint)
   -------------------------------------------------------------------------- */
.sidebar-toggle-bar {
  background-color: var(--sidebar-bg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
}
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}
.sidebar-toggle-btn:hover {
  color: rgba(255, 255, 255, 0.75);
}
.sidebar-toggle-logo {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.sidebar-toggle-title {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   Responsive: mobile layout adjustments (below lg)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .sidebar-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  .app-shell {
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .app-shell .main-content {
    padding: 1rem;
  }
  .sidebar .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.85rem 1rem;
  }
}

/* --------------------------------------------------------------------------
   Top navbar (alternate layout)
   -------------------------------------------------------------------------- */
.ubc-navbar { background-color: var(--ubc-blue); padding: 0.75rem 0; }
.ubc-wordmark {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  border-right: 1px solid rgba(255,255,255,0.3);
  padding-right: 0.75rem;
  margin-right: 0.5rem;
}
.navbar-title  { font-size: 0.95rem; color: rgba(255,255,255,0.9); }
.nav-logout    { color: rgba(255,255,255,0.7) !important; }
.nav-logout:hover { color: #fff !important; }

/* --------------------------------------------------------------------------
   Footer (used with navbar layout)
   -------------------------------------------------------------------------- */
.ubc-footer  { background-color: var(--ubc-blue); color: rgba(255,255,255,0.75); }
.footer-link { color: rgba(255,255,255,0.9); }
.footer-link:hover { color: #fff; }

/* --------------------------------------------------------------------------
   Impersonation banner (security/audit context)
   -------------------------------------------------------------------------- */
.impersonation-banner {
  background-color: #b02a37;
  color: #fff;
  font-size: 0.9rem;
  border-bottom: 2px solid #8a1f2a;
}
.impersonation-banner strong { color: #fff; }

/* --------------------------------------------------------------------------
   Page header (reusable partial)
   -------------------------------------------------------------------------- */
.page-header {
  border-bottom: 1px solid var(--ubc-grey-border);
  padding-bottom: 1rem;
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.5rem;
  color: var(--ubc-blue);
  margin-bottom: 0.25rem;
}
.page-header .page-subtitle {
  color: var(--ubc-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card        { border: 1px solid var(--ubc-grey-border); border-radius: var(--radius-md); }
.card-header { background-color: var(--ubc-grey-light); border-bottom: 1px solid var(--ubc-grey-border); }

/* Dashboard metric cards */
.card-metric              { text-align: center; }
.card-metric .display-6   { font-weight: 600; }

/* --------------------------------------------------------------------------
   Status badges — semantic palette
   Apps add project-specific aliases on top (e.g. .badge-approved → success)
   -------------------------------------------------------------------------- */
.badge-success { background-color: var(--ubc-teal);       color: #fff; }
.badge-warning { background-color: var(--ubc-gold);       color: #212529; }
.badge-danger  { background-color: #b02a37;               color: #fff; }
.badge-info    { background-color: var(--ubc-blue-light); color: #fff; }
.badge-neutral { background-color: #6c757d;               color: #fff; }
.badge-muted   { background-color: #adb5bd;               color: #212529; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-label        { font-weight: 500; }
.required-mark     { color: #dc3545; }
.form-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ubc-blue);
  border-bottom: 2px solid var(--ubc-blue-light);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
  margin-top: 1.75rem;
}

/* Form-input placeholders — lighter + italic so they read as hints,
   not pre-filled values. Bootstrap's default (#6c757d) was confusing
   instructors who mistook the example for a real default. */
.form-control::placeholder {
  color: #adb5bd;        /* Bootstrap gray-500 — lighter than text-muted */
  font-style: italic;
  opacity: 1;            /* Firefox lowers opacity by default; force full color */
}

/* Validation errors — make .is-invalid clearly visible.
   Bootstrap's default is a thin red border; users were missing it.
   Add a thicker border, a soft red wash, and a stronger focus ring. */
.form-control.is-invalid,
.form-select.is-invalid {
  border-width: 2px;
  background-color: #fff5f5;
}
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
.invalid-feedback {
  font-weight: 500;
}

/* TBD / placeholder values — flag missing data without breaking layout */
.tbd-value {
  background-color: #fff3cd;
  border-left: 3px solid #ffc107;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}
.form-select.is-tbd,
.form-control.is-tbd {
  background-color: #fff3cd;
  border-color: #ffc107;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table th { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Timeline (audit log / status history)
   -------------------------------------------------------------------------- */
.timeline {
  border-left: 3px solid var(--ubc-blue-light);
  padding-left: 1.25rem;
}
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.56rem;
  top: 0.3rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--ubc-blue-light);
  border: 2px solid #fff;
}

/* --------------------------------------------------------------------------
   Rich text (Quill output, agreement text, descriptions)
   -------------------------------------------------------------------------- */
.rich-text-content p             { margin-bottom: 0.75rem; }
.rich-text-content p:last-child  { margin-bottom: 0; }
.rich-text-content ul,
.rich-text-content ol            { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.rich-text-content a             { color: var(--ubc-blue-light); }
.rich-text-content strong        { font-weight: 600; }

.agreement-box {
  background: var(--ubc-grey-light);
  border: 1px solid var(--ubc-grey-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.875rem;
  white-space: pre-wrap;
  margin-bottom: 0.75rem;
}
