/* ===== India Library Celebrations CSS ===== */
/* Apple-quality micro-interactions and celebrations */

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  max-width: 360px;
  border-left: 4px solid var(--saffron);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(120%);
  opacity: 0;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.toast-message {
  color: var(--text-light);
  font-size: 0.85rem;
}

.toast.success { border-left-color: var(--green); }
.toast.warning { border-left-color: var(--saffron); }
.toast.error { border-left-color: #dc2626; }
.toast.achievement { 
  border-left-color: var(--gold);
  background: linear-gradient(135deg, #FFF8E1 0%, var(--card-bg) 100%);
}

/* ===== Reading Celebration Overlay ===== */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.celebration-overlay.show {
  opacity: 1;
  visibility: visible;
}

.celebration-card {
  background: linear-gradient(135deg, var(--maroon) 0%, #3D0000 100%);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  color: white;
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 420px;
  position: relative;
  overflow: hidden;
}

.celebration-overlay.show .celebration-card {
  transform: scale(1);
  opacity: 1;
}

.celebration-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
  animation: celebrationGlow 3s ease-in-out infinite;
}

@keyframes celebrationGlow {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

.celebration-emoji {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: celebrationBounce 0.6s ease-out;
  position: relative;
  z-index: 1;
}

@keyframes celebrationBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.celebration-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.celebration-subtitle {
  opacity: 0.8;
  font-size: 1.1rem;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.celebration-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.celebration-stat {
  text-align: center;
}

.celebration-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.celebration-stat-label {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.celebration-close {
  background: var(--saffron);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

.celebration-close:hover {
  background: var(--saffron-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 153, 51, 0.4);
}

/* ===== Confetti ===== */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10001;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
}

.confetti.circle { border-radius: 50%; }
.confetti.square { border-radius: 2px; }
.confetti.triangle {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid;
  background: none !important;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(-100px) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* ===== Progress Animations ===== */
.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease-out;
  transform-origin: 50% 50%;
}

.progress-pulse {
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== Book Card Hover Effects ===== */
.book-card {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-card:hover {
  transform: translateY(-8px) scale(1.02);
}

.book-card:active {
  transform: translateY(-4px) scale(0.98);
}

.book-cover img,
.book-cover .placeholder-cover {
  transition: transform 0.4s ease;
}

.book-card:hover .book-cover img,
.book-card:hover .book-cover .placeholder-cover {
  transform: scale(1.05);
}

/* ===== Button Ripple Effect ===== */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
  width: 200px;
  height: 200px;
}

/* ===== Reading Streak Badge ===== */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--saffron) 0%, var(--saffron-dark) 100%);
  color: white;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: streakGlow 2s ease-in-out infinite;
}

.streak-badge .flame {
  font-size: 1.1rem;
}

@keyframes streakGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 153, 51, 0); }
  50% { box-shadow: 0 0 20px rgba(255, 153, 51, 0.4); }
}

/* ===== Achievement Unlocked ===== */
.achievement-unlock {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, var(--gold) 0%, #D4AF37 100%);
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  animation: achievementPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes achievementPop {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.achievement-unlock .emoji {
  font-size: 3rem;
}

/* ===== Page Load Animation ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-card:nth-child(1) { animation-delay: 0.05s; }
.book-card:nth-child(2) { animation-delay: 0.1s; }
.book-card:nth-child(3) { animation-delay: 0.15s; }
.book-card:nth-child(4) { animation-delay: 0.2s; }
.book-card:nth-child(5) { animation-delay: 0.25s; }
.book-card:nth-child(6) { animation-delay: 0.3s; }
.book-card:nth-child(7) { animation-delay: 0.35s; }
.book-card:nth-child(8) { animation-delay: 0.4s; }

/* ===== Skeleton Loading ===== */
.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-cover {
  aspect-ratio: 2/3;
  background: linear-gradient(90deg, #f0e8de 25%, #f8f0e6 50%, #f0e8de 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-text {
  height: 14px;
  background: linear-gradient(90deg, #f0e8de 25%, #f8f0e6 50%, #f0e8de 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin: 8px 12px;
}

.skeleton-text.short { width: 60%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Reading Time Counter ===== */
.reading-time {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 153, 51, 0.1);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--saffron-dark);
  font-weight: 500;
}

.reading-time .icon {
  font-size: 1.1rem;
}

/* ===== Book Added Animation ===== */
@keyframes bookAdded {
  0% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.book-card.just-added {
  animation: bookAdded 0.5s ease;
}

.book-card.just-added .book-cover::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  animation: checkPop 0.4s ease;
}

@keyframes checkPop {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 80px;
    left: 16px;
    right: 16px;
  }
  
  .toast {
    transform: translateY(100%);
    max-width: none;
  }
  
  .toast.show {
    transform: translateY(0);
  }
  
  .celebration-card {
    margin: 20px;
    padding: 32px 24px;
  }
  
  .celebration-emoji {
    font-size: 4rem;
  }
  
  .celebration-title {
    font-size: 1.6rem;
  }
}

/* v1.0.0 */
