/* ==============================================
   MAIDAM TAKAFUL - FRONTEND ENHANCEMENTS CSS
   Add this to the <style> section of each HTML file
   ============================================== */

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

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

.loading-logo .logo-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--magenta) 50%, var(--orange) 50%);
  border-radius: 16px;
  transform: rotate(45deg);
  margin: 0 auto 30px;
  animation: pulse 2s ease infinite;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--light-gray);
  border-top-color: var(--magenta);
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%, 100% { transform: rotate(45deg) scale(1); }
  50% { transform: rotate(45deg) scale(1.1); }
}

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

/* Page Transition */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--magenta) 0%, var(--orange) 100%);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.page-transition.active {
  opacity: 1;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
}

.toast {
  background: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--magenta);
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: var(--teal); }

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon { font-size: 24px; }
.toast-message { flex: 1; }
.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background: var(--dark);
  transition: 0.3s;
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Sticky Header Enhancement */
header {
  transition: all 0.3s ease;
}

header.scrolled {
  padding: 8px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

header.scrolled .logo-icon {
  width: 40px;
  height: 40px;
}

header.scrolled .logo-text h1 {
  font-size: 16px;
}

.logo-icon {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

header.scrolled .logo-icon img {
  width: 100%;
  height: 100%;
}

.logo-text h1 {
  transition: all 0.3s ease;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--magenta) 0%, var(--orange) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 998;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Enhanced WhatsApp Float Animation */
.whatsapp-float {
  animation: pulseWhatsApp 2s infinite;
}

@keyframes pulseWhatsApp {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.whatsapp-float:hover {
  animation: none;
}

/* Form Loading Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Smooth Body Fade In */
body {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    order: 3;
  }

  header .container {
    flex-wrap: wrap;
  }

  .logo {
    order: 1;
  }

  .header-cta {
    order: 2;
    margin-left: auto;
  }

  nav {
    order: 4;
    width: 100%;
  }

  nav ul {
    display: none;
    flex-direction: column;
    gap: 0;
    background: var(--white);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 15px;
  }

  nav ul.active {
    display: flex;
  }

  nav li {
    border-bottom: 1px solid var(--light-gray);
  }

  nav li:last-child {
    border-bottom: none;
  }

  nav a {
    display: block;
    padding: 15px 20px;
  }

  .toast {
    min-width: 250px;
    font-size: 14px;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
    font-size: 20px;
    bottom: 90px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .toast-container {
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
  }
}
