/* =========================
   RESET / BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
table,
input,
button,
textarea,
select {
  max-width: 100%;
}

.studytool-body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  color: #222;
  background-image: url("img/studytool-background.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

.studytool-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.25);
  z-index: -1;
}

.study-message {
  font-family: "Dancing Script", cursive;
  color: white;
  font-size: 35px;
  text-align: center;
  margin: 15px;
  padding: 0 12px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

hr {
  border: none;
  height: 1.5px;
  background: white;
  box-shadow: 0 0 10px white;
}

/* =========================
   TOP BUTTONS / DROPDOWN
========================= */
.top-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0 30px;
}

.top-btn,
.dropdown-btn {
  display: inline-block;
  padding: 10px 16px;
  background: #2e8c9e;
  border: none;
  border-radius: 10px;
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-family: "Dancing Script", cursive;
  font-size: 18px;
  text-align: center;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.top-btn:hover,
.dropdown-btn:hover {
  background: #226674;
  transform: translateY(-1px);
}

.dropdown {
  position: relative;
  z-index: 1000;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #2e8c9e;
  border-radius: 10px;
  overflow: hidden;
  z-index: 1001;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.dropdown-content a {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  font-family: "Dancing Script", cursive;
  font-size: 18px;
  color: white;
  transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
  background-color: rgb(43, 134, 145);
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
  display: block;
}

/* =========================
   SECTION BOXES
========================= */
.section-box {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: min(92%, 1000px);
  margin: 30px auto;
  padding: 20px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title-bar,
.section-header {
  width: 100%;
  text-align: center;
  padding: 12px;
  border: 1px solid #c0c0c0;
  font-family: "Dancing Script", cursive;
}

.title-bar {
  background: transparent;
  color: #04adf5;
  font-size: 40px;
  border: none;
}

.section-header {
  background: #6fc0f9;
  border: 1px solid white;
  font-size: 20px;
  color: #124d6a;
}

/* =========================
   SUBJECT / TOPIC BUTTONS
========================= */
.form-row {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  row-gap: 10px;
  column-gap: 10px;
}

.button-row label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  font-family: "Dancing Script", cursive;
  color: black;
  font-weight: bold;
  font-size: 20px;
}

.button-row p {
  font-family: "Dancing Script", cursive;
  font-size: 18px;
}

.button-row button {
  padding: 10px 15px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: 0.3s;
  font-family: "Dancing Script", cursive;
  font-size: 16px;
}

.button-row button:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.55);
}

/* =========================
   QUIZ
========================= */
.quiz-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.quiz-content {
  width: 100%;
  min-height: 300px;
  height: auto;
  background: #9bd1f7;
  border: 1px solid white;
  position: relative;
  padding: 18px;
}

.quiz-box {
  width: 100%;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.quiz-option {
  width: 100%;
  padding: 12px 16px;
  font-size: 17px;
  border-radius: 10px;
  border: none;
  background: #2e8c9e;
  color: white;
  cursor: pointer;
  text-align: left;

  transform: translateY(10px);
  opacity: 0;
  animation: slideUp 0.4s ease forwards;
  animation-delay: var(--delay);
  transition: transform 0.25s ease, background 0.25s ease;
}

.quiz-option:hover {
  transform: translateY(-3px);
  background: #226674;
}

.quiz-option:active {
  transform: scale(0.97);
  background: #1b4f58;
}

.submit-btn {
  position: absolute;
  right: 15px;
  bottom: 15px;
  padding: 12px 28px;
  border: none;
  background: #9f9f9f;
  cursor: pointer;
  font-size: 16px;
  border-radius: 8px;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* =========================
   FLASHCARD
========================= */
.flashcard-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard {
  position: relative;
  perspective: 1000px;
  width: min(220px, 100%);
  height: 280px;
  background-color: #9bd1f7;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-family: "Dancing Script", cursive;
  font-size: 22px;
  padding: 15px;
  text-align: center;
}

.flash-inner {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  border-radius: 12px;
  background-color: #9bd1f7;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px;
  text-align: center;
  font-family: "Dancing Script", cursive;
  font-size: 20px;
  transition: transform 0.8s cubic-bezier(.25, .8, .25, 1);
}

.flash-inner.front {
  transform: rotateY(0deg);
}

.flash-inner.back {
  transform: rotateY(180deg);
  z-index: 1;
}

.flashcard.flipped .front {
  transform: rotateY(180deg);
}

.flashcard.flipped .back {
  transform: rotateY(0deg);
  background-color: #a3dbee;
}

.flashcard-controls {
  padding-top: 12px;
  display: flex;
  gap: 10px;
}

.flashcard-controls button {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #2e8c9e;
  color: white;
  font-size: 18px;
  transition: 0.3s;
}

.flashcard-controls button:hover {
  transform: scale(1.1);
  background: #226674;
}

/* =========================
   PLANNER
========================= */
.planner-container {
  width: 100%;
  max-width: 700px;
  margin-top: 20px;
  padding: 20px;
  background: #9bd1f7;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.planner-container h2 {
  text-align: left;
  padding-bottom: 20px;
  font-family: "Dancing Script", cursive;
  color: rgb(21, 81, 113);
  font-size: 34px;
}

.planner-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  align-items: stretch;
}

.planner-form input,
.planner-form button {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  min-width: 0;
}

#taskInput {
  flex: 2 1 260px;
}

#dateInput {
  flex: 1 1 180px;
}

#addTaskBtn {
  flex: 1 1 140px;
  background: #2e8c9e;
  color: white;
  cursor: pointer;
  border: none;
  transition: 0.3s;
}

#addTaskBtn:hover {
  background: #226674;
}

.task-list {
  list-style: none;
  padding: 0;
}

.task-item {
  background: #f7f7f7;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeIn 0.4s forwards;
}

.task-item button {
  background: #d9534f;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.task-item button:hover {
  background: #b52b27;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   WORKSHEETS
========================= */
.worksheet-grid {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.worksheet-grid table {
  width: 100%;
  min-width: 650px;
  margin: 0 auto;
  border-collapse: collapse;
}

.worksheet-grid th,
.worksheet-grid td {
  padding: 10px;
  border: 1px solid #ddd;
  text-align: left;
  font-family: "Dancing Script", cursive;
  font-size: 18px;
}

.worksheet-grid th {
  background-color: #f5f5f5;
  color: #1f6f93;
  text-align: center;
}

.worksheet-grid a {
  color: #7c1dc9;
  text-decoration: none;
}

.worksheet-grid a:hover {
  text-decoration: underline;
}

/* =========================
   CAROUSEL / TIPS
========================= */
.carousel-section {
  width: 100%;
  margin: 20px 0 40px;
}

.tips-box {
  width: min(92%, 1000px);
  margin: 0 auto;
}

.carousel-frame {
  width: 100%;
  margin: 20px auto;
  padding: 25px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.carousel-frame h2 {
  font-family: "Dancing Script", cursive;
  font-size: 40px;
  text-align: center;
  color: #04adf5;
  margin-bottom: 20px;
}

.carousel {
  width: 100%;
  max-width: 900px;
  margin: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.viewport {
  overflow: hidden;
  width: 100%;
  position: relative;
}

.slides {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: 100%;
}

.slide {
  min-width: 100%;
  width: 100%;
  padding: 30px 20px;
  background: #9bd1f7;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.slide h3 {
  color: #2c90bc;
  margin-bottom: 10px;
  font-family: "Dancing Script", cursive;
  font-size: 25px;
  text-align: center;
}

.slide p {
  font-family: "Dancing Script", cursive;
  font-size: 20px;
  text-align: center;
  color: rgb(19, 82, 130);
  line-height: 1.5;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  color: #2c90bc;
  border: none;
  cursor: pointer;
  font-size: 20px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.left {
  left: 10px;
}

.right {
  right: 10px;
}

.arrow:hover {
  color: #1f6f93;
}

.carousel:hover .arrow {
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   BACK TO TOP
========================= */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 75px;
  height: 50px;
  border: none;
  border-radius: 12px;
  background-color: #16a2e8;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#backToTop:hover {
  background-color: #03caf7;
  transform: scale(1.08);
}

/* =========================
   TABLET
========================= */
@media (max-width: 768px) {
  .study-message {
    font-size: 28px;
  }

  .section-box {
    width: 94%;
    padding: 16px;
  }

  .title-bar {
    font-size: 30px;
  }

  .section-header {
    font-size: 18px;
  }

  .button-row label {
    width: 100%;
    margin-bottom: 6px;
  }

  .planner-container h2 {
    text-align: center;
    font-size: 28px;
  }

  .planner-form {
    flex-direction: column;
  }

  #taskInput,
  #dateInput,
  #addTaskBtn {
    width: 100%;
    flex: 1 1 100%;
  }

  .quiz-content {
    min-height: 260px;
  }

  .flashcard {
    width: 180px;
    height: 250px;
  }

  .carousel-frame h2 {
    font-size: 30px;
  }

  .slide h3 {
    font-size: 22px;
  }

  .slide p {
    font-size: 18px;
  }

  .arrow {
    opacity: 1;
    pointer-events: auto;
  }
}

/* =========================
   SMALL MOBILE
========================= */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .study-message {
    font-size: 22px;
    line-height: 1.3;
  }

  .top-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .top-btn,
  .dropdown-btn {
    width: 100%;
    font-size: 16px;
  }

  .dropdown {
    width: 100%;
  }

  .dropdown-content {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .section-box {
    width: 96%;
    padding: 14px;
    margin: 20px auto;
  }

  .title-bar {
    font-size: 22px;
    line-height: 1.2;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
    font-size: 15px;
  }

  .quiz-option {
    font-size: 15px;
    padding: 10px 12px;
  }

  .planner-container {
    padding: 14px;
  }

  .planner-container h2 {
    font-size: 22px;
  }

  .planner-form input,
  .planner-form button {
    font-size: 15px;
    padding: 10px;
  }

  .flashcard {
    width: 160px;
    height: 220px;
    font-size: 18px;
  }

  .flash-inner {
    font-size: 17px;
    padding: 10px;
  }

  .carousel-frame {
    padding: 14px;
  }

  .carousel-frame h2 {
    font-size: 24px;
  }

  .slide {
    padding: 18px 12px;
  }

  .slide h3 {
    font-size: 18px;
  }

  .slide p {
    font-size: 15px;
  }

  .worksheet-grid th,
  .worksheet-grid td {
    font-size: 14px;
    padding: 8px;
  }

  #backToTop {
    width: 56px;
    height: 42px;
    font-size: 16px;
    right: 12px;
    bottom: 12px;
  }
}
