/**
 * =========================================================================
 * PLATTEN - STYLESHEET FÜR PLATTEN-KONFIGURATOR (VERSION 1.1 - CLEAN)
 * =========================================================================
 * Dieses Stylesheet formatiert den Platten-Konfigurator.
 * Layout: Mobile-First / Single Column (Max 510px).
 * =========================================================================
 * PLATTEN - ملف تنسيق CSS لأداة تخصيص الألواح (نسخة نظيفة 1.1)
 * =========================================================================
 * نمط التخطيط: عمود واحد دائماً (مخصص ليظهر بشكل الموبايل بحد أقصى 510px).
 * =========================================================================
 */

/* ==========================================================================
   1. Haupt-Layout (الهيكل الرئيسي - تخطيط الموبايل الدائم)
   ========================================================================== */

.platten-configurator-wrapper {
  display: flex;
  flex-direction: column !important; /* ترتيب عمودي دائماً */
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  color: #333;
  font-size: 16px;

  /* إعدادات العرض (Mobile View on Desktop) */
  max-width: 510px;
  margin: 20px auto; /* توسيط في الصفحة */
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  gap: 20px;
}

/* توحيد عرض الأعمدة (إلغاء نظام العمودين القديم) */
.platten-config-form-column,
.platten-summary-column {
  width: 100%;
  min-width: 0;
  flex: none;
}

/* ==========================================================================
   2. Sticky Top Price Display (شريط السعر العلوي اللاصق)
   ========================================================================== */

#platten-top-price-display {
  position: -webkit-sticky;
  position: sticky;
  /* الموضع الافتراضي للشاشات الكبيرة */
  top: 190px;
  z-index: 90;

  background-color: #ffffff;
  border-radius: 8px;
  padding: 15px 25px;
  margin-bottom: 25px;
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.15); /* ظل خفيف */
  border: 1px solid #eee; /* إطار خفيف للجمالية */

  width: 100%;
  left: 0;
  box-sizing: border-box;
}

/* ==========================================================================
   3. Formularelemente (عناصر النموذج - الحقول والعناوين)
   ========================================================================== */

.platten-config-form-column fieldset {
  border: 1px solid #861e38;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 8px;
  background-color: #ffffff;
}

.platten-config-form-column legend {
  font-weight: 600;
  font-size: 1.25em;
  padding: 0 10px;
  color: #861e38; /* اللون الرئيسي */
  margin-bottom: 15px;
}

.platten-config-form-column .form-row {
  margin-bottom: 18px;
}

.platten-config-form-column label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
  font-size: 1em;
}

/* تنسيق حقول الإدخال */
.platten-config-form-column input[type="number"],
.platten-config-form-column select,
.platten-config-form-column textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
  font-family: inherit;
  color: #333;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

/* إصلاح ارتفاع حقل الاختيار Select */
.platten-config-form-column select {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 46px;
  height: 48px;
}

.platten-config-form-column input[type="number"]:focus,
.platten-config-form-column select:focus,
.platten-config-form-column textarea:focus {
  border-color: #861e38;
  outline: none;
  box-shadow: 0 0 0 2px rgba(134, 30, 56, 0.2);
}

/* الفواصل */
.platten-config-form-column hr {
  border: none;
  height: 2px;
  background-color: #861e38;
  margin: 25px 0;
  opacity: 0.5;
}

/* رسائل الخطأ */
.platten-error-message,
.platten-validation-message {
  color: #d32f2f;
  font-size: 0.9em;
  margin-top: 5px;
  display: block;
}

.platten-config-form-column input.platten-input-error {
  border-color: #d32f2f;
  box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

.platten-hidden {
  display: none !important;
}

/* ==========================================================================
   4. Visuelle Selektoren (المحددات المرئية - المواد والأشكال)
   ========================================================================== */

.platten-visual-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
}

.platten-visual-selector .option {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease-in-out;
  background-color: #fff;
  min-width: 120px;
  position: relative;
  font-weight: 500;
  font-size: 0.95em;
}

.platten-visual-selector .option:hover {
  border-color: #aaa;
  background-color: #f9f9f9;
}

.platten-visual-selector .option.active {
  border-color: #861e38;
  background-color: #fdf5f7;
  box-shadow: 0 0 8px rgba(134, 30, 56, 0.2);
  font-weight: 700;
  color: #861e38;
}

/* علامة الصح للاختيار النشط */
.platten-visual-selector .option.active::after {
  content: "✔";
  position: absolute;
  top: 5px;
  right: 8px;
  color: #861e38;
  font-size: 16px;
}

/* أحجام قياسية (Standard Sizes) */
.platten-standard-size-selector .option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  min-width: 140px;
  flex-grow: 1;
}

.platten-standard-size-selector .option svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #555;
  stroke-width: 2px;
  flex-shrink: 0;
}

.platten-standard-size-selector .option.active svg {
  stroke: #861e38;
}

/* Presets */
.platten-preset-selector .option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  min-width: 120px;
  flex-grow: 1;
}

/* خيار مميز (Featured Option - Checkbox Style) */
.platten-featured-option label {
  font-size: 1.2em !important;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center !important;
  width: 100%;
}

.platten-featured-option label::before {
  content: "✨";
  margin-right: 12px;
  font-size: 1.4em;
}

.platten-featured-option input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  margin: 0;
  margin-right: 10px;
}

/* ==========================================================================
   5. Datei-Upload Liste (قائمة الملفات المرفوعة)
   ========================================================================== */

.platten-file-list-container {
  margin-top: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 5px;
  background-color: #ffffff;
}

.platten-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
}

.platten-file-item:last-child {
  border-bottom: none;
}

.platten-file-name {
  font-size: 0.9em;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.platten-file-delete-btn {
  background-color: #6c182d;
  color: #ffffff;
  border: none;
  border-radius: 3px;
  width: auto; /* Erlaubt dem Button, so breit wie der Text zu werden */
  height: auto; /* Automatische Höhe */
  cursor: pointer;
  transition: all 0.2s;
  padding: 5px 15px; /* Angenehmer Innenabstand */
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap; /* Verhindert Zeilenumbrüche */
}

.platten-file-delete-btn:hover {
  background-color: #333;
  transform: scale(1.05);
}

/* ==========================================================================
   6. Zusammenfassung & Preise (صندوق الملخص والأسعار)
   ========================================================================== */

.summary-box {
  background-color: #fff;
  border: 1px solid #861e38;
  padding: 25px;
  border-radius: 8px;
  overflow: hidden;

  /* إعدادات العرض للتوافق مع التخطيط الجديد */
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  flex: none !important;
  margin: 0 !important;
}

.summary-box h2 {
  margin-top: 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
  margin-bottom: 15px;
  font-size: 1.5em;
  font-weight: 600;
  text-align: left;
}

#summary-items .summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dotted #eee;
  font-size: 1em;
}

#summary-items .summary-item:last-child {
  border-bottom: none;
}

#summary-items .summary-label {
  color: #666;
  margin-right: 15px;
}

#summary-items .summary-value {
  color: #000;
  font-weight: 500;
  text-align: right;
}

#summary-items .summary-value .price-add-on {
  color: #008000;
  font-size: 0.9em;
  margin-left: 5px;
}

.platten-summary-green {
  color: #27ae60 !important;
  font-weight: 700 !important;
}

/* منطقة عرض السعر النهائي */
.price-display-area {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: right;
}

.price-main-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.price-label {
  font-weight: 600;
  font-size: 1.2em;
  color: #333;
}

.net-total-price {
  font-size: 2.2em;
  font-weight: 800;
  color: #861e38;
}

/* تفاصيل الضرائب */
.price-sub-line.tax-details-line {
  margin-top: 5px;
  margin-bottom: 3px;
  text-align: right;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 5px;
}

.price-sub-line.tax-details-line .price-text {
  font-family: monospace, sans-serif;
  color: #333;
}

.vat-shipping-text,
#summary-price-total-net {
  color: #861e38 !important;
  font-weight: 600;
  font-size: 0.85em;
  margin-top: 8px;
  display: block;
}

.delivery-time {
  margin-top: 15px;
  font-size: 0.9em;
  text-align: right;
  color: #333;
  font-weight: 500;
}

/* زر الإضافة للسلة */
.add-to-cart-area {
  margin-top: 20px;
}

.platten-add-to-cart-button {
  background-color: #861e38 !important;
  color: #ffffff !important;
  padding: 15px 25px;
  border-radius: 5px;
  font-size: 1.3em;
  font-weight: bold;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    transform 0.2s ease;
  width: 100%;
  text-align: center;
  border: none;
}

.platten-add-to-cart-button:hover {
  background-color: #6c182d !important;
  transform: translateY(-2px);
}

#quote-mode-hinweis {
  margin-top: 15px;
  padding: 15px;
  background-color: #861e38;
  color: #ffffff;
  border: 2px solid #6c182d;
  border-radius: 5px;
  font-size: 0.95em;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

#quote-mode-hinweis p {
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   7. Media Queries & Mobile Fixes (تعديلات الشاشات الصغيرة)
   ========================================================================== */

@media (max-width: 992px) {
  #platten-top-price-display {
    /* في شاشات الهاتف، اجعل الشريط يلتصق في الأعلى تمامًا مع تقليل المسافة */
    top: 80px;
  }
}

@media (max-width: 600px) {
  /* تعديل أحجام النصوص للسعر في الموبايل */
  #platten-top-price-display .net-total-price,
  .summary-box .net-total-price {
    font-size: 1.9em !important; /* كما طلبت */
    font-weight: 700 !important;
    line-height: 1.2;
  }

  #platten-top-price-display .price-label,
  .summary-box .price-label {
    font-size: 1em !important;
    font-weight: 600 !important;
  }

  /* تقليل الحواشي الداخلية لتوفير المساحة */
  #platten-top-price-display,
  .summary-box {
    padding: 10px 15px !important;
  }

  .price-main-line {
    align-items: center !important;
    margin-bottom: 2px !important;
  }
}

/* ==========================================================================
   8. Tippy.js & Popovers
   ========================================================================== */

.tippy-box[data-theme~="custom-white"] {
  background-color: #333;
  color: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-family: inherit;
  text-align: left;
  max-width: 350px !important;
}

.tippy-box[data-theme~="custom-white"] .tippy-arrow {
  color: #333;
}

.tippy-box[data-theme~="custom-white"] a {
  color: #861e38;
  font-weight: bold;
  text-decoration: underline;
}

.tippy-box[data-theme~="custom-white"] a:hover {
  color: #6c182d;
}

.tippy-box[data-theme~="custom-white"] p {
  margin-top: 0;
  margin-bottom: 10px;
}

.tippy-box[data-theme~="custom-white"] strong {
  color: #fff;
}

/* ==========================================================================
   WooCommerce Standard-Elemente ausblenden (مُحدث لاستثناء المنتجات ذات الصلة)
   ========================================================================== */

/* إخفاء عناصر المنتج الرئيسي فقط باستخدام .entry-summary */
.woocommerce div.product .entry-summary button.single_add_to_cart_button,
.woocommerce div.product .entry-summary .quantity,
.woocommerce div.product .entry-summary p.price,
.woocommerce div.product .entry-summary span.price,
.woocommerce-breadcrumb,
.product_meta,
#ppcp-messages,
.ppcp-messages,
.product_title.entry-title {
  display: none !important;
}

/* احتياط إضافي: إخفاء نموذج السلة الرئيسي إذا لم يكن هو الكونفيجوريتور */
.woocommerce div.product .entry-summary form.cart:not(.configurator-cart) {
  display: none !important;
}

/* إجبار السعر وزر الإضافة على الظهور في قسم المنتجات ذات الصلة (Zubehör) */
.related.products .price,
.related.products .quantity,
.related.products .button,
.related.products .add_to_cart_button {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}