/* ============================
   LearnFromThis – Admin Theme
   ============================ */

:root {
    --lft-primary:        #2563eb;   /* blue */
    --lft-primary-soft:   #e5edff;
    --lft-primary-dark:   #1d4ed8;
    --lft-bg:             #f5f7fb;
    --lft-card-bg:        #ffffff;
    --lft-border:         #e0e3ec;
    --lft-border-soft:    #edf0f7;
    --lft-text:           #111827;
    --lft-muted:          #6b7280;
    --lft-danger:         #b91c1c;
    --lft-success:        #15803d;
}

/* Base */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--lft-bg);
    color: var(--lft-text);
}

/* Header + Top Navigation */

.lft-header {
    height:64px; background:#fff;
    border-bottom: 1px solid var(--lft-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.lft-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lft-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lft-logo-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--lft-primary), #9333ea);
}

.lft-app-name {
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 15px;
}

.lft-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--lft-muted);
}

.lft-user-name {
    font-weight: 600;
    color: #111827;
}

.lft-user-role {
    font-size: 12px;
    color: var(--lft-muted);
}

.lft-header-link {
    margin-left: 10px;
    text-decoration: none;
    font-size: 13px;
    color: var(--lft-primary-dark);
}

.lft-header-link:hover {
    text-decoration: underline;
}

.lft-main-nav {
    background: var(--lft-primary-soft);
    border-top: 1px solid var(--lft-border-soft);
}

.lft-main-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 6px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
}

.lft-main-nav a {
    text-decoration: none;
    color: #1f2937;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.4;
}

.lft-main-nav a:hover {
    background: #dbeafe;
    color: var(--lft-primary-dark);
}

/* Layout */

.lft-container {
    max-width: 1100px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

.lft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Cards */

.lft-card {
    background: var(--lft-card-bg);
    border-radius: 12px;
    border: 1px solid var(--lft-border-soft);
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(148, 163, 184, 0.25);
}

.lft-card h2 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.lft-card p {
    margin: 4px 0;
    font-size: 14px;
    color: #374151;
}

.lft-nav-links ul {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
}

.lft-nav-links li {
    margin: 4px 0;
}

.lft-nav-links a {
    font-size: 14px;
    text-decoration: none;
    color: var(--lft-primary-dark);
}

.lft-nav-links a:hover {
    text-decoration: underline;
}

/* Stats */

.lft-stat-number {
    font-size: 22px;
    font-weight: 700;
    margin-right: 4px;
}

.lft-stat-label {
    font-size: 12px;
    color: var(--lft-muted);
}

/* Forms */

.lft-form-panel {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--lft-border-soft);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(148, 163, 184, 0.2);
}

.lft-form-panel h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    margin-top: 4px;
    padding: 7px 9px;
    font-size: 14px;
    width: 75%;
    max-width: 480px;
    border-radius: 8px;
    border: 1px solid var(--lft-border);
    outline: none;
    background-color: #ffffff;
}

textarea {
    max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--lft-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Buttons */

.lft-btn {
    display: inline-block;
    border-radius: 999px;
    border: none;
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 500;
    background: var(--lft-primary);
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
}

.lft-btn:hover {
    background: var(--lft-primary-dark);
}

.lft-btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.lft-btn-secondary:hover {
    background: #d1d5db;
}

/* Tables */

.lft-table {
    border-collapse: collapse;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--lft-border-soft);
    font-size: 14px;
}

.lft-table th,
.lft-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #edf0f7;
}

.lft-table th {
    text-align: left;
    background: #f9fafb;
    font-size: 13px;
    color: #4b5563;
}

.lft-table tr:last-child td {
    border-bottom: none;
}

.lft-table tr:nth-child(even) td {
    background: #fbfcff;
}

.lft-table-small {
    font-size: 12px;
    color: var(--lft-muted);
}

/* Messages */

.lft-msg-success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.lft-msg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* Pagination */

.lft-pagination {
    margin-top: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lft-pagination a {
    text-decoration: none;
    color: var(--lft-primary-dark);
}

.lft-pagination .current {
    font-weight: 500;
}

/* Spacing helpers */

.lft-mt-1 { margin-top: 6px; }
.lft-mt-2 { margin-top: 12px; }
.lft-mt-3 { margin-top: 18px; }
.lft-mb-2 { margin-bottom: 12px; }

/* Dashboard layout tweaks */
.lft-dashboard {
    max-width: 1100px;
    margin: 24px auto 40px auto;
}

.lft-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 18px;
}

.lft-page-header h1 {
    margin: 0;
    font-size: 24px;
    color: #111827;
}

.lft-page-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #6b7280;
}

/* Stat cards */
.lft-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.lft-stat-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.lft-stat-number {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.lft-stat-label-main {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-top: 2px;
}

.lft-stat-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Card helper text */
.lft-card-intro {
    font-size: 13px;
    color: #6b7280;
    margin-top: 0;
    margin-bottom: 8px;
}

/* ============================
   Admin Shell (Sidebar Layout)
   ============================ */

.lft-admin-shell{
  max-width: 1100px;
  margin: 18px auto 40px;
  padding: 0 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Sidebar */
.lft-sidebar{
  width: 160px;
  flex: 0 0 160px;
  position: sticky;
  top: 78px; /* header height-ish; tweak if needed */
  align-self: flex-start;
}

/* Main content area */
.lft-main{
  flex: 1 1 auto;
  min-width: 0;
}

/* Prevent double max-width/margins inside lft-main */
.lft-main .lft-container{
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Sidebar groups */
.lft-nav-group{
  background: var(--lft-card-bg);
  border: 1px solid var(--lft-border-soft);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(148, 163, 184, 0.18);
  overflow: hidden;
  margin-bottom: 12px;
}

.lft-nav-group-title{
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  user-select: none;
  background: #ffffff;
  border-bottom: 1px solid var(--lft-border-soft);
}

/* Remove default marker + use subtle chevron feel */
.lft-nav-group summary{
  list-style: none;
}
.lft-nav-group summary::-webkit-details-marker{
  display: none;
}

.lft-nav-items{
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 2px;
}

.lft-nav-link{
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  color: #1f2937;
}

.lft-nav-link:hover{
  background: var(--lft-primary-soft);
  color: var(--lft-primary-dark);
}

.lft-nav-link.is-active{
  background: var(--lft-primary-soft);
  color: var(--lft-primary-dark);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Footer */
.lft-footer{
  margin-top: 18px;
  padding: 18px 0 28px;
  color: var(--lft-muted);
  font-size: 12px;
}
.lft-footer-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.lft-footer-dot{ opacity: 0.6; }

/* ============================
   Admin Shell + Sidebar Layout
   ============================ */

.lft-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.lft-sidebar {
  width: 200px;
  flex: 0 0 200px;
  position: sticky;
  top: 64px; /* keeps it below the topbar */
}

.lft-sidebar-inner {
  background: #fff;
  border: 1px solid var(--lft-border-soft);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(148, 163, 184, 0.18);
}

.lft-side-section + .lft-side-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--lft-border-soft);
}

.lft-side-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lft-muted);
  margin: 0 0 8px 0;
}

.lft-side-link {
  display: block;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  color: #111827;
  font-size: 14px;
}

.lft-side-link:hover {
  background: var(--lft-primary-soft);
  color: var(--lft-primary-dark);
}

.lft-side-link.is-active {
  background: var(--lft-primary);
  color: #fff;
}

.lft-side-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--lft-border-soft);
  font-size: 12px;
  color: var(--lft-muted);
}

/* Topbar replacement */

.lft-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--lft-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 200;
}

.lft-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lft-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lft-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--lft-muted);
}

.lft-topbar-link {
  text-decoration: none;
  color: var(--lft-primary-dark);
}

.lft-topbar-link:hover {
  text-decoration: underline;
}

/* Main content area */
.lft-main {
  flex: 1;
  min-width: 0;
}

/* Footer */
.lft-footer {
  margin-top: 24px;
  padding: 16px 0;
  color: var(--lft-muted);
  font-size: 12px;
}

.lft-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Mobile: collapse sidebar to top stack */
@media (max-width: 980px){
  .lft-admin-shell{
    flex-direction: column;
  }
  .lft-sidebar{
    width: 100%;
    flex: 0 0 auto;
    position: static;
    top: auto;
  }
}
/* =========================================================
   LFT inside App Shell: consistent spacing + sticky sidebar
   (last wins overrides)
========================================================= */

/* One source of truth for horizontal padding + gaps */
:root { --shell-gap: 12px; --shell-pad: 12px; }

/* Let the inner shell go full width inside .app-stage */
.lft-shell{
  max-width: none !important;
  margin: 0 !important;
  padding: var(--shell-pad) !important;
  display: flex !important;
  gap: var(--shell-gap) !important;          /* <-- sidebar/main gap */
  align-items: flex-start !important;
}

/* Sidebar stays under the top nav/topbar within the scrolling stage */
.lft-sidebar{
  flex: 0 0 200px !important;
  width: 200px !important;
  position: sticky !important;
  top: 64px !important;                      /* adjust if your topbar differs */
  align-self: flex-start !important;
}

/* Main area flexes normally */
.lft-main{
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

/* Remove any extra layout margins/padding that create "mystery gaps" */
.lft-main .lft-container{
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}


/* =========================================================
   Top Nav Height Standardization (60px)
========================================================= */

:root{
  --lft-topbar-h: 60px;
}


/* Force all admin nav bars to 60px */
.lft-header,
.lft-topbar{
  height: var(--lft-topbar-h) !important;
  min-height: var(--lft-topbar-h) !important;
}

.lft-header-inner,
.lft-topbar-inner{
  height: 100%;
  padding: 0 16px !important;
  display: flex;
  align-items: left;          /* vertical centering for logos */
}


/* Sidebar sticks just below the 60px top nav */
.lft-sidebar{
  top: var(--lft-topbar-h) !important;
}


/* Logo safety rule */
.lft-header img,
.lft-topbar img{
  max-height: 54px;   /* fits comfortably inside 60px bar */
  width: auto;
}


/* =========================================================
   Admin Header: Org logo + org name (60px bar friendly)
========================================================= */

.lft-org{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.lft-org-logo{
  width:200px;               /* rectangle slot */
  height:54px;
  display:flex;
  align-items:left;
  justify-content:flex-start;
  overflow:hidden;
}

.lft-org-logo img{
  height:54px;
  width:200px;
  object-fit:contain;        /* preserve aspect */
  display:block;
}

.lft-org-name{
  font-weight:700;
  font-size:14px;
  color:#111827;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:360px;
}

.lft-header-sep{
  color:#9ca3af;
  margin:0 6px;
}

.lft-local-time{
  font-size:13px;
  color: var(--lft-muted);
}


/* Sidebar sticks below the (60px) top nav */
:root{ --lft-topbar-h: 60px; }
.lft-sidebar{ top: var(--lft-topbar-h) !important; }


/* =========================================================
   Modal (Help)
========================================================= */
.lft-modal{ display:none; position:fixed; inset:0; z-index:9999; }
.lft-modal.is-open{ display:block; }
.lft-modal-backdrop{ position:absolute; inset:0; background:rgba(17,24,39,.55); }

.lft-modal-dialog{
  position:relative;
  width:min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin:16px auto;
  background:#fff;
  border-radius:14px;
  border:1px solid var(--lft-border-soft);
  box-shadow: 0 18px 45px rgba(0,0,0,.22);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.lft-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid var(--lft-border-soft);
  background:#fff;
}

.lft-modal-title{ margin:0; font-size:15px; font-weight:800; }
.lft-modal-close{
  border:1px solid var(--lft-border-soft);
  background:#fff;
  border-radius:10px;
  width:34px; height:34px;
  cursor:pointer;
}

.lft-modal-body{
  padding:14px;
  overflow:auto;
}

.lft-modal-footer{
  padding:12px 14px;
  border-top:1px solid var(--lft-border-soft);
  background:#fff;
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

/* =========================================================
   Header left padding adjustment (25px)
========================================================= */

.lft-header-inner,
.lft-topbar-inner{
  padding-left: 25px !important;
}

