/* Base Styles */
:root {
  --primary-color: #4F46E5;
  --primary-color-rgb: 79, 70, 229;
  --primary-light: #818CF8;
  --primary-dark: #372bc2;
  --secondary-color: rgba(255, 255, 255, 0.1);
  --background-start: #667eea;
  --background-end: #764ba2;
  --modal-background:  color-mix(in srgb, color-mix(in srgb, var(--background-start) 60%, var(--background-end)) 80%, white);
  --text-color: white;
  --text-light: rgba(255, 255, 255, 0.7);
  --text-secondary: rgba(0, 0, 0, 0.8);
  --border-color: rgba(255, 255, 255, 0.3);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 12px;
  --spacing-unit: 1rem;
  --max-width: 600px;
  --header-height: 64px;
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
  line-height: 1.5;
  color: var(--text-color);
  background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding-bottom: calc(2rem + var(--safe-area-inset-bottom));
  position: relative;
  min-height: 100vh;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  opacity: 0.8;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin: 0 calc(-1 * var(--spacing-unit));
  padding: 0 1rem;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Header content container */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 0.5rem;
}

/* Header content - centers the title */
.header-content {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Show the h1 in both screens */
.app-header h1 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content,
.app-info-modal {
  border-radius: 12px;
  padding: 1.5rem;
  margin: 0.5rem auto;
  width: 90%;
  max-width: 500px;
  background: linear-gradient(135deg, var(--background-start) -50%, var(--background-end) 100%);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease-out;
  position: relative;
  top: 2rem;
  overflow-y: auto;
  box-shadow: 1px 2px 3px var(--border-color);
}

.app-info-modal {
  top: 0.5rem;
  padding: 0.25rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.app-info-modal ul {
    padding-left: 1rem;
    margin-left: 1rem; 
    margin-bottom: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-color);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
  z-index: 10;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--text-color);
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 1.5rem;
}


.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    background: transparent;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border: 3px solid #e5e7eb;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 2rem;
    max-height: 4rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.form-actions .btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.form-actions .btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.form-actions .btn-primary:hover {
    background-color: var(--primary-dark);
}

.form-actions .btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.form-actions .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Card list styles */
.card-list {
    margin: 1rem 0;
}

.card-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.difficulty {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.difficulty-1 { background-color: #d4edda; color: #155724; }
.difficulty-2 { background-color: #fff3cd; color: #856404; }
.difficulty-3 { background-color: #f8d7da; color: #721c24; }

/* Language pair label in header */
.language-pair {
  font-size: 0.9rem;
  color: var(--text-light);
  white-space: normal; /* Changed from nowrap to allow wrapping */
  text-overflow: initial; /* Changed from ellipsis */
  overflow: visible; /* Changed from hidden */
  width: fit-content; /* Box size fits content */
  max-width: 100px; /* Limit max width to prevent interfering with title */
  text-align: right; /* Text is left-aligned within the box */
  font-weight: normal;
  margin-left: auto; /* Box is right-aligned within parent */
  padding-right: 0.5rem;
  word-wrap: break-word; /* Ensure long words can break */
  hyphens: auto; /* Enable hyphenation for better wrapping */
  line-height: 1.2; /* Tighter line height for wrapped text */
}

/* Back button in header - only for study screen */
#back-btn {
  margin-right: auto;
}

/* Hide back button in welcome screen */
.welcome-container #back-btn {
  display: none;
}

/* Show header placeholders in welcome screen */
.welcome-container .header-placeholder {
  visibility: visible;
  width: 24px;
}

/* Header placeholders for consistent spacing */
.header-placeholder {
  width: 40px; /* Same as back button width */
  height: 40px;
  flex-shrink: 0;
  visibility: hidden; /* Hide the placeholder in study screen */
}

/* Add flashcard icon before the title */
.app-header h1::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.app-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  flex: 1;
  text-align: center;
}

.language-label {
  font-size: 0.9rem;
  color: var(--text-light);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 120px;
  text-align: right;
  font-weight: normal;
  padding-left: 0.5rem;
  margin: 0;
  line-height: 1;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary-dark);
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover, .btn-icon:focus {
  background-color: rgba(99, 102, 241, 0.1);
  transform: none;
  outline: none;
}

/* Welcome screen header specific styles */
.welcome-container .app-header {
  justify-content: center;
}

.welcome-container .header-placeholder {
  flex: 1;
  max-width: 40px;
  visibility: visible;
}

.welcome-container h1 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* Add the flashcard icon before the title */
.welcome-container h1::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Shared screen container styles */
.screen-container,
.welcome-container,
.study-container,
.manage-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

.screen-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--spacing-unit);
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  background: transparent;
  backdrop-filter: blur(10px);
}

.screen-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: white;
}

.language-selector {
  margin: 1rem 0;
  text-align: left;
}

.language-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.language-selector label {
  display: block;
  margin-bottom: 0;
  font-weight: 500;
  color: var(--text-color);
}

.language-selector-row label {
  flex: 0 0 auto;
  white-space: nowrap;
}

.language-selector select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);  
  background-color: transparent;
}

.language-selector select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.deck-selector {
  margin-top: 1rem;
}

.deck-selector select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);  
  background-color: transparent;
}

.deck-selector select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.button-container {
  display: flex;
  flex-direction: column;
}

.difficulty-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

.search-scope-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.search-scope-label {
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

.search-target-btn {
  flex: 0;
  margin-left: 3px;
}

.search-scope-btn {
  flex-direction: column;
  flex: 1;
  min-width: 3rem; /* Allow buttons to shrink below min-width */
}

.search-target-btn,
.search-scope-btn,
.time-period-btn,
.difficulty-filter-btn {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 80px;
}

.search-scope-btn {
  flex: 1;
  min-width: 0; /* Allow buttons to shrink below min-width */
}

.search-target-btn:hover,
.search-scope-btn:hover,
.time-period-btn:hover,
.difficulty-filter-btn:hover {
/*  background: var(--primary-dark); */
  border-color: rgba(255, 255, 255, 0.5);
}

.search-target-btn.active,
.search-scope-btn.active,
.time-period-btn.active,
.difficulty-filter-btn.active {
  background: var(--primary-color) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  color: white !important;
}

.search-target-btn.active:hover,
.search-scope-btn.active:hover,
.time-period-btn.active:hover,
.difficulty-filter-btn.active:hover {
/*  background: var(--primary-dark) !important; */
  border-color: rgba(255, 255, 255, 0.7) !important;
}

.search-scope-btn .count,
.difficulty-filter-btn .count,
.time-period-btn .count {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 2.6rem;  /* Increased from 20px to fit 4 digits */
  text-align: center;
  display: inline-block; /* Ensure width is respected */
  box-sizing: border-box; /* Include padding in width calculation */
}

/* Stats Section Styles */
.stats-section {
  margin: 0 0 1rem 0;
  padding: 0rem;
}

.stats-content {
  display: flex;
  justify-content: center;  /* Center items horizontally */
  gap: 2rem;  /* Add more space between items */
  flex-wrap: nowrap;  /* Keep items in a single row */
  width: 100%;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border-radius: 8px;
  min-width: 80px;
}

.stat-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: -0.3rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
}

.stat-value-mastered {
  font-size: 1.5rem;
  font-weight: 800;
  color: lightgreen;
}

.stat-value-studying {
  font-size: 1.5rem;
  font-weight: 800;
  color: rgba(0, 0, 255, 0.7);
}

.stat-item {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.stat-item:active {
  transform: translateY(0);
  background-color: rgba(255, 255, 255, 0.15);
}

/* Time Filter Styles */
.time-filter-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--secondary-color);
  border-radius: var(--border-radius);
}

.time-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.time-filter-label {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
}

.time-filter-toggle {
  display: flex;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.15rem;
  border: 1px solid var(--border-color);
}

.time-mode-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.time-mode-btn:hover {
  background: var(--secondary-color);
}

.time-mode-btn.active {
  background: var(--primary-color);
  color: white;
}

.time-period-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0 0rem;
}

.button-container button {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.button-container button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Header placeholder for consistent spacing */
.header-placeholder {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* Direction Toggle */
.direction-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  width: 100%;
  justify-content: right;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:focus + .toggle-slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

.toggle-label {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--text-color);
  font-size: 0.9rem;
}

.manage-actions {
  padding: 1rem var(--spacing-unit) 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.manage-actions .btn {
  flex: 1;
  min-width: 120px;
}

.manage-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: var(--max-width);
  margin: 0 auto;
}

.manage-container #card-list-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--spacing-unit) 1rem;
  min-height: 0;
}

.cards-table-wrapper {
  width: 100%;
  overflow-x: visible;
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: block;
}

.cards-table thead,
.cards-table tbody {
  display: block;
  width: 100%;
}

.cards-table tbody {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.cards-table tr {
  display: table;
  width: 100%;
}

.cards-table th,
.cards-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.cards-table thead th {
  background: var(--secondary-color);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.cards-table tr:last-child td {
  border-bottom: none;
}

.front-cell {
  color: var(--text-color);
  font-weight: 600;
  width: 45%;
}

.back-cell {
  color: lightgreen;
  width: 45%;
}

.actions-col {
  width: 20%;
  white-space: nowrap;
  text-align: right;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  color: var(--text-light);
  transition: var(--transition);
  padding: 0;
}

.icon-btn + .icon-btn {
  margin-left: 0.5rem;
}

.icon-btn:hover,
.icon-btn:focus {
  background: var(--secondary-color);
  color: var(--text-color);
  outline: none;
}

.delete-btn:hover,
.delete-btn:focus {
  border-color: #ef4444;
  color: #ef4444;
}

/* Study screen list view styles */
.view-toggle-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.current-row {
  background: rgba(59, 130, 246, 0.5);
  border-left: 3px solid #3b82f6;
}

.difficulty-col {
  text-align: center;
  width: 10%;
}

.difficulty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
}

.difficulty-icon.none {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.difficulty-icon.easy {
  background: rgba(34, 197, 94, 0.7);
}

.difficulty-icon.medium {
  background: rgba(245, 158, 11, 0.7);
}

.difficulty-icon.hard {
  background: rgba(239, 68, 68, 0.7);
}

.translation-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-row {
  background: rgba(59, 130, 246, 0.5);
}

.card-accent-warning {
  position: relative;
  bottom: 0.2rem;
}

.card-accent-warning,
.accent-warning {
  color: rgba(255, 0, 0, 0.8);
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  margin-top: 0.25rem;
  animation: flash-red 1s ease-in-out 10;
  padding: 0.25rem;
}

@keyframes flash-red {
  0%, 100% { 
    opacity: 0.8; 
    color: red;
  }
  50% { 
    opacity: 0.5; 
    color: red;
  }
}

.action-cell {
  padding: 0.75rem 0.5rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.action-buttons .difficulty-btn {
  font-size: 0.75rem;
  padding: 0.5rem;
  width: 3rem !important;
  height: 3rem;
  min-width: 3rem !important;
  max-width: 3rem !important;
  flex: none !important;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-buttons .difficulty-btn.easy {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.5);
}

.action-buttons .difficulty-btn.medium {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.5);
}

.action-buttons .difficulty-btn.hard {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
}

.action-speaker {
  padding: 0.5rem;
  width: 3rem;
  height: 3rem;
  flex: none;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-speaker:hover,
.action-speaker:focus {
  background: var(--secondary-color);
  color: var(--text-color);
  outline: none;
}

.translation-mask {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease;
  user-select: none;
}

.translation-mask:hover {
  background: rgba(255, 255, 255, 0.2);
}

.masked-text {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.9em;
}

.revealed-text {
  color: lightgreen;
  font-weight: 500;
}

/* Speaker button styles */
.text-with-speaker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}

.text-with-speaker h2 {
  color: var(--primary-dark);
  vertical-align: middle;
  margin-bottom: 0;
}

.speaker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.speaker-btn.local-voice {
  background: var(--primary-color);
}

.speaker-btn.local-voice:hover {
  background: var(--primary-light);
  color: white;
}

.speaker-btn.responsive-voice {
  background: var(--background-end);
}

.speaker-btn.responsive-voice:hover {
  background: var(--background-start);
  color: white;
}

.speaker-btn:active {
  transform: scale(0.95);
}

.speaker-btn svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.speaker-btn-small {
  padding: 0.35rem;
}

/* Translation Practice Styles */
.translation-practice {
  margin-top: auto;
  width: 100%;
}

.translation-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.translation-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
  color: var(--background-end);
  transition: border-color 0.2s, box-shadow 0.2s;
  height: 2.5rem;
  min-width: 5rem;
}

.translation-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.translation-input::placeholder {
  color: var(--text-light);
  opacity: 0.7;
}

.check-translation-btn {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.check-translation-btn:hover {
  background: var(--primary-dark);
}

.check-translation-btn:active {
  transform: scale(0.95);
}

.check-translation-btn:disabled {
  background: #ccc;
  color: #999;
  cursor: not-allowed;
  transform: none;
}

.check-translation-btn:disabled:hover {
  background: #ccc;
}

.check-translation-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Check button feedback states */
.check-translation-btn.perfect {
  background: #28a745;
  color: white;
  border: 1px solid #28a745;
}

.check-translation-btn.partial {
  background: #ffc107;
  color: #212529;
  border: 1px solid #ffc107;
}

.check-translation-btn.nomatch {
  background: #dc3545;
  color: white;
  border: 1px solid #dc3545;
}

.check-translation-btn.nomatch svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Difficulty recommendation flashing */
.difficulty-btn.recommendation {
  animation: flashRecommendation 2s ease-in-out 3;
  border-color: currentColor !important;
  box-shadow: 0 0 15px currentColor !important;
}

@keyframes flashRecommendation {
  0%, 100% {
    transform: scale(1);
    border-color: currentColor;
    box-shadow: 0 0 5px currentColor;
  }
  50% {
    transform: scale(1.05);
    border-color: currentColor;
    box-shadow: 0 0 20px currentColor;
  }
}

.example-container {
  margin-top: 1rem;
  justify-content: flex-start;
  align-items: flex-start;
}

.example-container .example {
  flex: 1;
  margin: 0;
}

/* Flashcard styles */
.flashcard {
  position: relative;
  width: 100%;
  height: 300px;
  perspective: 1000px;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  background-color: white;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-front {
  transform: rotateY(0deg);
  z-index: 2;
}

.card-back {
  transform: rotateY(180deg);
  z-index: 1;
}

.flashcard[flipped] .card-front {
  transform: rotateY(180deg);
}

.flashcard[flipped] .card-back {
  transform: rotateY(0deg);
}

.card-content {
  text-align: center;
  width: 100%;
  padding: 1rem;
}

.hint {
  color: var(--primary-light);
  font-size: 0.875rem;
  margin-top: 1rem;
  font-style: italic;
}

.card-type {
  color: var(--primary-color);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

.card-notes {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.4;
  padding: 0.25rem 0.5rem;
  background-color: rgba(var(--primary-color-rgb), 0.05);
  border-radius: 0.25rem;
  border-left: 3px solid var(--primary-color);
}

.note-item {
  margin-bottom: 0.25rem;
}

.note-item:last-child {
  margin-bottom: 0;
}

/* List view specific notes styling */
.cards-table .card-notes {
  margin-top: 0.25rem;
  padding: 0.125rem 0.25rem;
  font-size: 0.75rem;
  background-color: rgba(var(--primary-color-rgb), 0.03);
}

.cards-table .note-item {
  margin-bottom: 0.125rem;
}

.cards-table .note-item:last-child {
  margin-bottom: 0;
}

.example {
  color: var(--primary-color);
  font-style: italic;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

h1.clickable {
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

h1.clickable:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

h1.clickable:active {
  transform: scale(0.98);
}

h1::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  background-image: url('../images/favicon.ico');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-color);
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.language-selector {
  position: relative;
  min-width: 160px;
}

.language-selector select {
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 1.2rem;
  appearance: none;
  color: white;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%270.5rem%27%20height%3D%270.5rem%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27white%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E"); 
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.5em;
  transition: var(--transition);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.language-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.language-selector .option {
  background-color: var(--border-color);
  color: black
}

/* Flashcard */
.flashcard {
  position: relative;
  width: 100%;
  min-height: 280px;
  margin: 0 0 2rem;
  cursor: pointer;
  perspective: 1000px;
  border-radius: var(--border-radius);
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
}

.flashcard:active {
  transform: scale(0.98);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  background: white;
  transition: all 0.3s ease;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-face::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.card-content {
  width: 100%;
  text-align: center;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 1rem 0;
}

.card-text {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-color);
  line-height: 1.3;
}

.card-example {
  font-size: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-front {
  background-color: white;
  transform: rotateY(0deg);
}

.card-back {
  background-color: white;
  transform: rotateY(180deg);
}

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

.flashcard.flipped .card-back {
  transform: rotateY(0deg);
}

/* Add these to your style.css */
@keyframes flipOutX {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(90deg); opacity: 0; }
}
@keyframes flipInX {
  from { transform: rotateX(-90deg); opacity: 0; }
  to { transform: rotateX(0deg); opacity: 1; }
}
/* Add these classes to control the animations */
.flip-out {
  animation: flipOutX 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.flip-in {
  animation: flipInX 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
  opacity: 0;
}

.hint {
  font-size: 0.875rem;
  color: var(--primary-light);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--secondary-color);
  border-radius: 9999px;
  font-style: normal;
  font-weight: 500;
}

.hint::before {
  content: '👆';
  font-size: 1.1em;
}

/* Card Actions */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.difficulty-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

/* Repeat Dropdown Styles */
.repeat-dropdown {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  border-color: var(--border-color);
  background: transparent;
  color: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.repeat-dropdown:hover {
  border-color: #9ca3af;
}

.repeat-dropdown:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: var(--transition);
  text-align: center;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--primary-light);
}

.btn-secondary-white-bg {
  background-color: var(--primary-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary-white-bg:hover:not(:disabled) {
  background-color: var(--primary-color);
}

.btn-success {
  background-color: #28a745;
  color: white;
  border: none;
  box-shadow: 0 1px 3px 0 rgba(40, 167, 69, 0.3), 0 1px 2px 0 rgba(40, 167, 69, 0.2);
}

.btn-success:hover:not(:disabled) {
  background-color: #218838;
}

/* Loading Spinner Styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner-container {
  text-align: center;
  color: white;
}

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

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

.loading-text {
  font-size: 1rem;
  margin: 0;
  color: white;
}

/* Search input error animation */
.search-input-error {
  animation: searchInputError 2s ease-in-out;
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

@keyframes searchInputError {
  0% {
    border-color: var(--border-color);
    box-shadow: none;
    transform: scale(1);
  }
  10% {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
    transform: scale(1.02);
  }
  20% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.02);
  }
  40% {
    transform: scale(1);
  }
  100% {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
    transform: scale(1);
  }
}

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

.difficulty-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.difficulty-btn::before {
  font-size: 1.25em;
  margin-bottom: 0.25rem;
}

/* Difficulty button colors are now handled by the active state */
.difficulty-btn.easy::before {
  content: '😊';
}

.difficulty-btn.medium::before {
  content: '😐';
}

.difficulty-btn.hard::before {
  content: '😓';
}

.difficulty-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.difficulty-btn.easy.active {
  color: darkgreen;
  border-color: #A7F3D0;
  background-color: #dbffee;
}

.difficulty-btn.medium.active {
  color: #F59E0B;
  border-color: #FDE68A;
  background-color: #fff8da;
}

.difficulty-btn.hard.active {
  color: red;
  border-color: #FCA5A5;
  background-color: #feebeb;
}

.difficulty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Navigation buttons */
.navigation-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.nav-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.nav-btn .btn-text {
  font-weight: 500;
}

.nav-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.nav-btn:active:not(:disabled) {
  transform: translateY(1px);
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Prevent flip for prompt cards */
.flashcard.no-flip {
  pointer-events: none;
}

.flashcard.no-flip .card-content {
  pointer-events: auto;
}

/* Prompt card styles */
.prompt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  height: 100%;
}

.prompt-card h3 {
  color: var(--primary-dark);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.prompt-card p {
  color: var(--primary-color);
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.prompt-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.prompt-buttons .btn {
  min-width: 80px;
  padding: 0.75rem 1.25rem;
}

/* Skip button styles (keeping for reference if needed) */
.skip-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.skip-btn .btn-text {
  font-weight: 500;
}

.skip-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.skip-btn:active:not(:disabled) {
  transform: translateY(1px);
  background-color: rgba(255, 255, 255, 0.2);
}

/* Progress */
.progress {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  margin: 1rem 0;
}

.empty-state p {
  margin-bottom: 1.5rem;
  max-width: 24rem;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
  :root {
    --spacing-unit: 0.75rem;
  }
  
  .card-text {
    font-size: 1.75rem;
  }
  
  .difficulty-buttons {
    flex-direction: column;
  }
  
  .difficulty-btn {
    padding: 0.75rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Ripple Effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.7);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}
/* Button hover effect */
button:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-2px);
}
.progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
  font-size: 0.875rem;
  color: var(--text-light);
}

.progress-left {
  display: flex;
}

.progress-bar {
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  color: var(--text-color);
  font-size: 0.9rem;
  align-content: center;
}

/* Add Card Form */
.add-card {
  margin-top: auto;
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.add-card h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

input[type="text"] {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

#addCardBtn {
  background-color: #4caf50;
  color: white;
  margin-top: 0.5rem;
}

/* Conjugation Modal Styles */
.conjugation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.conjugation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--primary-color);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.conjugation-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
}

.conjugation-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.conjugation-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.conjugation-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.conjugation-controls {
  margin-bottom: 1.5rem;
}

.conjugation-controls label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.conjugation-controls select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--background-color);
  color: var(--text-color);
  font-size: 1rem;
}

.conjugation-display {
  background: var(--background-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  min-height: 200px;
}

.tense-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.tense-item {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tense-item:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tense-item h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary-color);
  font-size: 1.1rem;
  font-weight: 500;
}

.tense-description {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.conjugation-result {
  background: var(--card-background);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.conjugation-result h3 {
  margin: 0 0 1rem 0;
  color: var(--primary-color);
  font-size: 1.2rem;
  font-weight: 500;
}

.conjugation-table {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.conjugation-header {
  display: grid;
  grid-template-columns: 1fr repeat(5, 1fr);
  background: var(--primary-color);
  color: white;
  font-weight: 500;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
}

.tense-header {
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}

.tense-name-cell {
  padding: 0.75rem 1rem;
  background: rgba(var(--primary-color-rgb), 0.1);
  font-weight: 500;
  text-align: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.tense-header-row {
  background: rgba(var(--primary-color-rgb), 0.05);
}

.person-form {
  padding: 0.75rem 1rem;
  font-weight: 500;
  text-align: center;
}

.tense-separator {
  height: 2px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

.conjugation-row {
  display: grid;
  grid-template-columns: 1fr repeat(5, 1fr);
  border-bottom: 1px solid var(--border-color);
}

.conjugation-row:last-child {
  border-bottom: none;
}

.conjugation-row:hover {
  background-color: rgba(var(--primary-color-rgb), 0.05);
}

.person-cell {
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--border-color);
  background: rgba(var(--primary-color-rgb), 0.02);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.form-cell {
  padding: 0.75rem 1rem;
  font-weight: 500;
  text-align: center;
}

.person-pronoun {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.person-english {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.empty-form {
  color: var(--text-secondary);
  font-style: italic;
}

.error-message {
  color: var(--error-color, #dc2626);
  background-color: rgba(220, 38, 38, 0.1);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

/* Conjugation Button */
.conjugation-btn {
  background: none;
  border: 1px solid var(--primary-color);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  margin-left: 0.5rem;
  cursor: pointer;
  color: var(--primary-color);
  transition: all 0.2s;
  font-size: 0.8rem;
}

.conjugation-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

.text-with-speaker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 480px) {
  .card-content {
    font-size: 1.5rem;
  }
  
  .controls {
    flex-direction: column;
  }
  
  .flip-btn {
    margin: 0.5rem 0;
  }
}

/* Speech Settings Styles */
.speech-settings {
  background: var(--background-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e9ecef;
}

.speech-settings h3 {
  margin: 0 0 1rem 0;
  color: var(--text-color);
  font-size: 1.1rem;
  font-weight: 600;
}

.speech-fallback-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.speech-status p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-color);
}

.speech-config {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.speech-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.speech-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.speech-buttons .btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.speech-buttons .btn-primary {
  background-color: #007bff;
  color: white;
}

.speech-buttons .btn-primary:hover {
  background-color: #0056b3;
}

.speech-buttons .btn-secondary {
  background-color: #6c757d;
  color: white;
}

.speech-buttons .btn-secondary:hover {
  background-color: #545b62;
}

.speech-buttons .btn-danger {
  background-color: #dc3545;
  color: white;
}

.speech-buttons .btn-danger:hover {
  background-color: #c82333;
}

.speech-info {
  margin-top: 0.5rem;
}

.speech-info small {
  color: var(--text-light);
  font-size: 0.8rem;
  line-height: 1.4;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: monospace;
}

.form-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Search Panel Styles */
.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.search-panel.hidden {
  display: none;
}

.search-panel-content {
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s ease-out;
  position: relative;
  top: -8rem;
}

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

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.search-header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-header h3 {
  margin: 0;
  margin-right: auto;
  font-size: 1.5rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  border-radius: 8px;
  transition: background-color 0.2s, color 0.2s;
  position: relative;
  top: -1rem;
  right: -0.5rem;
  z-index: 10;
}

.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Ensure datalist doesn't cover close button */
.search-input[list]::-webkit-calendar-picker-indicator,
.search-input[list]::-webkit-inner-spin-button {
  display: none;
}

/* Style for datalist options (browser-dependent) */
.search-input[list] {
  cursor: text;
}

.search-input-container {
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  background: transparent;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border: 3px solid #e5e7eb;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Search history datalist styling */
.search-input::-webkit-calendar-picker-indicator,
.search-input::-webkit-inner-spin-button {
  display: none;
}

/* Style for datalist options (browser-dependent) */
.search-input[list] {
  cursor: text;
}

.search-buttons {
  display: flex;
  gap: 1rem;
}

.search-buttons .btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.search-buttons .btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.search-buttons .btn-primary:hover {
  background-color: var(--primary-dark);
}

/* Study and Search button row */
.study-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.study-btn {
  flex: 1;
  padding: 0.75rem 1rem;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  max-width: 3rem;
  padding: 0.75rem;
  flex-shrink: 0;
}

.search-btn svg {
  flex-shrink: 0;
}

/* Responsive adjustments for search panel */
@media (max-width: 480px) {
  .search-panel-content {
    width: 95%;
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .search-buttons {
    flex-direction: column;
  }
  
  .search-buttons .btn {
    width: 100%;
  }
}

.app-info-header {
  text-align: center;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: white;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  gap: 1rem;
}

.app-info-header table {
  width: 100%;
  border-collapse: collapse;
}

.app-info-header table td {
  padding: 0;
  vertical-align: middle;
}

.app-info-header table td:first-child {
  width: auto; /* Icon column - auto width */
}

.app-info-header table td:nth-child(2) {
  width: 100%; /* Middle column - takes all remaining space */
}

.app-info-header table td:last-child {
  width: auto; /* Button column - auto width */
  text-align: right;
}

.app-info-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

.app-info-icon::before {
  content: '';
  display: inline-block;
  width: 36px;
  height: 36px;
  background-image: url('../images/favicon.ico');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  margin-right: 1rem;
}

.app-info-version {
  font-size: 1rem;
  opacity: 0.9;
  margin: -0.5rem 0 0 0;
  text-align: center;
}

.app-info-version-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.check-update-btn {
  background: var(--primary-light);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-update-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: rotate(90deg);
}

.check-update-btn:disabled {
  background: var(--secondary-color);
  color: lightgreen;
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.check-update-btn.checking {
  animation: spin 1s linear infinite;
  color: white;
}

.check-update-btn.up-to-date {
  background: #28a745;
  color: white;
  transform: none;
}

.check-update-btn.error {
  background: #dc3545;
  color: white;
  transform: none;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive adjustments for speech settings */
@media (max-width: 480px) {
  .speech-buttons {
    flex-direction: column;
  }
  
  .speech-buttons .btn {
    width: 100%;
    text-align: center;
  }
  
  .app-info-version-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .check-update-btn {
    align-self: flex-end;
  }
}
