/* Global Light Theme */
:root {
  --primary: #3498db;
  --secondary: #2ecc71;
  --accent: #9b59b6;
  --background: #f9f9f9;
  --text: #333;
  --light-text: #666;
  --card: #fff;
  --shadow: rgba(0,0,0,0.1);
  --yeti-blue: #a0d2eb;
  --snow-white: #f1f1f1;
}

html {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
  box-sizing: border-box;
  margin: 0;
  padding: 15px;
}

h1, h2, h3, h4, h5, h6, .logo, .btn {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

*, *:before, *:after {
  box-sizing: inherit;
}

.container {
  max-width: min(800px, 96vw);
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
  padding: 10px 15px 10px 8px;
  width: 100%;
}

.flashcard {
  min-height: calc(3 * 1.5rem + 4rem);
  width: 100%;
  position: relative;
  margin: 15px 0 30px;
  cursor: pointer;
  touch-action: manipulation;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.card-front, .card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  padding: 2rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.1s ease;
  text-align: center;
  font-size: clamp(16px, 5vw, 24px);
  line-height: 1.5;
  min-height: calc(3 * 1.5rem + 4rem);
  word-break: break-word;
  -webkit-tap-highlight-color: transparent;
}

.card-back { opacity: 0; }

.card-inner.flipped .card-front { opacity: 0; }
.card-inner.flipped .card-back { opacity: 1; }

.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: -35px;
  position: relative;
  z-index: 2;
  padding: 0 10px;
  width: 100%;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: clamp(16px, 4vw, 20px);
  min-width: 100px;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.correct, .incorrect {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(16px, 4vw, 20px);
  min-width: 120px;
  min-height: 50px;
  touch-action: manipulation;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.correct { background-color: #4CAF50; color: white; }
.incorrect { background-color: #f44336; color: white; }

.correct:hover {
  background-color: #3d8b40;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.incorrect:hover {
  background-color: #d32f2f;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.correct:active, .incorrect:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hidden { display: none; }

.quit-button {
  padding: 10px 16px;
  background-color: #666;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-size: 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quit-button:hover { background-color: #888; }
.quit-button:active { background-color: #555; }

/* Login/Auth Page Styles */
.login-container {
  max-width: 500px;
  margin: 7rem auto 2rem auto;
  padding: 0 15px;
}

.login-box {
  background: var(--card);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  font-family: inherit;
  background-color: white;
  color: var(--text);
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
}

.remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.remember-me label {
  cursor: pointer;
  color: var(--text);
}

.login-form button[type="submit"] {
  background-color: var(--primary);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.login-form button[type="submit"]:hover {
  background-color: #2980b9;
}

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
}

.auth-link-row {
  margin: 0.75rem 0;
  font-size: 14px;
}

.auth-link-row a {
  color: var(--primary);
  text-decoration: none;
}

.auth-link-row a:hover {
  text-decoration: underline;
}

.alpha-notice {
  margin-top: 2rem;
  padding: 1rem;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 5px;
  text-align: center;
  font-size: 14px;
  color: #856404;
}

.flash-message {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 5px;
  text-align: center;
}

.flash-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-message.warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.flash-message.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Dashboard Styles - Child-Friendly Design */
.dashboard-container {
  max-width: min(900px, 96vw);
  padding: 20px 15px;
  margin-top: 100px; /* Account for fixed header */
  /* Ensure no transforms that could affect datalist dropdowns */
  transform: none;
  transform-style: flat;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 30px;
}

.history-back-button {
  margin-bottom: 20px;
  /* Align with table left edge: dashboard-container padding (15px) + action-section padding (24px) */
  margin-left: 39px;
  align-self: flex-start;
}

@media (max-width: 600px) {
  .history-back-button {
    /* On mobile, dashboard-container padding is 15px, action-section padding is 24px */
    margin-left: 39px;
  }
}

.dashboard-header h1 {
  font-size: clamp(32px, 6vw, 48px);
  margin: 0 0 10px 0;
  color: var(--primary);
}

.welcome-message {
  font-size: clamp(18px, 4vw, 22px);
  color: var(--light-text);
  margin: 0;
}

/* Action Sections */
.action-section {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px var(--shadow);
  position: relative;
  /* Prevent transforms that could affect child elements like datalist dropdowns */
  transform: none;
  transform-style: flat;
}

.section-title {
  font-size: clamp(20px, 4vw, 24px);
  margin: 0 0 8px 0;
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

.section-description {
  font-size: clamp(14px, 3vw, 16px);
  color: var(--light-text);
  margin: 0 0 20px 0;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

/* Action Buttons */
.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  min-height: 80px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-button:active {
  transform: translateY(0);
}

.button-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.button-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  flex: 1;
}

.button-title {
  font-size: clamp(16px, 3vw, 18px);
  font-weight: 600;
  color: var(--text);
  display: block;
}

.button-subtitle {
  font-size: clamp(13px, 2.5vw, 14px);
  color: var(--light-text);
  display: block;
}

/* Primary Buttons (Study) */
.primary-button {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
}

.primary-button .button-title,
.primary-button .button-subtitle {
  color: white;
}

.primary-button:hover {
  background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
}

.study-due-button {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.study-due-button:hover {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

/* Secondary Buttons (Create) */
.secondary-button {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: white;
}

.secondary-button .button-title,
.secondary-button .button-subtitle {
  color: white;
}

.secondary-button:hover {
  background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
}

/* Tertiary Buttons (Manage) */
.tertiary-button {
  background: var(--card);
  border: 2px solid #e0e0e0;
  color: var(--text);
  padding: 16px 20px;
  min-height: 60px;
}

.tertiary-button:hover {
  border-color: var(--primary);
  background: #f8f9fa;
}

.tertiary-button .button-title {
  font-size: clamp(14px, 2.5vw, 16px);
}

.compact-buttons {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.compact-buttons .action-button {
  flex-direction: column;
  text-align: center;
  gap: 8px;
}

.compact-buttons .button-content {
  text-align: center;
}

/* Manage Section Toggle */
.section-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  margin-left: -24px;
  margin-right: -24px;
  margin-top: -24px;
  padding: 24px;
}

.section-toggle:hover .section-title {
  color: var(--primary);
}

.toggle-icon {
  font-size: 20px;
  color: var(--light-text);
  transition: transform 0.2s ease;
}

.manage-options {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

/* Sets Section */
.sets-section {
  /* Now uses action-section styling */
}

.sets-empty-state {
  text-align: center;
  padding: 20px 0;
}

.sets-section-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.sets-title-wrapper {
  text-align: center;
  width: 100%;
}

.category-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  width: 100%;
}

.filter-label {
  font-size: clamp(14px, 2.5vw, 16px);
  color: var(--light-text);
  font-weight: 500;
  white-space: nowrap;
}

.category-filter {
  background: var(--card);
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: clamp(14px, 2.5vw, 16px);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.category-filter:hover {
  border-color: var(--primary);
}

.category-filter:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.category-section {
  margin-bottom: 30px;
}

.category-title {
  font-size: clamp(18px, 3.5vw, 20px);
  margin: 0 0 16px 0;
  color: var(--text);
  font-weight: 600;
}

.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.set-card {
  background: var(--card);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  min-height: 100px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.set-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.set-icon {
  font-size: 32px;
  line-height: 1;
}

.set-name {
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 600;
  color: var(--text);
  text-align: center;
  word-break: break-word;
}

.due-badge {
  background: #ff6b6b;
  color: white;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 4px;
}

/* Sets Table Styles */
.sets-table-container {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  background: transparent;
  text-align: left;
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 3vw, 16px);
}

.sets-table thead {
  background-color: rgba(248, 249, 250, 0.5);
  border-bottom: 2px solid #e0e0e0;
}

.sets-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: clamp(14px, 2.5vw, 15px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sets-table tbody tr {
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s ease;
}

.sets-table tbody tr:hover {
  background-color: rgba(248, 249, 250, 0.5);
}

.sets-table tbody tr:last-child {
  border-bottom: none;
}

.sets-table td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
  text-align: left;
}

.set-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.set-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.no-due {
  color: var(--light-text);
  font-style: italic;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  margin-top: 30px;
}

.empty-state-content {
  max-width: 500px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.empty-state h2 {
  font-size: clamp(24px, 5vw, 28px);
  margin: 0 0 12px 0;
  color: var(--text);
}

.empty-state-message,
.empty-state-hint {
  font-size: clamp(16px, 3vw, 18px);
  color: var(--light-text);
  margin: 8px 0;
}

.empty-state-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Responsive Design */
@media (max-width: 600px) {
  .dashboard-container {
    margin-top: 90px; /* Slightly less margin on mobile */
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .sets-grid {
    grid-template-columns: 1fr;
  }
  
  .action-button {
    padding: 16px 20px;
    min-height: 70px;
  }
  
  .button-icon {
    font-size: 28px;
  }
  
  .category-filter-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    justify-content: flex-start;
  }
  
  .category-filter {
    width: 100%;
    min-width: unset;
  }
  
  .sets-table-container {
    border-radius: 8px;
  }
  
  .sets-table {
    font-size: 13px;
  }
  
  .sets-table th,
  .sets-table td {
    padding: 8px 12px;
  }
  
  .sets-table th {
    font-size: 12px;
  }
}

/* Edit Page Styles */
.back-button {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary);
  text-decoration: none;
  font-size: clamp(16px, 3vw, 18px);
  transition: color 0.2s ease;
  align-self: flex-start;
}

.back-button:hover {
  color: #2980b9;
  text-decoration: underline;
}

.dashboard-header .back-button {
  align-self: flex-start;
  margin-bottom: 10px;
}

/* Category Input Group */
.category-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.category-section-edit {
  overflow: visible;
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.category-input {
  padding: 12px 44px 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: clamp(14px, 3vw, 16px);
  font-family: inherit;
  background-color: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.category-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dropdown-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  transition: color 0.2s ease;
  z-index: 2;
}

.dropdown-toggle:hover {
  color: var(--primary);
}

.dropdown-toggle:focus {
  outline: none;
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-top: 4px;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-option {
  padding: 12px 16px;
  cursor: pointer;
  font-size: clamp(14px, 3vw, 16px);
  color: var(--text);
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.dropdown-option:last-child {
  border-bottom: none;
}

.dropdown-option:hover,
.dropdown-option.highlighted {
  background-color: #f8f9fa;
}

.dropdown-option.selected {
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--primary);
  font-weight: 600;
}

/* Card Edit Container */
.card-edit-container {
  background: var(--card);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.card-edit-container:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.card-number {
  font-size: clamp(16px, 3vw, 18px);
  font-weight: 600;
  color: var(--text);
}

.delete-card-button {
  padding: 8px 16px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: clamp(14px, 2.5vw, 16px);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.delete-card-button:hover {
  background-color: #d32f2f;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.delete-card-button:active {
  transform: translateY(0);
}

/* Card Edit Fields */
.card-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-edit-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: clamp(14px, 3vw, 16px);
  font-family: inherit;
  background-color: var(--card);
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s ease;
  line-height: 1.6;
}

.card-edit-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.card-edit-input::placeholder {
  color: var(--light-text);
}

/* Edit Actions */
.edit-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.edit-actions .action-button {
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 8px;
}

.edit-actions .save-button {
  grid-column: span 2;
}

@media (min-width: 601px) {
  .edit-actions .save-button {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .edit-actions {
    grid-template-columns: 1fr;
  }
  
  .edit-actions .save-button {
    grid-column: span 1;
  }
  
  .card-edit-container {
    padding: 16px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .delete-card-button {
    width: 100%;
  }
}

/* Loading Overlay Styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.loading-overlay[style*="display: flex"] {
  display: flex !important;
}

.loading-content {
  text-align: center;
  color: white;
}

.yeti-image {
  max-width: 200px;
  margin-bottom: 20px;
}

.loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Save Modal Styles */
.save-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.save-modal-overlay.show {
  display: flex;
}

.save-modal-content {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.save-modal-header {
  text-align: center;
  margin-bottom: 32px;
}

.save-modal-header h2 {
  font-size: clamp(24px, 5vw, 28px);
  margin: 0 0 12px 0;
  color: var(--text);
  font-weight: 600;
}

.save-modal-message {
  font-size: clamp(16px, 3vw, 18px);
  color: var(--light-text);
  margin: 0;
}

.save-modal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.save-modal-actions .action-button {
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 8px;
  min-height: 70px;
}

@media (max-width: 600px) {
  .save-modal-content {
    padding: 24px;
  }
  
  .save-modal-actions {
    grid-template-columns: 1fr;
  }
  
  .save-modal-actions .action-button {
    min-height: 60px;
  }
}

/* Practice History Table Styles */
.history-table-container {
  overflow-x: auto;
  margin-top: 16px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 3vw, 16px);
}

.history-table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #e0e0e0;
}

.history-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: clamp(14px, 2.5vw, 15px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-table tbody tr {
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s ease;
}

.history-table tbody tr:hover {
  background-color: #f8f9fa;
}

.history-table tbody tr:last-child {
  border-bottom: none;
}

.history-table td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

.success-rate-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: clamp(13px, 2.5vw, 14px);
}

.success-rate-badge.success-high {
  background-color: #d4edda;
  color: #155724;
}

.success-rate-badge.success-medium {
  background-color: #fff3cd;
  color: #856404;
}

.success-rate-badge.success-low {
  background-color: #f8d7da;
  color: #721c24;
}

@media (max-width: 600px) {
  .history-table {
    font-size: 13px;
  }
  
  .history-table th,
  .history-table td {
    padding: 8px 12px;
  }
  
  .history-table th {
    font-size: 12px;
  }
}

/* Sets List Styles */
.sets-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
}

.sets-list li {
  margin: 0;
  padding: 0;
}

.set-link {
  display: block;
  padding: 12px 16px;
  color: var(--primary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: clamp(16px, 3vw, 18px);
  border: 1px solid transparent;
}

.set-link:hover {
  background-color: #f8f9fa;
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.set-link:active {
  background-color: #e9ecef;
}

/* Manage Categories Page Styles */
.categories-header {
  margin-top: 32px;
  margin-bottom: 32px;
  text-align: center;
}


.categories-subtitle {
  color: var(--light-text);
  font-size: clamp(14px, 2.5vw, 16px);
  margin-top: 8px;
  margin-bottom: 0;
}

.categories-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.new-category-card {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid #e0e0e0;
}

.new-category-card h2 {
  margin: 0 0 16px 0;
  font-size: clamp(18px, 3vw, 20px);
  color: var(--text);
}

.new-category-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.new-category-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: clamp(14px, 2.5vw, 16px);
  font-family: inherit;
  background-color: var(--card);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.new-category-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.new-category-input::placeholder {
  color: var(--light-text);
}

.create-category-button {
  padding: 12px 24px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.create-category-button:hover {
  background-color: #2980b9;
  transform: translateY(-1px);
}

.create-category-button:active {
  transform: translateY(0);
}

.categories-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drag-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f0f7ff;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  color: var(--text);
  font-size: clamp(13px, 2.5vw, 14px);
}

.hint-icon {
  font-size: 18px;
}

.categories-table-wrapper {
  overflow-x: auto;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  background: var(--card);
  box-shadow: 0 2px 8px var(--shadow);
}

.categories-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 2.5vw, 16px);
}

.categories-table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #e0e0e0;
}

.categories-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: clamp(14px, 2.5vw, 15px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.categories-table th:first-child {
  width: 20%;
}

.categories-table th:nth-child(2) {
  width: 10%;
  text-align: center;
}

.categories-table th:nth-child(3) {
  width: 55%;
}

.categories-table th:last-child {
  width: 15%;
  text-align: center;
}

.category-row {
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.category-row:hover {
  background-color: #f8f9fa;
}


.category-name-cell {
  padding: 16px;
  vertical-align: top;
}

.category-name {
  font-weight: 600;
  font-size: clamp(15px, 2.5vw, 17px);
  color: var(--text);
}

.category-count-cell {
  padding: 16px;
  text-align: center;
  vertical-align: top;
  font-weight: 600;
  font-size: clamp(15px, 2.5vw, 17px);
  color: var(--text);
}

.category-sets-cell {
  padding: 16px;
  vertical-align: top;
  text-align: left;
  word-wrap: break-word;
  word-break: break-word;
}

.empty-sets-message {
  color: var(--light-text);
  font-size: clamp(13px, 2.5vw, 14px);
  font-style: italic;
  padding: 8px 12px;
}

.category-actions-cell {
  padding: 16px;
  text-align: center;
  vertical-align: middle;
}

.delete-category {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: clamp(13px, 2.5vw, 14px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-category:hover {
  background-color: #c0392b;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.delete-category:active {
  transform: translateY(0);
}

.no-action {
  color: var(--light-text);
  font-style: italic;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--card);
  border-radius: 12px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin: 0 0 12px 0;
  font-size: clamp(18px, 3vw, 20px);
  color: var(--text);
}

.modal-content p {
  margin: 0 0 24px 0;
  color: var(--light-text);
  font-size: clamp(14px, 2.5vw, 16px);
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-button.delete {
  background-color: #e74c3c;
  color: white;
}

.modal-button.delete:hover {
  background-color: #c0392b;
}

.modal-button.cancel {
  background-color: #95a5a6;
  color: white;
}

.modal-button.cancel:hover {
  background-color: #7f8c8d;
}

/* Toast Messages */
.success-toast,
.error-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  font-size: clamp(14px, 2.5vw, 16px);
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 300px;
}

.success-toast {
  background-color: #2ecc71;
  color: white;
}

.error-toast {
  background-color: #e74c3c;
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .categories-table-wrapper {
    border-radius: 8px;
  }

  .categories-table {
    font-size: 13px;
  }

  .categories-table th,
  .categories-table td {
    padding: 12px 8px;
  }

  .categories-table th {
    font-size: 12px;
  }

  .category-name-cell,
  .category-count-cell,
  .category-sets-cell,
  .category-actions-cell {
    padding: 12px 8px;
    font-size: 13px;
  }


  .delete-category {
    padding: 6px 12px;
    font-size: 12px;
  }

  .new-category-form {
    flex-direction: column;
  }

  .new-category-input {
    min-width: 100%;
  }

  .create-category-button {
    width: 100%;
  }

  .modal-content {
    padding: 24px;
  }

  .modal-buttons {
    flex-direction: column;
  }

  .modal-button {
    width: 100%;
  }
}

