* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #fff;
}

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

header {
  text-align: center;
  margin-bottom: 20px;
}

header h1 {
  font-size: 2rem;
  background: linear-gradient(90deg, #e94560, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #8892b0;
  margin-top: 5px;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

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

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

#cardCounter {
  color: #8892b0;
  font-size: 0.9rem;
  min-width: 60px;
  text-align: center;
}

.flashcard-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}

.flashcard {
  width: 100%;
  max-width: 400px;
  height: 300px;
  cursor: pointer;
  position: relative;
}

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

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.flashcard-front {
  background: linear-gradient(145deg, #e94560, #ff6b6b);
}

.flashcard-back {
  background: linear-gradient(145deg, #0f3460, #16213e);
  border: 2px solid #e94560;
  transform: rotateY(180deg);
}

.flashcard-front p,
.flashcard-back p {
  font-size: 1.2rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.flip-hint {
  color: #8892b0;
  font-size: 0.8rem;
  margin-top: 15px;
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.action-btn.shuffle {
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: #fff;
}

.action-btn.add {
  background: linear-gradient(145deg, #11998e, #38ef7d);
  color: #fff;
}

.action-btn.manage {
  background: linear-gradient(145deg, #f093fb, #f5576c);
  color: #fff;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

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

.modal-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  margin: 10% auto;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-large {
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  cursor: pointer;
  color: #8892b0;
  transition: color 0.3s;
}

.close:hover {
  color: #e94560;
}

.modal h2 {
  margin-bottom: 20px;
  color: #e94560;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #8892b0;
}

.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 1rem;
  min-height: 100px;
  resize: vertical;
}

.form-group textarea:focus {
  outline: none;
  border-color: #e94560;
}

.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(145deg, #e94560, #ff6b6b);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 1rem;
}

.search-box input:focus {
  outline: none;
  border-color: #e94560;
}

.cards-list {
  max-height: 400px;
  overflow-y: auto;
}

.card-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-item-question {
  font-weight: bold;
  margin-bottom: 8px;
  color: #e94560;
}

.card-item-answer {
  color: #8892b0;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.card-item-actions {
  display: flex;
  gap: 10px;
}

.card-item-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.edit-btn {
  background: #667eea;
  color: #fff;
}

.delete-btn {
  background: #e94560;
  color: #fff;
}

.card-item-actions button:hover {
  transform: translateY(-2px);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(145deg, #11998e, #38ef7d);
  color: #fff;
  padding: 15px 30px;
  border-radius: 10px;
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

.toast.error {
  background: linear-gradient(145deg, #e94560, #ff6b6b);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .flashcard {
    height: 250px;
  }

  .flashcard-front p,
  .flashcard-back p {
    font-size: 1rem;
  }

  .controls {
    gap: 10px;
  }

  .nav-btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  .action-buttons {
    gap: 8px;
  }

  .action-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }

  .modal-content {
    margin: 5% auto;
    padding: 20px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(233, 69, 96, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(233, 69, 96, 0.8);
}
