/* ==========================
   Flashcards CSS
   Cleaned & Responsive
=========================== */

/* --- Base / Desktop --- */
body {
  font-family: "Times New Roman", sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  background-color: #f4f2ef;
  padding: 20px;
  box-sizing: border-box;
  background: #f3f4f6;
}

.main-wrapper {
  display: flex;
  flex-direction: column;      /* stack content vertically */
  justify-content: flex-start;  /* top-align content */
  align-items: center;          /* center horizontally */
  gap: 20px;
  padding: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  transition: margin-left 0.3s ease; /* smooth shift */
}


.flashcard-container {
  text-align: center;
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 650px; /* desktop max */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.flashcard-header {
  font-size: 1.5em;
  margin-bottom: 0px;
  font-weight: bold;
}

/* Status Row */
.status-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1em;
  margin-bottom: 0px;
  font-weight: bold;
}

.status.learning { color: #c0392b; }
.status.know { color: #27ae60; }

/* Flashcard */
.flashcard {
  width: 650px;
  height: 400px;
  perspective: 1000px;
  margin: 20px 0;
}

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

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3em;
  background: #eef9ff;
}

.flashcard-front { background: white; }
.flashcard-back { transform: rotateY(180deg); }

/* Buttons */
.flashcard-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 0px;
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-size: 1em;
  color: white;
  cursor: pointer;
  transition: transform 0.15s, background 0.25s;
}

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

.btn-red { background-color: #c0392b; }
.btn-red:hover { background-color: #e74c3c; }

.btn-green { background-color: #27ae60; }
.btn-green:hover { background-color: #2ecc71; }

/* Navigation */
.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.flashcard-controls button {
  padding: 8px 14px;
  font-size: 1em;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background-color: #2b6ea3;
  color: white;
  transition: background 0.2s;
}

.flashcard-controls button:hover {
  background-color: #1f4f75;
}

/* Animations */
.slide-left { animation: slideLeft 0.6s ease forwards; }
.slide-right { animation: slideRight 0.6s ease forwards; }

@keyframes slideLeft {
  to { transform: translateX(-120%) rotate(-10deg); opacity: 0; }
}

@keyframes slideRight {
  to { transform: translateX(120%) rotate(10deg); opacity: 0; }
}

/* Review controls */
.flashcard-review-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
}

.btn-blue { background-color: #2980b9; }
.btn-blue:hover { background-color: #3498db; }

.btn-gray { background-color: #7f8c8d; }
.btn-gray:hover { background-color: #95a5a6; }

/* End screen */
.flashcard-end {
  text-align: center;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 20px;
}

.flashcard-end h2 {
  margin-bottom: 0px;
  color: #2b6ea3;
}

#flashcard-end p { font-size: 1.2em; margin: 5px 0; }

/* Hint */
#flashcard-hint {
  color: #555;
  font-style: italic;
  margin-bottom: 0px;
}

#flashcard-hint-btn {
  padding: 6px 12px;
  font-size: 0.9em;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background-color: #777;
  color: white;
  transition: background 0.2s;
  width: 150px;
  margin: 5px auto 10px auto;
}

#flashcard-hint-btn:hover { background-color: #555; }

/* List selector */
.list-selector { text-align: center; margin-bottom: 0px; }
.list-selector label { margin-right: 10px; font-weight: bold; }

#list-select, #load-list-btn {
  font-size: 1em;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin: 5px;
}

#load-list-btn {
  background-color: #2b6ea3;
  color: white;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

#load-list-btn:hover { background-color: #45a049; }

/* Flashcard message overlay */
.flashcard-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  font-size: 1.2em;
  z-index: 999;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.flashcard-message.show { display: block; opacity: 1; }

/* ==========================
   Responsive: Mobile & Tablets
=========================== */
@media (max-width: 768px) {

  body {
    font-size: 1em;
    padding: 0 10px; /* less horizontal padding */
  }

  .flashcard-container {
    width: 100%;
    max-width: 95%; /* fill almost full screen */
    padding: 10px;
    box-sizing: border-box;
  }

  .status-row {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
  }

  .flashcard {
    width: 100%;
    max-width: 100%;
    height: 250px;
    font-size: 1.2em;
  }

  .flashcard-front,
  .flashcard-back {
    font-size: 1.6em;
    padding: 10px;
    box-sizing: border-box;
  }

  .flashcard-actions {
    flex-direction: row;
    justify-content: space-around; /* buttons side by side */
    gap: 10px;
  }

  .btn { width: 48%; padding: 12px; }

  #flashcard-hint-btn { width: 80%; margin-top: 10px; }

  .flashcard-end { padding: 15px; }

  .flashcard-review-controls {
    flex-direction: row;
    justify-content: space-around;
    gap: 10px;
  }
}

/* Extra small screens under 400px */
@media (max-width: 400px) {
  .flashcard {
    height: 200px;
  }

  .flashcard-front,
  .flashcard-back {
    font-size: 1.3em;
  }

  .btn { width: 100%; }
}
