/* =========================
   Section Header (Wild Sand System)
   ========================= */

.section-header {
  width: 100%;
  max-width: 900px;

  margin: 40px auto 32px;  /* centers it */

  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;

  padding: 22px 26px;
  border-radius: 18px;

  background: #ffffff;
  border: 1px solid rgba(22,35,42,0.08);
  box-shadow: 0 18px 38px rgba(22,35,42,0.08);
}

/* Titles */
.section-header__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Chapter Title */
.section-header__chapter {
  margin: 0;
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 1000;
  letter-spacing: -0.02em;
  color: var(--ppl-mirage);
}

/* Subchapter */
.section-header__subchapter {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 17px);
  font-weight: 800;
  color: var(--ppl-deep-sea-green);
}

/* Accent divider */
.section-header__titles::after {
  content: "";
  width: 60px;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--ppl-blaze-orange);
}

/* Back link */
.section-header__back {
  font-weight: 900;
  color: var(--ppl-deep-sea-green);
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s ease, opacity .15s ease;
}

.section-header__back:hover {
  transform: translateX(-3px);
  opacity: 0.85;
}

/* Flashcard Styles */
.flashcard {
    width: 100%;
    height: 200px; /* Fixed height for cards */
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background: var(--ppl-deep-sea-green);
    color: var(--ppl-wild-sand);
}

.content {
    padding: 30px;
}

.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    transform: rotateY(180deg);

    background: #fff;
    color: var(--ppl-mirage);
    border: 2px solid var(--ppl-mirage);
}

/* Floating Chat Icon */
.chat-float {
    position: fixed;
    bottom: 35px;
    left: 30px;
    background-color: var(--ppl-deep-sea-green);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
}

.chat-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.chat-float .chat-icon {
    max-height: 50px;   /* shrink it down */
    max-width: 50px;    /* optional, for square scaling */
    width: auto;        /* keep aspect ratio */
    height: auto;       /* keep aspect ratio */
    object-fit: contain;
}

/* Chat Popup */
.chat-popup {
    position: fixed;
    top: 10%;
    align-self: center;
    margin-left: 20px;
    max-width: 400px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
}

.chat-header {
    background-color: var(--ppl-deep-sea-green);
    color: #fff;
    padding: 10px 15px;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #0056b3;
}

.chat-header .close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 3.5rem;
    cursor: pointer;
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: 400px;
    padding: 15px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: #007bff #f1f1f1;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #007bff;
    border-radius: 4px;
}

.chat-messages .user-message,
.chat-messages .reply-message {
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-messages .user-message {
    background-color: #d1ecf1;
    align-self: flex-end;
}

.chat-messages .reply-message {
    background-color: #e9ecef;
    align-self: flex-start;
}

#chatInput {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: none;
    margin-bottom: 10px;
}

.send-btn {
    background-color: var(--ppl-deep-sea-green);
    color: #fff;
    border: none;
    padding: 12px;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    width: 100%;
}

.send-btn:hover {
    transform: translateY(-2%);
}

/* Tooltip for Floating Icon */
.chat-float[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--ppl-deep-sea-green);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    white-space: nowrap;
    z-index: 1100;
    margin-left: 20px;
}

/* Container styling with a moving green gradient background */
#upload-form {
    background: linear-gradient(270deg, #32a852, #3ac55a, #32a852);
    background-size: 600% 600%;
    animation: gradientAnimation 8s ease infinite;
    border-radius: 12px;
    padding: 30px 40px;
    margin: 30px auto;
    max-width: 500px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    color: #fff;
    font-family: 'Helvetica Neue', sans-serif;
  }
  
  /* Header styling */
  #upload-form h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 25px;
  }
  
  /* Form group styling */
  #upload-form .form-group {
    margin-bottom: 20px;
  }
  
  /* Label styling */
  #upload-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
  }
  
  /* Input field styling */
  #upload-form input[type="text"],
  #upload-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  }
  
  /* Button styling */
  #upload-form button {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    color: #2e7d32;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
  }
  
  #upload-form button:hover {
    background-color: #fff;
    transform: translateY(-3px);
  }
  
  /* Gradient animation keyframes */
  @keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }
  
.question-card-actions {
    min-height: 20px;
}

.question-issue-icon-btn {
    position: relative;
    width: 25px;
    height: 25px;
    padding: 0;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.82rem;
    line-height: 1;
    opacity: 0.55;
    transition:
        opacity 0.15s ease,
        color 0.15s ease,
        background-color 0.15s ease,
        transform 0.15s ease;
}

.question-issue-icon-btn:hover,
.question-issue-icon-btn:focus {
    opacity: 1;
    background: #f8fafc;
    transform: translateY(-1px);
}

/* Not yet reported: very subtle */
.question-issue-icon-btn--idle {
    color: #94a3b8;
}

.question-issue-icon-btn--idle:hover,
.question-issue-icon-btn--idle:focus {
    color: #c2410c;
}

/* Already reported: color-coded but still quiet */
.question-issue-icon-btn--reported {
    color: #f59e0b;
    opacity: 0.75;
    cursor: not-allowed;
}

.question-issue-icon-btn--reported:hover {
    background: transparent;
    transform: none;
}

/* Custom hover label */
.question-issue-icon-btn::after {
    content: attr(aria-label);
    position: absolute;
    top: 50%;
    right: 125%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.3rem 0.45rem;
    border-radius: 0.45rem;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 20;
}

.question-issue-icon-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 105%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent #0f172a;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 20;
}

.question-issue-icon-btn:hover::after,
.question-issue-icon-btn:hover::before,
.question-issue-icon-btn:focus::after,
.question-issue-icon-btn:focus::before {
    opacity: 1;
    visibility: visible;
}

/* =========================
   PharmaProLearn Pagination
   ========================= */

.pagination {
  gap: 4px;
  justify-content: center;
}

/* Base link style */
.pagination .page-link {
  border: 1px solid rgba(22, 35, 42, 0.08);
  background: #ffffff;
  color: var(--ppl-mirage);
  font-weight: 700;

  padding: 8px 14px;
  border-radius: 12px;

  transition: all 0.2s ease;
}

/* Hover */
.pagination .page-link:hover {
  background: var(--ppl-deep-sea-green);
  color: #ffffff;
  border-color: var(--ppl-deep-sea-green);
  transform: translateY(-2px);
}

/* Active page */
.pagination .page-item.active .page-link {
  background: var(--ppl-blaze-orange);
  border-color: var(--ppl-blaze-orange);
  color: #ffffff;
}

/* Disabled state */
.pagination .page-item.disabled .page-link {
  background: #f5f5f5;
  color: rgba(22, 35, 42, 0.35);
  border-color: rgba(22, 35, 42, 0.08);
  cursor: not-allowed;
}

/* Prev/Next buttons slightly emphasized */
.pagination .page-link[href*="page="] {
  font-weight: 800;
}

/* Smooth press effect */
.pagination .page-link:active {
  transform: translateY(0);
}

/* Container for flashcard practice polish */
/* =========================
   Actual Study Flashcards - Simple Card Design
   ========================= */

body:has(#flashcardSection){
  background:#fff3df;
}

.container:has(#flashcardSection){
  max-width:1180px;
  padding-bottom:52px;
}

/* Centered banner */
/* =========================
   Compact Flashcard Banner
   ========================= */

.container:has(#flashcardSection) .section-header.ppl-flashHero{
  width:min(100%, 1120px);
  max-width:1120px;
  min-height:92px;
  margin:24px auto 22px;
  padding:18px 22px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:22px;
  background:#102d6c;
  box-shadow:0 16px 38px rgba(16,45,108,.18);
  color:#ffffff;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:22px;

  text-align:left;
  overflow:visible;
}

.container:has(#flashcardSection) .section-header.ppl-flashHero::after{
  display:none;
}

.ppl-flashHero__titles{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:5px;
}

.ppl-flashHero__chapter{
  margin:0;
  color:#ffffff;
  font-size:clamp(1.15rem, 2.1vw, 1.55rem);
  font-weight:950;
  letter-spacing:-.025em;
  line-height:1.05;

  display:flex;
  align-items:center;
  gap:10px;
}

.ppl-flashHero__chapter i{
  font-size:.95rem;
  opacity:.88;
}

.ppl-flashHero__subchapter{
  width:max-content;
  max-width:100%;
  margin:0;
  padding-bottom:4px;
  color:rgba(255,255,255,.74);
  border-bottom:3px solid #fff3df;
  font-size:.95rem;
  font-weight:800;
  line-height:1.15;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.ppl-flashHero__actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}

.ppl-flashHero__btn{
  min-height:42px;
  padding:0 16px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.08);
  color:#ffffff;
  box-shadow:none;

  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;

  font-size:.88rem;
  font-weight:900;
  line-height:1;
  cursor:pointer;

  transition:
    background .18s ease,
    border-color .18s ease,
    transform .18s ease;
}

.ppl-flashHero__btn:hover,
.ppl-flashHero__btn:focus{
  background:rgba(255,255,255,.14);
  border-color:rgba(255,255,255,.3);
  transform:translateY(-1px);
}

.ppl-flashHero__progress{
  min-height:48px;
  min-width:96px;
  padding:8px 16px;
  border-radius:16px;
  background:#fff3df;
  color:#102d6c;
  box-shadow:0 10px 24px rgba(0,0,0,.12);

  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
}

.ppl-flashHero__progress span{
  font-size:.68rem;
  font-weight:950;
  letter-spacing:.06em;
  line-height:1;
  text-transform:uppercase;
  opacity:.72;
}

.ppl-flashHero__progress strong{
  font-size:1rem;
  font-weight:950;
  line-height:1;
  letter-spacing:.02em;
}

/* Remove old summary if still present somewhere */
.ppl-flashSummary{
  display:none;
}

/* Tablet */
@media (max-width: 860px){
  .container:has(#flashcardSection) .section-header.ppl-flashHero{
    align-items:flex-start;
    flex-direction:column;
    gap:16px;
    padding:18px;
  }

  .ppl-flashHero__actions{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
  }

  .ppl-flashHero__progress{
    margin-left:auto;
  }
}

/* Mobile */
@media (max-width: 520px){
  .container:has(#flashcardSection) .section-header.ppl-flashHero{
    margin-top:18px;
    border-radius:18px;
  }

  .ppl-flashHero__chapter{
    font-size:1.12rem;
  }

  .ppl-flashHero__subchapter{
    width:100%;
    white-space:normal;
  }

  .ppl-flashHero__actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }

  .ppl-flashHero__btn{
    width:100%;
    min-height:40px;
    padding:0 12px;
  }

  .ppl-flashHero__progress{
    grid-column:1 / -1;
    width:100%;
    min-height:44px;
    margin-left:0;
    flex-direction:row;
    gap:8px;
  }
}

/* Dark mode */
html[data-theme="dark"] .container:has(#flashcardSection) .section-header.ppl-flashHero{
  background:#102d6c;
  border-color:rgba(255,255,255,.12);
}

html[data-theme="dark"] .ppl-flashHero__progress{
  background:#fff3df;
  color:#102d6c;
}

/* Summary */
.ppl-flashSummary{
  align-items:center;
  background:#ffffff;
  border:1px solid rgba(16,45,108,.1);
  border-radius:18px;
  color:#102d6c;
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:10px 18px;
  margin:20px auto 0;
  padding:14px 18px;
  width:min(100%, 1120px);
  box-shadow:0 10px 26px rgba(16,45,108,.07);
}

.ppl-flashSummary span{
  align-items:center;
  display:inline-flex;
  gap:8px;
  font-size:.92rem;
  font-weight:850;
}

.ppl-flashSummary i{
  color:#102d6c;
}

/* Flashcard wrapper */
.ppl-flashWrap{
  padding-left:0;
  padding-right:0;
}

/* 6-card visual layout: 3 columns x 2 rows on desktop */
.ppl-flashGrid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:24px;
  margin:26px auto 0;
  width:min(100%, 1120px);
}

.ppl-flashCardShell{
  min-width:0;
  position:relative;
}

/* Report issue button */
.ppl-flashCardShell .question-card-actions{
  position:absolute;
  top:14px;
  right:14px;
  z-index:5;
  min-height:0;
}

.ppl-flashCardShell .question-issue-icon-btn{
  width:30px;
  height:30px;
  background:rgba(16,45,108,.06);
  color:#102d6c;
  border:1px solid rgba(16,45,108,.1);
  box-shadow:none;
  opacity:1;
}

.ppl-flashCardShell .question-issue-icon-btn:hover,
.ppl-flashCardShell .question-issue-icon-btn:focus{
  background:#102d6c;
  color:#ffffff;
}

/* Main flip card */
.ppl-flashCard{
  width:100%;
  min-height:310px;
  border:0;
  background:transparent;
  cursor:pointer;
  perspective:1200px;
  outline:none;
}

.ppl-flashCard__inner{
  position:relative;
  width:100%;
  min-height:310px;
  height:100%;
  transform-style:preserve-3d;
  transition:transform .55s ease;
}

.ppl-flashCard.is-flipped .ppl-flashCard__inner{
  transform:rotateY(180deg);
}

.ppl-flashCard__face{
  position:absolute;
  inset:0;
  min-height:310px;
  border-radius:22px;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:28px;
  border:1px solid rgba(16,45,108,.1);
  box-shadow:0 16px 34px rgba(16,45,108,.12);
}

/* Front: question side */
.ppl-flashCard__front{
  background:#ffffff;
  color:#102d6c;
}

/* Back: answer side */
.ppl-flashCard__back{
  transform:rotateY(180deg);
  background:#102d6c;
  color:#ffffff;
  border-color:#102d6c;
}

/* Hide extra labels/text on the card */
.ppl-flashCard__topline,
.ppl-flashCard__hint{
  display:none;
}

/* Main content */
.ppl-flashCard__content{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  color:inherit;
  font-size:clamp(1.15rem, 1.7vw, 1.42rem);
  font-weight:900;
  line-height:1.28;
  text-align:center;
}

.ppl-flashCard__content p{
  margin-bottom:.65rem;
}

.ppl-flashCard__content p:last-child{
  margin-bottom:0;
}

.ppl-flashCard__content--answer{
  align-items:center;
  justify-content:center;
  overflow-y:auto;
  text-align:center;
  font-size:1rem;
  font-weight:750;
  line-height:1.65;
  padding-right:4px;
}

.ppl-flashCard:hover .ppl-flashCard__inner{
  transform:translateY(-4px);
}

.ppl-flashCard.is-flipped:hover .ppl-flashCard__inner{
  transform:rotateY(180deg) translateY(-4px);
}

.ppl-flashCard:focus-visible .ppl-flashCard__face{
  outline:4px solid rgba(16,45,108,.22);
  outline-offset:4px;
}

/* Helper text on cream background */
body:has(#flashcardSection) .text-muted{
  color:rgba(16,45,108,.68) !important;
}

/* Tablet */
@media (max-width: 991.98px){
  .ppl-flashGrid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 640px){
  .container:has(#flashcardSection){
    padding-left:14px;
    padding-right:14px;
  }

  .container:has(#flashcardSection) .section-header{
    margin-top:18px;
    border-radius:22px;
    padding:30px 18px;
  }

  .ppl-flashSummary{
    justify-content:flex-start;
  }

  .ppl-flashGrid{
    grid-template-columns:1fr;
    gap:18px;
  }

  .ppl-flashCard,
  .ppl-flashCard__inner,
  .ppl-flashCard__face{
    min-height:280px;
  }

  .ppl-flashCard__face{
    border-radius:20px;
    padding:22px;
  }

  .ppl-flashCard__content{
    font-size:1.12rem;
  }
}

/* Dark mode */
html[data-theme="dark"] body:has(#flashcardSection){
  background:#08152f;
}

html[data-theme="dark"] .container:has(#flashcardSection) .section-header{
  background:#102d6c;
}

html[data-theme="dark"] .ppl-flashSummary{
  background:#132244;
  border-color:rgba(255,255,255,.12);
  color:#ffffff;
  box-shadow:none;
}

html[data-theme="dark"] .ppl-flashSummary i{
  color:#fff3df;
}

html[data-theme="dark"] .ppl-flashCard__front{
  background:#ffffff;
  color:#102d6c;
}

html[data-theme="dark"] .ppl-flashCard__back{
  background:#102d6c;
  border-color:#102d6c;
  color:#ffffff;
}

html[data-theme="dark"] .ppl-flashCardShell .question-issue-icon-btn{
  background:rgba(255,255,255,.9);
  color:#102d6c;
}