/**
 * تحسينات احترافية متقدمة
 * Professional Enhancements & Advanced Styling
 */

/* ===== Enhanced Variables ===== */
:root {
  --blur-strength: 10px;
  --card-shadow: 0 4px 20px rgba(43, 64, 73, 0.08);
  --card-shadow-hover: 0 12px 40px rgba(43, 64, 73, 0.15);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== Smooth Scroll ===== */
html {
  scroll-behavior: smooth;
}

body {
  position: relative;
}

/* ===== Header Enhancements ===== */
.header {
  animation: slideInDown 0.6s ease-out;
  transition: all 0.3s var(--transition-smooth);
}

.header.scrolled {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
}

.header.scrolled .logo {
  font-size: 24px;
  transform: scale(0.95);
}

.logo {
  transition: all 0.3s var(--transition-smooth);
}

.logo:hover {
  transform: scale(1.02);
}

.logo h1 {
  position: relative;
  overflow: hidden;
}

.logo h1::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-gold);
  transition: width 0.4s var(--transition-smooth);
}

.logo:hover h1::after {
  width: 100%;
}

/* Icons with ripple effect */
.header-icons i {
  position: relative;
  overflow: hidden;
}

.header-icons i::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(96, 143, 144, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.header-icons i:hover::before {
  width: 200%;
  height: 200%;
}

/* ===== Enhanced Hero Slider ===== */
.hero-slider {
  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.2);
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.slide {
  will-change: opacity;
}

.slide.active .slide-content {
  animation: fadeInUp 1s ease-out 0.3s both;
}

.slide-title {
  animation: fadeInLeft 1s ease-out 0.5s both;
}

.slide-category {
  animation: scaleIn 0.5s var(--transition-bounce) 0.4s both;
  box-shadow: 0 4px 15px rgba(96, 143, 144, 0.4);
}

.slide-date {
  animation: fadeInRight 1s ease-out 0.6s both;
}

/* Ken Burns effect on slider images */
.slide.active img {
  animation: kenBurns 20s ease-out infinite alternate;
}

/* Slider navigation enhancement */
.slider-nav {
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  will-change: transform;
}

.slider-nav:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(43, 64, 73, 0.3);
}

.slider-nav:active {
  transform: translateY(-50%) scale(0.95);
}

/* Enhanced dots */
.dot {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s var(--transition-bounce);
}

.dot:hover {
  transform: scale(1.3);
}

.dot.active {
  width: 30px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.5);
}

/* ===== Enhanced News Cards ===== */
.news-card {
  position: relative;
  box-shadow: var(--card-shadow);
  will-change: transform;
  animation: fadeIn 0.6s ease-out both;
}

.news-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(96, 143, 144, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.4s var(--transition-smooth);
  border-radius: 12px;
  pointer-events: none;
  z-index: 1;
}

.news-card:hover::before {
  opacity: 1;
}

.news-card:hover {
  box-shadow: var(--card-shadow-hover);
}

.news-card-image {
  position: relative;
  overflow: hidden;
}

.news-card-image::after {
  content: '\f06e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 48px;
  color: white;
  opacity: 0;
  transition: all 0.4s var(--transition-bounce);
  z-index: 10;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.news-card:hover .news-card-image::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.news-card-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.4s var(--transition-smooth);
  z-index: 5;
}

.news-card:hover .news-card-image::before {
  opacity: 1;
}

/* Stagger animation for cards */
.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }

/* Category badge enhancement */
.news-category {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--transition-smooth);
}

.news-category::before {
  content: '';
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: right 0.6s var(--transition-smooth);
}

.news-card:hover .news-category::before {
  right: 100%;
}

/* ===== Enhanced Breaking News ===== */
.breaking-news {
  animation: slideInRight 0.8s ease-out 0.4s both;
  position: relative;
  overflow: hidden;
}

.breaking-news::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-gold);
  box-shadow: 0 0 20px var(--accent-gold);
  animation: glow 2s ease-in-out infinite;
}

.breaking-label {
  animation: pulse 2s ease-in-out infinite;
  position: relative;
}

.breaking-label::before {
  content: '\f0a1';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: 10px;
  animation: bounce 2s ease-in-out infinite;
}

.breaking-content {
  will-change: transform;
}

.breaking-content:hover {
  animation-play-state: paused;
}

.breaking-item {
  transition: all 0.3s var(--transition-smooth);
}

.breaking-item:hover {
  color: var(--secondary-color);
  transform: scale(1.05);
}

/* ===== Enhanced Section Headers ===== */
.section-header {
  animation: fadeIn 0.8s ease-out both;
}

.section-title {
  animation: fadeInRight 0.8s ease-out 0.2s both;
}

.section-title i {
  display: inline-block;
  animation: bounce 2s ease-in-out infinite;
  margin-left: 10px;
}

/* ===== Footer Enhancements ===== */
.footer {
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent, var(--background-dark));
  pointer-events: none;
}

.footer-section {
  animation: fadeInUp 0.8s ease-out both;
}

.footer-section:nth-child(1) { animation-delay: 0.1s; }
.footer-section:nth-child(2) { animation-delay: 0.2s; }
.footer-section:nth-child(3) { animation-delay: 0.3s; }
.footer-section:nth-child(4) { animation-delay: 0.4s; }

.footer-section h3 {
  position: relative;
}

.footer-section h3::before {
  content: '\f0c1';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: all 0.3s var(--transition-smooth);
}

.footer-section:hover h3::before {
  opacity: 1;
  right: -25px;
}

.social-icon {
  position: relative;
  overflow: hidden;
}

.social-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(96, 143, 144, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.social-icon:hover::before {
  width: 200%;
  height: 200%;
}

.social-icon i {
  position: relative;
  z-index: 1;
  transition: all 0.3s var(--transition-smooth);
}

.social-icon:hover i {
  transform: rotate(360deg) scale(1.1);
}

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.4s var(--transition-bounce);
  box-shadow: 0 8px 25px rgba(43, 64, 73, 0.3);
  z-index: 1000;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-gold);
  color: var(--background-dark);
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(96, 143, 144, 0.4);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* ===== Scroll Progress Bar ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gold);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
  box-shadow: 0 0 10px var(--accent-gold);
}

/* ===== Skip to Content ===== */
.skip-to-content {
  position: absolute;
  top: -100px;
  right: 0;
  background: var(--primary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  transition: all 0.3s var(--transition-smooth);
  z-index: 10000;
}

.skip-to-content:focus {
  top: 0;
}

/* ===== Loading Skeleton ===== */
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title {
  height: 2em;
  width: 60%;
  margin-bottom: 1em;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== Utility Classes ===== */
.text-shine {
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--accent-gold),
    var(--primary-color)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 3s linear infinite;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gradient-text {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== Responsive Enhancements ===== */
@media (max-width: 768px) {
  .hero-slider {
    height: 400px;
    margin-bottom: 20px;
  }
  
  .slide-title {
    font-size: 28px;
  }
  
  .slide-content {
    padding: 40px 25px;
  }
  
  .back-to-top {
    bottom: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

/* ===== Dark Mode Support (Future) ===== */
@media (prefers-color-scheme: dark) {
  .skeleton,
  .skeleton-text,
  .skeleton-image {
    background: linear-gradient(
      90deg,
      #2a2a2a 25%,
      #1a1a1a 50%,
      #2a2a2a 75%
    );
    background-size: 200% 100%;
  }
}

/* ===== Performance Optimizations ===== */
.news-card,
.slide,
.header {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Live Search Dropdown Styles */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-top: none;
    animation: fadeInUp 0.2s ease-out;
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    transition: background 0.2s;
    gap: 15px;
}

.search-result-item:hover {
    background: var(--background-light);
}

.result-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    font-family: 'Tajawal', sans-serif;
}

.result-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.search-loading, .search-no-results, .search-error {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-family: 'Tajawal', sans-serif;
}

.view-all-results {
    display: block;
    padding: 12px;
    text-align: center;
    background: var(--background-light);
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.view-all-results:hover {
    background: #eee;
}
