/* ══════════════════════════════════════════════════════
   MySugarPal CMS — Main Stylesheet
   ══════════════════════════════════════════════════════ */

:root {
  --teal:        #0d6e6e;
  --teal-dark:   #1a7a5e;
  --teal-light:  #13a89e;
  --teal-pale:   #e6f7f6;
  --amber:       #e8913a;
  --amber-light: #fdf3e7;
  --charcoal:    #1a2330;
  --mid:         #3d5068;
  --soft:        #6b7e91;
  --mist:        #f0f5f5;
  --white:       #ffffff;
  --border:      #d4e5e5;
  --radius:      16px;
  --shadow:      0 4px 32px rgba(13,110,110,.10);
  --nav-h:       72px;
  --notice-h:    36px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--mid);
  line-height: 1.6;
  padding-top: calc(var(--nav-h) + var(--notice-h));
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal-light); }

/* ══════════════════════════════════════════════════════
   MEDICAL NOTICE BAR
══════════════════════════════════════════════════════ */
.medical-notice-bar {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 90;
  background: #fff8ee;
  border-bottom: 1px solid rgba(232,145,58,.25);
  padding: 0 5%;
  height: var(--notice-h);
  display: flex; align-items: center; justify-content: center;
  font-size: .76rem; color: var(--mid); gap: 6px;
}
.medical-notice-bar strong { color: var(--amber); }

/* ══════════════════════════════════════════════════════
   FANCY NAVBAR
══════════════════════════════════════════════════════ */
#main-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(212,229,229,.6);
  padding: 0 4%;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 20px rgba(13,110,110,.06);
  transition: box-shadow .3s;
}
#main-nav.scrolled {
  box-shadow: 0 4px 28px rgba(13,110,110,.12);
}

/* Logo */
.logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; flex-shrink: 0;
}
.logo svg { width: 38px; height: 38px; flex-shrink: 0; }
.logo-wordmark { display: flex; flex-direction: column; line-height: 1; }
.logo-name {
  font-family: 'Fraunces', serif;
  font-size: 1.22rem; font-weight: 700;
  color: var(--charcoal); letter-spacing: -.01em;
}
.logo-name em { color: var(--teal-dark); font-style: italic; }
.logo-sub {
  font-size: .58rem; font-weight: 700;
  letter-spacing: .16em; color: var(--teal-light);
  text-transform: uppercase; margin-top: 3px;
}

/* Nav links */
.nav-links {
  list-style: none;
  display: flex; align-items: center; gap: 4px;
}
.nav-links li { position: relative; }
.nav-links a {
  display: inline-flex; align-items: center;
  padding: 7px 13px; border-radius: 8px;
  font-size: .875rem; font-weight: 500;
  color: var(--mid);
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav-links a:hover  { color: var(--teal-dark); background: var(--teal-pale); }
.nav-links a.active { color: var(--teal-dark); font-weight: 600; }

/* Active indicator dot */
.nav-links a.active::after {
  content: '';
  display: block;
  width: 4px; height: 4px;
  background: var(--teal-dark);
  border-radius: 50%;
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
}

/* Contact CTA button in nav */
.nav-cta a,
.btn-nav-contact {
  background: var(--teal-dark) !important;
  color: #fff !important;
  padding: 8px 20px !important;
  border-radius: 50px !important;
  font-weight: 600 !important;
  font-size: .875rem;
  transition: background .2s, transform .15s, box-shadow .2s !important;
  box-shadow: 0 2px 12px rgba(26,122,94,.3);
}
.nav-cta a:hover,
.btn-nav-contact:hover {
  background: var(--teal-light) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26,122,94,.4) !important;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 9px;
  cursor: pointer; gap: 5px; flex-direction: column;
  align-items: center; justify-content: center;
}
.burger { display: flex; flex-direction: column; gap: 4px; }
.burger span {
  display: block; width: 20px; height: 2px;
  background: var(--mid); border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn-teal {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-dark); color: #fff;
  padding: 12px 28px; border-radius: 50px;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(26,122,94,.25);
}
.btn-teal:hover { background: var(--teal-light); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(26,122,94,.35); }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.85); color: var(--mid);
  padding: 11px 26px; border-radius: 50px;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 500;
  border: 1.5px solid rgba(255,255,255,.5); cursor: pointer;
  transition: all .2s; text-decoration: none;
}
.btn-outline:hover { border-color: var(--teal-dark); color: var(--teal-dark); background: #fff; }
.btn-danger {
  display: inline-flex; align-items: center;
  background: #c0392b; color: #fff;
  padding: 9px 20px; border-radius: 50px;
  font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer; transition: background .2s;
  text-decoration: none;
}
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-sm { padding: 7px 16px; font-size: .8rem; }

/* ══════════════════════════════════════════════════════
   SECTION WRAPPER
══════════════════════════════════════════════════════ */
.section { padding: 72px 5%; }
.section-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--charcoal); font-weight: 700; line-height: 1.2;
  margin-bottom: 12px;
}
.section-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--teal-dark);
  background: var(--teal-pale); padding: 5px 14px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
}
.section-label::before { content: '●'; font-size: .5rem; }
.section-desc { font-size: 1rem; color: var(--soft); max-width: 640px; margin-bottom: 40px; }

/* ══════════════════════════════════════════════════════
   ARTICLE GRID & CARDS
══════════════════════════════════════════════════════ */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 40px;
}
.article-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff;
  transition: transform .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.article-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.ac-img { height: 180px; overflow: hidden; position: relative; display: block; }
.ac-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.article-card:hover .ac-img img { transform: scale(1.05); }
.ac-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.ac-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ac-cat {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--teal-dark);
  background: var(--teal-pale); padding: 3px 10px; border-radius: 20px;
}
.ac-date { font-size: .75rem; color: var(--soft); }
.ac-body h3 { font-size: 1rem; font-weight: 600; color: var(--charcoal); margin-bottom: 8px; line-height: 1.4; }
.ac-body h3 a { color: inherit; }
.ac-body h3 a:hover { color: var(--teal-dark); }
.ac-body p  { font-size: .84rem; color: var(--soft); line-height: 1.6; margin-bottom: 14px; flex: 1; }
.ac-read-more {
  font-size: .82rem; font-weight: 600; color: var(--teal-dark);
  display: inline-flex; align-items: center; gap: 4px; transition: gap .2s;
}
.ac-read-more:hover { gap: 8px; }
.ac-author {
  display: flex; align-items: center; gap: 8px;
  padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border);
}
.ac-avatar {
  width: 28px; height: 28px;
  background: var(--teal-pale); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; color: var(--teal-dark); flex-shrink: 0;
}
.ac-author span { font-size: .75rem; color: var(--soft); }
.ac-author strong { color: var(--mid); font-size: .75rem; }

/* ══════════════════════════════════════════════════════
   ARTICLE DETAIL PAGE
══════════════════════════════════════════════════════ */
.article-detail { max-width: 760px; margin: 0 auto; padding: 40px 5% 80px; }
.article-detail .hero-img { width: 100%; height: 360px; object-fit: cover; border-radius: var(--radius); margin-bottom: 32px; }
.article-detail h1 { font-family: 'Fraunces', serif; font-size: clamp(1.6rem, 3.5vw, 2.4rem); color: var(--charcoal); line-height: 1.2; margin-bottom: 16px; }
.article-detail .article-meta-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.article-detail .article-body { font-size: 1rem; color: var(--mid); line-height: 1.85; }
.article-detail .article-body h2 { font-family: 'Fraunces', serif; font-size: 1.5rem; color: var(--charcoal); margin: 36px 0 12px; }
.article-detail .article-body h3 { font-size: 1.15rem; font-weight: 600; color: var(--charcoal); margin: 24px 0 8px; }
.article-detail .article-body p    { margin-bottom: 18px; }
.article-detail .article-body ul, .article-detail .article-body ol { margin: 0 0 18px 24px; }
.article-detail .article-body li   { margin-bottom: 6px; }
.article-detail .article-body blockquote { border-left: 4px solid var(--teal-dark); background: var(--teal-pale); padding: 16px 20px; border-radius: 0 10px 10px 0; margin: 24px 0; font-style: italic; color: var(--mid); }
.article-refs { border-top: 1px solid var(--border); margin-top: 40px; padding-top: 20px; font-size: .84rem; color: var(--soft); }
.article-refs strong { display: block; color: var(--mid); font-size: .88rem; margin-bottom: 12px; }
.refs-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.refs-list li { line-height: 1.55; color: var(--soft); }
.refs-list a { color: var(--teal-dark); text-decoration: none; word-break: break-all; }
.refs-list a:hover { text-decoration: underline; }
.refs-list a::after { content: ' ↗'; font-size: .72em; opacity: .7; }
.article-disclaimer { background: var(--amber-light); border: 1px solid rgba(232,145,58,.25); border-radius: 10px; padding: 14px 18px; margin-top: 24px; font-size: .82rem; color: var(--mid); line-height: 1.6; }

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--mid); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 16px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: .92rem; color: var(--charcoal);
  background: #fff; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--teal-dark); }
.form-group textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: .78rem; color: var(--soft); margin-top: 4px; }

/* ══════════════════════════════════════════════════════
   FLASH MESSAGES
══════════════════════════════════════════════════════ */
.flash { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: .9rem; }
.flash-success { background: #e6faf2; border: 1px solid #1a9e6a; color: #1a7a5e; }
.flash-error   { background: #fdedec; border: 1px solid #c0392b; color: #a93226; }

/* ══════════════════════════════════════════════════════
   COOKIE BANNER
══════════════════════════════════════════════════════ */
.cookie-banner {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; width: min(640px, calc(100% - 32px));
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(13,110,110,.18);
  padding: 20px 24px; display: flex; align-items: flex-start; gap: 16px;
  animation: slideUp .4s cubic-bezier(.16,1,.3,1);
}
.cookie-banner.hidden { display: none; }
@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(24px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.cookie-icon { font-size: 1.8rem; flex-shrink: 0; }
.cookie-content h4 { font-size: 1rem; color: var(--charcoal); margin-bottom: 4px; }
.cookie-content p  { font-size: .82rem; color: var(--soft); margin-bottom: 12px; }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════════ */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 48px; justify-content: center; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  font-size: .88rem; font-weight: 500;
  border: 1.5px solid var(--border); color: var(--mid);
  transition: all .2s;
}
.pagination a:hover { border-color: var(--teal-dark); color: var(--teal-dark); }
.pagination .active { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }

/* ══════════════════════════════════════════════════════
   ADMIN
══════════════════════════════════════════════════════ */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; flex-shrink: 0; background: var(--charcoal); color: #fff; padding: 0; position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; z-index: 200; }
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.sidebar-logo span { font-family: 'Fraunces', serif; font-size: 1.1rem; font-weight: 700; color: #fff; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: rgba(255,255,255,.7); font-size: .88rem; font-weight: 500; transition: all .2s; text-decoration: none; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a .icon { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; color: rgba(255,255,255,.5); }
.sidebar-footer a { color: rgba(255,255,255,.6); }
.admin-main { margin-left: 240px; flex: 1; padding: 32px 36px; background: #f7fafa; min-height: 100vh; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-topbar h1 { font-family: 'Fraunces', serif; font-size: 1.6rem; color: var(--charcoal); }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--teal-dark); color: #fff; padding: 12px 16px; text-align: left; font-size: .82rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .88rem; color: var(--mid); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--mist); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.badge-published { background: #e6faf2; color: #1a7a5e; }
.badge-draft { background: var(--amber-light); color: var(--amber); }
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.editor-card { background: #fff; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 20px; }
.editor-card h2 { font-size: 1rem; font-weight: 600; color: var(--charcoal); margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
#body-editor { width: 100%; min-height: 420px; border: 1.5px solid var(--border); border-radius: 10px; padding: 16px; font-size: .95rem; color: var(--charcoal); font-family: 'DM Sans', sans-serif; line-height: 1.75; outline: none; resize: vertical; }
#body-editor:focus { border-color: var(--teal-dark); }
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 12px; background: var(--mist); border: 1.5px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0; }
.editor-toolbar button { padding: 5px 10px; background: #fff; border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; cursor: pointer; color: var(--mid); transition: all .15s; }
.editor-toolbar button:hover { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 24px 20px; box-shadow: var(--shadow); border-top: 4px solid var(--teal-dark); }
.stat-card .num   { font-family: 'Fraunces', serif; font-size: 2.2rem; font-weight: 700; color: var(--teal-dark); }
.stat-card .label { font-size: .82rem; color: var(--soft); margin-top: 4px; }

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */
.site-footer { background: var(--charcoal); color: rgba(255,255,255,.7); padding: 60px 5% 0; }
.footer-inner { display: flex; gap: 60px; margin-bottom: 48px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: flex-start; gap: 12px; }
.footer-brand .logo-icon { font-size: 2rem; }
.footer-tagline { font-family: 'Fraunces', serif; font-size: 1.1rem; color: #fff; }
.footer-tagline small { font-family: 'DM Sans', sans-serif; font-size: .78rem; color: rgba(255,255,255,.5); font-style: normal; }
.footer-cols { display: flex; gap: 48px; flex: 1; flex-wrap: wrap; }
.footer-col h4 { font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.4); margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a  { color: rgba(255,255,255,.6); font-size: .88rem; transition: color .2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 20px 0; font-size: .78rem; color: rgba(255,255,255,.4); display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.footer-bottom a { color: rgba(255,255,255,.55); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .editor-grid   { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav-links {
    display: none; flex-direction: column;
    position: fixed; top: calc(var(--nav-h) + var(--notice-h));
    left: 0; right: 0;
    background: rgba(255,255,255,.98);
    backdrop-filter: blur(20px);
    padding: 12px 5% 24px;
    border-bottom: 1px solid var(--border);
    gap: 0; box-shadow: 0 8px 24px rgba(13,110,110,.1);
  }
  .nav-links.open { display: flex; }
  .nav-links li { border-bottom: 1px solid var(--border); }
  .nav-links li:last-child { border-bottom: none; padding-top: 12px; }
  .nav-links a { display: block; padding: 12px 4px; border-radius: 0; }
  .nav-links a:hover { background: transparent; }
  .nav-links a.active::after { display: none; }
  .nav-cta a { display: inline-block !important; }
  .nav-toggle { display: flex; }
  .articles-grid { grid-template-columns: 1fr; }
  .admin-sidebar { width: 200px; }
  .admin-main    { margin-left: 200px; padding: 20px; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .admin-sidebar { position: static; width: 100%; }
  .admin-main    { margin-left: 0; }
  .admin-layout  { flex-direction: column; }
  .cookie-banner { flex-direction: column; }
}
