/**
 * Advanced Effects & Animations CSS
 * Modern visual effects for Edu-Link
 */

/* ===================================
   FADE-IN ANIMATIONS
   =================================== */
.animate-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-fade-in.fade-in-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================
   RIPPLE EFFECT
   =================================== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===================================
   LOADING SPINNER
   =================================== */
.loading-spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
}

.loading-spinner-overlay.visible {
  opacity: 1;
}

.loading-spinner {
  text-align: center;
  color: white;
}

.spinner-circle {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast {
  position: fixed;
  bottom: -100px;
  right: 20px;
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  z-index: 9999;
  transition: bottom 0.3s ease-out, opacity 0.3s;
  opacity: 0;
}

.toast.visible {
  bottom: 20px;
  opacity: 1;
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

.toast-success {
  border-left: 4px solid #28a745;
}

.toast-success .toast-icon {
  color: #28a745;
}

.toast-error {
  border-left: 4px solid #dc3545;
}

.toast-error .toast-icon {
  color: #dc3545;
}

.toast-warning {
  border-left: 4px solid #ffc107;
}

.toast-warning .toast-icon {
  color: #ffc107;
}

.toast-info {
  border-left: 4px solid #17a2b8;
}

.toast-info .toast-icon {
  color: #17a2b8;
}

/* ===================================
   SCROLL PROGRESS BAR
   =================================== */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #8B1538, #d32f2f);
  width: 0%;
  z-index: 9998;
  transition: width 0.1s;
}

/* ===================================
   BACK TO TOP BUTTON
   =================================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #8B1538;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #6d0f2a;
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ===================================
   HEADER SCROLL EFFECTS
   =================================== */
.site-header {
  transition: transform 0.3s, box-shadow 0.3s;
}

.site-header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

/* ===================================
   SEARCH AUTOCOMPLETE
   =================================== */
.header-search {
  position: relative;
}

.search-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s, opacity 0.3s;
  z-index: 1000;
}

.search-autocomplete.visible {
  max-height: 400px;
  opacity: 1;
  overflow-y: auto;
}

.autocomplete-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.autocomplete-item {
  border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  text-decoration: none;
  color: #333;
  transition: background 0.2s;
}

.autocomplete-link:hover {
  background: #f8f9fa;
}

.autocomplete-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.autocomplete-content {
  flex: 1;
  min-width: 0;
}

.autocomplete-title {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-title strong {
  color: #8B1538;
}

.autocomplete-description {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-loading,
.autocomplete-error,
.autocomplete-empty {
  padding: 15px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.autocomplete-error {
  color: #dc3545;
}

/* ===================================
   FORM FIELD VALIDATION
   =================================== */
.form-input {
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input.error {
  border-color: #dc3545;
}

.form-input.success {
  border-color: #28a745;
}

.field-feedback {
  font-size: 12px;
  margin-top: 5px;
  padding: 5px 10px;
  border-radius: 4px;
  animation: slideDown 0.3s;
}

.error-feedback {
  background: #f8d7da;
  color: #721c24;
}

.success-feedback {
  background: #d4edda;
  color: #155724;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================
   BUTTON LOADING STATE
   =================================== */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spinner-rotate 0.6s linear infinite;
}

/* ===================================
   CARD HOVER EFFECTS
   =================================== */
.service-card,
.profile-card,
.search-result {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.service-card:hover,
.profile-card:hover,
.search-result:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.service-card::before,
.profile-card::before {
  content: '';
  position: absolute;
  top: var(--mouse-y, 50%);
  left: var(--mouse-x, 50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 21, 56, 0.1) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.service-card:hover::before,
.profile-card:hover::before {
  opacity: 1;
}

/* ===================================
   NOTIFICATION BADGE
   =================================== */
.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.notification-badge.pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ===================================
   TYPING EFFECT
   =================================== */
.typing-effect::after {
  content: '|';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===================================
   PROGRESS BAR ANIMATION
   =================================== */
.completion-fill {
  transition: width 1s ease-out;
  position: relative;
  overflow: hidden;
}

.completion-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===================================
   FLOATING LABELS
   =================================== */
.form-row.focused .form-label {
  transform: translateY(-20px) scale(0.85);
  color: #8B1538;
}

.form-label {
  transition: transform 0.3s, color 0.3s;
  transform-origin: left center;
}

/* ===================================
   SKELETON LOADING
   =================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===================================
   SMOOTH TRANSITIONS
   =================================== */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  .toast {
    min-width: auto;
    left: 20px;
    right: 20px;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }

  .search-autocomplete {
    font-size: 14px;
  }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
  .scroll-progress-bar,
  .back-to-top,
  .toast,
  .loading-spinner-overlay,
  .search-autocomplete {
    display: none !important;
  }
}
