/**
 * Auction Advertisements Styles
 *
 * @package AuctionSystem
 * @version 3.0.0
 * @description أنماط الإعلانات الموحدة والمحسنة
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
  --ad-border-color: var(--border-light);
  --ad-border-radius: var(--border-radius-sm);
  --ad-padding: 10px;
  --ad-background: var(--bg-lighter);
  --ad-content-background: var(--bg-primary);
  --ad-label-color: var(--text-muted);
  --ad-label-size: 12px;
  --ad-transition: all 0.3s ease;

  /* أبعاد الإعلانات */
  --banner-width: 730px;
  --banner-height: 90px;
  --sidebar-width: 400px;
  --sidebar-height: 627px;
}

/* ========================================
   BASE ADVERTISEMENT STYLES
   ======================================== */

/* الحاوي الخارجي مع الإطار */
.auction-ad-wrapper {
  border: 1px solid var(--ad-border-color);
  border-radius: var(--ad-border-radius);
  padding: var(--ad-padding);
  margin: 0;
  background: var(--ad-background);
  transition: var(--ad-transition);
}

.auction-ad-wrapper:empty {
  display: none !important;
}

/* كلمة "إعلان" */
.auction-ad-label {
  text-align: center;
  font-size: var(--ad-label-size);
  color: var(--ad-label-color);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  direction: inherit;
}

/* الحاوي الداخلي للإعلان */
.auction-ad-container {
  text-align: center;
  overflow: hidden;
  transition: var(--ad-transition);
  margin: 0;
  padding: 0;
  background: var(--ad-content-background);
  border-radius: var(--border-radius-sm);
}

.auction-ad-container:empty {
  display: none !important;
}

/* ========================================
   AD POSITIONS - أبعاد محددة ومبسطة
   ======================================== */

/* Banner Ads (Top, Middle, Bottom) - نفس الأبعاد */
.auction-ad-wrapper-top_banner,
.auction-ad-wrapper-content_middle,
.auction-ad-wrapper-bottom_banner {
  max-width: calc(var(--banner-width) + (var(--ad-padding) * 2));
  margin: 0 auto;
}

.auction-ad-top_banner,
.auction-ad-content_middle,
.auction-ad-bottom_banner {
  max-width: var(--banner-width);
  max-height: var(--banner-height);
  overflow: hidden;
}

/* Sidebar Ads (Top, Bottom) - نفس الأبعاد */
.auction-ad-wrapper-sidebar_top,
.auction-ad-wrapper-sidebar_bottom {
  max-width: calc(var(--sidebar-width) + (var(--ad-padding) * 2));
  margin: 0 auto;
}

.auction-ad-sidebar_top,
.auction-ad-sidebar_bottom {
  max-width: var(--sidebar-width);
  max-height: var(--sidebar-height);
  overflow: hidden;
}

/* ========================================
   AD CONTENT STYLES - مبسطة وموحدة
   ======================================== */

/* جميع أنواع المحتوى */
.auction-ad-container img,
.auction-google-ad,
.auction-html-ad,
.auction-image-ad {
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: var(--border-radius-sm);
  transition: var(--ad-transition);
}

/* تأثيرات التفاعل */
.auction-ad-container img:hover,
.auction-ad-container a:hover img {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  filter: brightness(1.05);
}

.auction-ad-container a {
  display: inline-block;
  text-decoration: none;
  transition: var(--ad-transition);
}

.auction-ad-container a:hover {
  opacity: 0.9;
}

/* تأثيرات خاصة للصور القابلة للنقر */
.auction-image-ad img {
  cursor: pointer;
}

/* ========================================
   RESPONSIVE DESIGN - مبسط ومتدرج
   ======================================== */

/* الأجهزة المتوسطة */
@media (max-width: 768px) {
  :root {
    --banner-height: 70px;
    --sidebar-height: 300px;
    --ad-padding: 8px;
  }

  .auction-ad-wrapper-top_banner,
  .auction-ad-wrapper-content_middle,
  .auction-ad-wrapper-bottom_banner,
  .auction-ad-wrapper-sidebar_top,
  .auction-ad-wrapper-sidebar_bottom {
    max-width: 100%;
    margin: 10px auto; /* إضافة مسافة بين الإعلانات */
    display: block; /* التأكد من العرض كـ block */
    clear: both; /* منع التداخل */
  }

  /* التأكد من أن الإعلانات تأخذ مكانها الصحيح */
  .auction-ad-wrapper {
    position: relative;
    z-index: 1;
    float: none !important;
    width: auto !important;
  }
}

/* الأجهزة الصغيرة */
@media (max-width: 480px) {
  :root {
    --banner-height: 50px;
    --sidebar-height: 200px;
    --ad-padding: 6px;
    --ad-border-radius: var(--border-radius-sm);
    --ad-label-size: 10px;
  }

  .auction-ad-label {
    margin-bottom: 6px;
  }

  .auction-ad-container {
    border-radius: var(--border-radius-sm);
  }

  .auction-ad-container img {
    border-radius: var(--border-radius-sm);
  }

  /* تحسينات إضافية للموبايل */
  .auction-ad-wrapper-top_banner,
  .auction-ad-wrapper-content_middle,
  .auction-ad-wrapper-bottom_banner,
  .auction-ad-wrapper-sidebar_top,
  .auction-ad-wrapper-sidebar_bottom {
    margin: 10px auto; /* مسافة أكبر بين الإعلانات */
    padding: var(--ad-padding);
    box-sizing: border-box;
  }

  /* منع التداخل في الموبايل */
  .auction-ad-wrapper {
    display: block !important;
    float: none !important;
    position: static !important;
    width: 100% !important;
    max-width: calc(100% - 20px) !important;
    margin-left: 10px !important;
    margin-right: 10px !important;
  }
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */

.auction-sidebar {
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-card {
  background: #fff;
  border-radius: var(--border-radius-sm);
  padding: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  color: #333;
  font-size: 18px;
}

.company-info-basic h4 {
  color: #2c3e50;
  margin: 0 0 15px 0;
}

.company-details p {
  margin: 8px 0;
  line-height: 1.5;
}

.company-details a {
  color: var(--accent);
  text-decoration: none;
}

.company-details a:hover {
  text-decoration: underline;
}

.sidebar-ad-container {
  margin: 0;
}

.sidebar-ad-container h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
  font-size: 18px;
  text-align: center;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .auction-ad-container {
    display: none !important;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.auction-ad-container img {
  outline: none;
}

.auction-ad-container a:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* ========================================
   ANIMATION EFFECTS
   ======================================== */

.auction-ad-container {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   SPECIAL EFFECTS FOR DIFFERENT AD TYPES
   ======================================== */

/* Hover effects for clickable ads */
.auction-ad-container a:hover img {
  filter: brightness(1.05);
}

/* Loading state */
.auction-ad-container.loading {
  opacity: 0.6;
  pointer-events: none;
}

.auction-ad-container.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}