/* ============================================================
   LMS Primary — Global Design System
   Inspired by nicolaebogdan.school
   Fonts: Rowdies (headings) · Inter (body) · Dancing Script (accent)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Rowdies:wght@300;400;700&family=Inter:wght@400;500;600;700&family=Dancing+Script:wght@600;700&display=swap');

:root {
  --lms-orange:        #fc800a;
  --lms-orange-warm:   #f69947;
  --lms-orange-burnt:  #F26522;
  --lms-gold:          #FAB823;
  --lms-green:         #88B520;
  --lms-black:         #020202;
  --lms-dark:          #28231c;
  --lms-dark-ui:       #32373c;
  --lms-cream:         #fbf1e3;
  --lms-beige:         #ede1d0;
  --lms-offwhite:      #FCF7EE;
  --lms-white:         #ffffff;
  --lms-text:          #020202;
  --lms-text-muted:    #6b6b6b;
  --lms-border:        #e5ddd3;
  --lms-shadow-natural: 6px 6px 9px rgba(0,0,0,.18);
  --lms-shadow-deep:    12px 12px 50px rgba(0,0,0,.35);
  --lms-shadow-sharp:   6px 6px 0px rgba(0,0,0,.20);
  --lms-radius:         12px;
  --lms-radius-pill:    9999px;
  --lms-container:      1200px;
  --lms-font-head:   'Rowdies', sans-serif;
  --lms-font-body:   'Inter', sans-serif;
  --lms-font-script: 'Dancing Script', cursive;
  /* Aliases used by dashboard/crud */
  --lms-primary:  #fc800a;
  --lms-success:  #88B520;
  --lms-danger:   #e03e2d;
  --lms-surface:  #ffffff;
  --lms-muted:    #6b6b6b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--lms-font-body); font-size: 16px; line-height: 1.625; color: var(--lms-text); background: var(--lms-offwhite); }
h1, h2, h3, h4, h5, h6 { font-family: var(--lms-font-head); font-weight: 400; line-height: 1.2; color: var(--lms-black); }
h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.875rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.875rem); }
h4 { font-size: 1.5rem; }
p { margin-bottom: 1em; } p:last-child { margin-bottom: 0; }
a { color: var(--lms-orange); text-decoration: none; transition: color .2s; }
a:hover { color: var(--lms-orange-burnt); }
img { max-width: 100%; height: auto; display: block; }

/* --- Layout --- */
.lms-container { max-width: var(--lms-container); margin: 0 auto; padding: 0 24px; }
.lms-main { padding: 48px 24px; min-height: 60vh; }
.lms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }

/* --- Header --- */
.lms-header { background: var(--lms-white); border-bottom: 2px solid var(--lms-cream); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.lms-header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.lms-header__logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; color: inherit; }
.lms-header__logo-img { height: 44px; max-height: 44px; width: auto; max-width: 140px; flex-shrink: 0; object-fit: contain; }
.lms-header__logo-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.lms-header__logo-text-block { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; }
.lms-header__logo .lms-header__logo-name { font-family: var(--lms-font-head); font-size: 1.25rem; font-weight: 400; color: var(--lms-black); text-decoration: none; transition: color .2s; }
.lms-header__logo .lms-header__logo-motto { font-family: var(--lms-font-script); font-size: .92rem; font-weight: 600; color: var(--lms-orange); text-decoration: none; }
.lms-header__logo:hover .lms-header__logo-name { color: var(--lms-orange); }
.lms-header__actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* --- Nav --- */
.lms-nav { list-style: none; display: flex; gap: 2px; align-items: center; margin: 0; padding: 0; }
.lms-nav > li { position: relative; list-style: none; }
.lms-nav a { display: flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: var(--lms-radius-pill); font-size: .95rem; font-weight: 500; color: var(--lms-black); transition: color .2s, background .2s; white-space: nowrap; text-decoration: none; }
.lms-nav a:hover { color: var(--lms-orange); background: var(--lms-cream); }

/* Dropdown chevron on parent items */
.lms-nav .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .22s;
    flex-shrink: 0;
    opacity: .55;
    margin-left: 2px;
}
.lms-nav .menu-item-has-children:hover > a::after,
.lms-nav .menu-item-has-children:focus-within > a::after {
    transform: translateY(2px) rotate(225deg);
}

/* Dropdown panel — use visibility so the gap doesn't break hover */
.lms-nav .sub-menu {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 100%;          /* flush — bridge pseudo-el covers the gap */
    left: 0;
    min-width: 210px;
    background: var(--lms-white);
    border: 1px solid rgba(0,0,0,.08);
    border-top: 3px solid var(--lms-orange);
    border-radius: 0 0 var(--lms-radius) var(--lms-radius);
    box-shadow: 0 12px 36px rgba(0,0,0,.13);
    padding: 4px 0 6px;
    list-style: none;
    margin: 0;
    z-index: 200;
    transform: translateY(4px);
    transition: opacity .18s, transform .18s, visibility 0s .18s;
}
/* Transparent bridge fills the gap so the mouse stays "inside" the li */
.lms-nav .menu-item-has-children > .sub-menu::before {
    content: '';
    position: absolute;
    top: -10px; left: 0; right: 0;
    height: 10px;
}
.lms-nav .menu-item-has-children:hover > .sub-menu,
.lms-nav .menu-item-has-children:focus-within > .sub-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity .18s, transform .18s, visibility 0s 0s;
}
.lms-nav .sub-menu li { list-style: none; }
.lms-nav .sub-menu a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 0;
    font-size: .9rem;
    font-weight: 500;
    color: var(--lms-dark);
    white-space: nowrap;
    transition: background .15s, color .15s, padding-left .15s;
    border-left: 3px solid transparent;
}
.lms-nav .sub-menu a:hover,
.lms-nav .sub-menu .current-menu-item > a {
    background: var(--lms-cream);
    color: var(--lms-orange);
    padding-left: 22px;
    border-left-color: var(--lms-orange);
}
.lms-nav .sub-menu li + li { border-top: 1px solid var(--lms-cream); }

/* Active / current page */
.lms-nav .current-menu-item > a,
.lms-nav .current-page-ancestor > a,
.lms-nav .current-menu-ancestor > a {
    color: var(--lms-orange);
    background: var(--lms-cream);
}
.lms-mobile-nav__list .current-menu-item > a,
.lms-mobile-nav__list .current-menu-ancestor > a {
    color: var(--lms-orange);
    border-left-color: var(--lms-orange);
    background: var(--lms-cream);
}

/* --- Buttons --- */
.lms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: calc(.667em + 2px) calc(1.6em + 2px); border-radius: var(--lms-radius-pill); font-family: var(--lms-font-body); font-size: 1rem; font-weight: 600; cursor: pointer; border: 2px solid transparent; text-decoration: none; white-space: nowrap; transition: background .2s, color .2s, border-color .2s, transform .15s; }
.lms-btn:hover { transform: translateY(-1px); text-decoration: none; } .lms-btn:active { transform: translateY(0); }
.lms-btn--primary { background: var(--lms-orange); color: var(--lms-white); } .lms-btn--primary:hover { background: var(--lms-orange-burnt); color: var(--lms-white); }
.lms-btn--dark { background: var(--lms-dark-ui); color: var(--lms-white); } .lms-btn--dark:hover { background: var(--lms-orange); color: var(--lms-white); }
.lms-btn--outline { background: transparent; color: var(--lms-black); border-color: var(--lms-black); } .lms-btn--outline:hover { background: var(--lms-black); color: var(--lms-white); }
.lms-btn--outline-orange { background: transparent; color: var(--lms-orange); border-color: var(--lms-orange); } .lms-btn--outline-orange:hover { background: var(--lms-orange); color: var(--lms-white); }
.lms-btn--ghost { background: transparent; color: var(--lms-text-muted); } .lms-btn--ghost:hover { color: var(--lms-orange); background: var(--lms-cream); }
.lms-btn--success { background: var(--lms-green); color: var(--lms-white); } .lms-btn--success:hover { background: #6e9118; color: var(--lms-white); }
.lms-btn--danger  { background: var(--lms-danger); color: var(--lms-white); } .lms-btn--danger:hover  { background: #b82e1f; color: var(--lms-white); }
.lms-btn--sm { font-size: .85rem; padding: 5px 16px; } .lms-btn--lg { font-size: 1.125rem; padding: 14px 36px; }
.lms-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* --- Card --- */
.lms-card { background: var(--lms-white); border-radius: var(--lms-radius); box-shadow: var(--lms-shadow-natural); overflow: hidden; transition: box-shadow .25s, transform .25s; }
.lms-card:hover { box-shadow: var(--lms-shadow-deep); transform: translateY(-3px); }
.lms-card__body { padding: 20px; }
.lms-card__title { font-family: var(--lms-font-head); font-size: 1.2rem; font-weight: 400; margin-bottom: 8px; }
.lms-card__title a { color: var(--lms-black); } .lms-card__title a:hover { color: var(--lms-orange); }
.lms-card__excerpt { font-size: .9rem; color: var(--lms-text-muted); line-height: 1.6; }

/* --- Badges --- */
.lms-badge { display: inline-block; padding: 3px 12px; border-radius: var(--lms-radius-pill); font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.lms-badge--grade      { background: #fff3e0; color: var(--lms-orange); }
.lms-badge--subject    { background: #f0f7db; color: #5a7a0a; }
.lms-badge--free       { background: #eaf7e0; color: #4a8a00; }
.lms-badge--paid       { background: #fff8e1; color: #b06a00; }
.lms-badge--difficulty { background: var(--lms-cream); color: var(--lms-dark); }
.lms-badge--new        { background: var(--lms-orange); color: var(--lms-white); }
.lms-badge--warning    { background: #fff3cd; color: #856404; }
.lms-badge--info       { background: #d0e9ff; color: #004085; }
.lms-badge--success    { background: #d4edda; color: #155724; }
.lms-badge--danger     { background: #f8d7da; color: #721c24; }

/* --- Progress --- */
.lms-progress { background: var(--lms-beige); border-radius: var(--lms-radius-pill); height: 9px; overflow: hidden; }
.lms-progress__fill { height: 100%; background: linear-gradient(90deg, var(--lms-orange) 0%, var(--lms-gold) 100%); border-radius: var(--lms-radius-pill); transition: width .5s cubic-bezier(.4,0,.2,1); }

/* --- Alerts --- */
.lms-alert {
    position: relative;
    overflow: hidden;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 20px;
    border-left: 4px solid;
}
/* Decorative radial glow in top-right corner */
.lms-alert::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 70px; height: 70px;
    border-radius: 50%;
    transform: translate(24px, -24px);
    pointer-events: none;
}
.lms-alert--info {
    background: linear-gradient(135deg, #fff4e0 0%, #fff9f0 100%);
    color: #5a3500;
    border-color: var(--lms-orange);
    box-shadow: 0 2px 14px rgba(252,128,10,.13);
}
.lms-alert--info::before {
    background: radial-gradient(circle, rgba(252,128,10,.18) 0%, transparent 70%);
}
.lms-alert--success {
    background: linear-gradient(135deg, #edfadf 0%, #f5fcee 100%);
    color: #2d6a00;
    border-color: var(--lms-green);
    box-shadow: 0 2px 14px rgba(136,181,32,.12);
}
.lms-alert--success::before {
    background: radial-gradient(circle, rgba(136,181,32,.18) 0%, transparent 70%);
}
.lms-alert--error {
    background: linear-gradient(135deg, #fff0ec 0%, #fff5f2 100%);
    color: #b83000;
    border-color: var(--lms-orange-burnt);
    box-shadow: 0 2px 14px rgba(242,101,34,.12);
}
.lms-alert--error::before {
    background: radial-gradient(circle, rgba(242,101,34,.18) 0%, transparent 70%);
}
.lms-alert--warning {
    background: linear-gradient(135deg, #fffbe8 0%, #fffdf2 100%);
    color: #7a5c00;
    border-color: var(--lms-gold);
    box-shadow: 0 2px 14px rgba(250,184,35,.12);
}
.lms-alert--warning::before {
    background: radial-gradient(circle, rgba(250,184,35,.18) 0%, transparent 70%);
}

/* --- Accent / Sections --- */
.lms-accent-text { font-family: var(--lms-font-script); font-size: 1.5rem; color: var(--lms-orange); }
.lms-section { padding: 64px 0; }
.lms-section--cream { background: var(--lms-cream); }
.lms-section--dark  { background: var(--lms-dark); color: var(--lms-beige); }
.lms-section--dark h1, .lms-section--dark h2, .lms-section--dark h3 { color: var(--lms-white); }

/* --- Footer --- */
.lms-footer { background: var(--lms-dark); color: var(--lms-beige); padding: 40px 0 24px; }
.lms-footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.lms-footer__copy { font-size: .875rem; }
.lms-footer__contact { font-size: .875rem; }
.lms-footer__contact a { color: var(--lms-orange); } .lms-footer__contact a:hover { color: var(--lms-gold); }

/* --- Page / Post --- */
.lms-page__title, .lms-single__title { font-size: clamp(1.75rem, 4vw, 2.875rem); margin-bottom: 24px; }
.lms-archive__title { font-size: clamp(1.5rem, 3vw, 2.5rem); margin-bottom: 32px; }
.lms-page__content, .lms-single__content { max-width: 760px; }
.lms-single__meta { color: var(--lms-text-muted); font-size: .875rem; margin-bottom: 20px; }

/* --- Pagination --- */
.page-numbers { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--lms-radius-pill); font-size: .9rem; color: var(--lms-black); margin: 2px; transition: background .2s, color .2s; }
.page-numbers:hover, .page-numbers.current { background: var(--lms-orange); color: var(--lms-white); }
.nav-links { display: flex; gap: 4px; margin-top: 40px; justify-content: center; }

/* --- Hamburger button --- */
.lms-hamburger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; width: 40px; height: 40px; background: none; border: none; cursor: pointer; padding: 4px; flex-shrink: 0; border-radius: var(--lms-radius); transition: background .2s; }
.lms-hamburger:hover { background: var(--lms-cream); }
.lms-hamburger span { display: block; width: 22px; height: 2px; background: var(--lms-black); border-radius: 2px; transition: transform .3s, opacity .3s, width .3s; transform-origin: center; }
.lms-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.lms-hamburger.is-open span:nth-child(2) { opacity: 0; width: 0; }
.lms-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Mobile nav drawer --- */
.lms-mobile-nav { display: none; position: fixed; inset: 0; z-index: 9999; }
.lms-mobile-nav.is-open { display: block; }
.lms-mobile-nav__overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: lmsOverlayIn .25s ease; }
.lms-mobile-nav__drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 88vw); background: var(--lms-white); display: flex; flex-direction: column; overflow-y: auto; box-shadow: -4px 0 32px rgba(0,0,0,.18); animation: lmsDrawerIn .28s cubic-bezier(.4,0,.2,1); }
@keyframes lmsOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lmsDrawerIn  { from { transform: translateX(100%); } to { transform: translateX(0); } }
.lms-mobile-nav__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--lms-cream); gap: 12px; }
.lms-mobile-nav__close { background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--lms-text-muted); padding: 4px 8px; border-radius: 6px; line-height: 1; }
.lms-mobile-nav__close:hover { background: var(--lms-cream); color: var(--lms-text); }
.lms-mobile-nav__menu { flex: 1; padding: 8px 0; }
.lms-mobile-nav__list { list-style: none; margin: 0; padding: 0; }
.lms-mobile-nav__list li { list-style: none; }
.lms-mobile-nav__list a { display: block; padding: 13px 24px; font-size: 1rem; font-weight: 500; color: var(--lms-dark); border-left: 3px solid transparent; transition: background .15s, color .15s, border-color .15s; text-decoration: none; }
.lms-mobile-nav__list a:hover { background: var(--lms-cream); color: var(--lms-orange); border-left-color: var(--lms-orange); }
/* Mobile submenu — indented, always visible */
.lms-mobile-nav__list .sub-menu { list-style: none; margin: 0; padding: 0; background: var(--lms-cream); }
.lms-mobile-nav__list .sub-menu a { padding: 10px 24px 10px 36px; font-size: .9rem; font-weight: 400; color: var(--lms-text-muted); border-left: 3px solid transparent; }
.lms-mobile-nav__list .sub-menu a:hover { color: var(--lms-orange); border-left-color: var(--lms-orange); background: rgba(252,128,10,.07); }
/* Chevron indicator on mobile parent items */
.lms-mobile-nav__list .menu-item-has-children > a { display: flex; align-items: center; justify-content: space-between; }
.lms-mobile-nav__list .menu-item-has-children > a::after { content: '›'; font-size: 1.2rem; opacity: .45; margin-left: auto; }
.lms-mobile-nav__actions { padding: 20px; border-top: 1px solid var(--lms-cream); }

@media (max-width: 768px) {
  .lms-header__inner { height: 64px; padding: 0; }
  .lms-header__nav    { display: none; }
  .lms-header__actions { display: none; }
  .lms-hamburger { display: flex; }
  .lms-grid { grid-template-columns: 1fr; }
  .lms-footer__inner { flex-direction: column; text-align: center; }
  .lms-main { padding: 24px 16px; }
  .lms-container { padding: 0 16px; }
}

/* ============================================================
   Page Loader
   ============================================================ */
#lms-page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--lms-cream);
  transition: opacity .35s ease, visibility .35s ease;
}
#lms-page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.lms-loader-spinner {
  position: relative;
  width: 64px;
  height: 64px;
}
.lms-loader-spinner::before,
.lms-loader-spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 4px solid transparent;
}
.lms-loader-spinner::before {
  inset: 0;
  border-top-color: var(--lms-orange);
  border-right-color: var(--lms-orange);
  animation: lms-spin .8s linear infinite;
}
.lms-loader-spinner::after {
  inset: 10px;
  border-bottom-color: var(--lms-gold);
  border-left-color: var(--lms-gold);
  animation: lms-spin .6s linear infinite reverse;
}
@keyframes lms-spin {
  to { transform: rotate(360deg); }
}
.lms-loader-text {
  font-family: var(--lms-font-script);
  font-size: 1.2rem;
  color: var(--lms-orange);
  letter-spacing: .02em;
}
