/* PTGates Flashcards - Clean & Smart Design */

.ptg-flash-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px;
  font-family:
    "Suit",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  color: #111827;
}

/* Animations */
.ptg-view {
  display: none;
  animation: ptgSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ptg-view.active {
  display: block;
}

@keyframes ptgSlideUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.ptg-flash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f3f4f6;
}

.ptg-flash-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0;
  color: #111827;
  letter-spacing: -0.03em;
}

.ptg-flash-header-right {
  display: flex;
  gap: 12px;
}

.ptg-dash-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 14px;
  font-weight: 600;
  border-radius: 99px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ptg-dash-link:hover {
  background: #e5e7eb;
  color: #111827;
}

.ptg-tip-link {
  font-size: 13px;
  color: #6b7280;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* Header Buttons (Pill style) */
.ptg-header-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  background: #f5f6f8;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none !important;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.ptg-header-btn:hover {
  background: #e9ecf1;
  color: #111827;
}

/* Grid Layout */
.ptg-sets-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(200px, 1fr)
  ); /* Reduced from 300px */
  gap: 16px; /* Reduced from 24px */
}

/* Set Card (Smart & Edgy) */
.ptg-set-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px; /* Reduced radius */
  padding: 16px; /* Reduced padding */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px; /* Reduced height */
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.ptg-set-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.08),
    0 10px 10px -5px rgba(0, 0, 0, 0.03);
  border-color: #111827; /* Edgy Contrast */
}

/* Remove default button appearance since card is clickable */
.ptg-set-card:active {
  transform: scale(0.98);
}

.ptg-set-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.ptg-set-title {
  font-size: 16px; /* Reduced from 18px */
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  word-break: keep-all;
  padding-right: 20px;
}

.ptg-btn-delete-set {
  background: transparent;
  border: none;
  font-size: 16px;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.ptg-btn-delete-set:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Indicators / Badges */
.ptg-set-indicators {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: auto;
}

.ptg-badge-flash,
.ptg-badge-random,
.ptg-badge-bookmark,
.ptg-badge-review,
.ptg-badge-wrong {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}

.ptg-badge-flash {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
}
.ptg-badge-random {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #f3e8ff;
}
.ptg-badge-bookmark {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #ffedd5;
}
.ptg-badge-wrong {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fee2e2;
}

/* Stats */
.ptg-set-stats {
  display: flex;
  gap: 16px; /* Reduced gap */
  margin-top: 16px; /* Reduced margin */
  padding-top: 12px; /* Reduced padding */
  border-top: 1px solid #f3f4f6;
}

.ptg-stat-item {
  display: flex;
  flex-direction: column;
}

.ptg-stat-val {
  font-size: 18px; /* Reduced size */
  font-weight: 800;
  color: #374151;
  line-height: 1;
  margin-bottom: 2px;
}

.ptg-stat-val.due {
  color: #ef4444; /* Red for attention */
}

.ptg-stat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

/* Create Section / Filter */
.ptgates-filter-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.ptgates-filter-row {
  flex: 1;
  min-width: 140px;
}

.ptgates-filter-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  transition: all 0.2s;
  appearance: none; /* Modern select */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.ptgates-filter-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  outline: none;
}

.ptgates-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ptgates-btn-primary {
  background: #111827;
  color: #fff;
}

.ptgates-btn-primary:hover {
  background: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Flashcard Study View */
.ptg-study-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.ptg-btn-back {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.ptg-btn-back:hover {
  background: #f3f4f6;
  color: #111827;
}

.ptg-study-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid #e5e7eb;
}

#ptg-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  min-width: 40px;
  text-align: right;
}

.ptg-progress-bar {
  width: 100px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.ptg-progress-fill {
  height: 100%;
  background: #2563eb;
  width: 0%;
  transition: width 0.3s ease;
}

/* Card Container */
.ptg-card-container {
  perspective: 1200px;
  margin-bottom: 40px;
  min-height: 300px;
}

.ptg-flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.ptg-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center; /* Center text for flashcard */
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.ptg-flashcard.flipped .ptg-card-inner {
  transform: rotateY(180deg);
}

.ptg-card-front,
.ptg-card-back {
  position: absolute; /* Only if height is fixed, but here we use JS to adjust height */
  /* Wait, we need flexible height. The JS sets container height. */
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Vertical center */
  align-items: flex-start; /* Left align items */
  text-align: left; /* Left align text */
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ptg-card-back {
  transform: rotateY(180deg);
  background: #fff;
  border-color: #2563eb; /* Active state indication */
  box-shadow: 0 0 0 1px #2563eb inset;
}

.ptg-card-content {
  font-size: 20px;
  line-height: 1.6;
  color: #1f2937;
  width: 100%;
  word-break: keep-all;
  text-align: left;
}

.ptg-card-hint {
  position: absolute;
  bottom: 20px;
  font-size: 13px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* SRS Controls */
.ptg-study-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  transform: translateY(10px);
}

.ptg-study-controls.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ptg-btn-srs {
  flex: 1;
  max-width: 100px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.ptg-btn-srs:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.ptg-srs-label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.ptg-srs-time {
  display: block;
  font-size: 11px;
  color: #6b7280;
}

/* Difficulty Colors */
.ptg-srs-again {
  border-bottom: 4px solid #ef4444;
}
.ptg-srs-hard {
  border-bottom: 4px solid #f59e0b;
}
.ptg-srs-good {
  border-bottom: 4px solid #10b981;
}
.ptg-srs-easy {
  border-bottom: 4px solid #3b82f6;
}

/* Result View */
.ptg-result-content {
  text-align: center;
  padding: 80px 20px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
}

.ptg-result-content h3 {
  font-size: 28px;
  color: #111827;
  margin-bottom: 16px;
}

.ptg-result-content p {
  color: #6b7280;
  margin-bottom: 30px;
}

/* Spacer between Question and Choices */
.ptg-q-spacer {
  width: 100%;
  height: 50px !important ; /* 1.3x visual separation */
  clear: both;
}

/* Toast */
.ptg-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}

.ptg-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.ptgates-tip-summary {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  margin-top: 0px !important;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .ptg-flash-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ptg-flash-header h1 {
    width: 100%;
    margin-bottom: 0;
  }

  .ptg-flash-header-right {
    width: 100%;
    margin-top: 8px;
  }

  .ptg-sets-grid {
    grid-template-columns: 1fr;
  }

  .ptgates-filter-section {
    flex-direction: column;
    align-items: stretch;
  }

  .ptgates-filter-row {
    width: 100%;
  }

  .ptgates-btn {
    width: 100%;
  }

  .ptg-card-content {
    font-size: 18px;
  }

  .ptg-study-controls {
    gap: 3px; /* Tighter gap */
    width: 100%;
    justify-content: space-between; /* Ensure buttons fill width */
  }

  .ptg-btn-srs {
    padding: 6px 0; /* Minimal padding */
    min-width: 0;
    flex: 1; /* Distribute space equally */
  }

  .ptg-srs-label {
    font-size: 11px; /* Smaller label */
    margin-bottom: 2px;
    letter-spacing: -0.5px; /* Condense text */
  }

  .ptg-srs-time {
    font-size: 9px; /* Smaller time */
  }
}

/* Flashcards Header Button Style */
.ptg-flash-dashboard-link,
.ptg-flash-tip-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important; /* Slate-300 */
  border-radius: 8px !important;
  padding: 0 12px !important;
  height: 40px !important; /* Fixed Uniform Height */
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important; /* Slate-700 */
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  gap: 6px !important;
}

.ptg-flash-dashboard-link:hover,
.ptg-flash-tip-link:hover {
  background: #f1f5f9 !important; /* Slate-100 */
  border-color: #94a3b8 !important; /* Slate-400 */
  transform: translateY(-1px) !important;
  text-decoration: none !important;
  color: #0f172a !important; /* Slate-900 */
}
.ptg-srs-complete {
  border-bottom: 4px solid #111827;
  color: #111827;
}

.ptg-srs-complete:hover {
  background-color: #f3f4f6;
}
