/* --- 
  New Design By Ahmed Badawy
  Theme: Futuristic HUD / Neon
--- */

/* ### خطوط وألوان أساسية ### */
:root {
  --glow-cyan: #00f0f0;
  --glow-magenta: #f000f0;
  --glow-green: #00f000;
  --glow-danger: #ff4d4d;
  --bg-dark: #0a0a1a; /* كحلي غامق جداً */
  --bg-module: rgba(16, 16, 36, 0.85); /* أزرق أغمق شفاف */
  --bg-module-heavy: rgba(16, 16, 36, 0.95);
  --border-color: rgba(0, 240, 240, 0.4);
  --text-light: #e0e0e0;
  --text-dark: #12121e;
  --font-hud: 'Teko', sans-serif;
}

body {
  font-family: 'Inter', sans-serif; /* خط عادي للكلام */
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding-bottom: 0; /* اجعلها صفر */


  /* --- صورة الخلفية --- */
  background-image: linear-gradient(rgba(10, 10, 26, 0.92), rgba(10, 10, 26, 0.98)), url('../background.webp');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ### الهيدر والفوتر الجديد ### */
.navbar, .page-footer {
  /* removed fixed height to allow flexibility, min-height handles structure */
  min-height: 60px; 
  height: auto !important; 
  font-family: var(--font-hud);
  font-size: 1.2rem;
  letter-spacing: 1px;
  background-color: var(--bg-module-heavy) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.navbar-brand {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--glow-cyan) !important;
  text-shadow: 0 0 5px var(--glow-cyan), 0 0 10px var(--glow-cyan);
}

.nav-link {
  color: var(--text-light) !important;
  transition: 0.3s;
}
.nav-link:hover {
  color: var(--glow-cyan) !important;
  text-shadow: 0 0 5px var(--glow-cyan);
}

.page-footer {
  border-top: 1px solid var(--border-color) !important;
}
.footer-text {
  color: var(--text-light);
}
.footer-text b {
  color: var(--glow-cyan);
}
.page-footer .link-body-emphasis {
    color: var(--glow-cyan) !important;
    transition: 0.3s;
    font-size: 1.5rem;
}
.page-footer .link-body-emphasis:hover {
    color: #fff !important;
    text-shadow: 0 0 5px var(--glow-cyan);
}
.page-footer .bi {
    fill: currentColor;
}


/* ### شاشة الكونكت (ملء الشاشة) ### */
#offlinebar.offline-container:not([style*="display: none"]) {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 70vh;
  padding: 2rem;
}
#offlinebar h1 {
  font-family: var(--font-hud);
  font-weight: 500;
  font-size: 2.5rem;
  color: #fff;
  text-shadow: 0 0 5px var(--glow-cyan);
}
/* إخفاء شاشة الأونلاين والداشبورد لو الأوفلاين شغالة */
#offlinebar:not([style*="display: none"]) ~ #onlinebar,
#offlinebar:not([style*="display: none"]) ~ #mainmenu {
  display: none !important;
}


/* ### الداشبورد (بعد الكونكت) ### */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  font-family: var(--font-hud);
  font-size: 1.3rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}
.device-info {
  color: var(--text-light);
}
.device-info strong {
  color: var(--glow-cyan);
  margin-left: 10px;
}
.device-status {
  display: flex;
  align-items: center;
}
#d-bat {
  font-weight: 700;
  color: var(--glow-green);
  text-shadow: 0 0 5px var(--glow-green);
}

/* ### تصميم الجريد للداشبورد ### */
.dashboard-grid {
  display: grid;
  /* إجبار عمودين في الشاشات الكبيرة وواحد في الصغيرة */
  grid-template-columns: 1fr; 
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr; /* هنا نجبره على تقسيم الصفحة لنصفين */
  }
}

/* ### تصميم الموديول (الكارت) ### */
.dash-module {
  background-color: var(--bg-module);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 240, 240, 0.1), 0 0 10px rgba(0, 240, 240, 0.1) inset;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  min-height: 250px;
}
.dash-module:hover {
  border-color: var(--glow-cyan);
  box-shadow: 0 0 25px rgba(0, 240, 240, 0.3), 0 0 15px rgba(0, 240, 240, 0.2) inset;
}

.dash-module .card-header {
  font-family: var(--font-hud);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--glow-cyan);
  background-color: rgba(0, 240, 240, 0.05);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

/* موديول الأنالوج (خليه يكبر شوية) */
.module-joysticks {
  grid-column: span 1;
  justify-self: stretch; /* تجعله يملأ نصف الصفحة الأيسر */
  width: 100%;
  max-width: 100%; /* اجعله مرناً ليملأ العمود */
  min-height: auto !important;
}

#stickCanvas {
  max-width: 100%;
  height: auto;
}

/* ### ستايل الأزرار الجديد ### */
.btn-glow-base {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
}
.btn-glow-base:disabled {
  filter: grayscale(80%);
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(120, 120, 120, 0.2) !important;
  color: #777 !important;
  border-color: #555 !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.btn-glow-base:not(:disabled):active {
  transform: scale(0.98);
  box-shadow: 0 0 5px var(--glow-cyan) inset !important;
}

/* زرار الكونكت */
.btn-glow-connect {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-cyan);
  border-color: var(--glow-cyan);
  text-shadow: 0 0 5px var(--glow-cyan);
  box-shadow: 0 0 10px var(--glow-cyan), 0 0 10px var(--glow-cyan) inset;
  font-size: 1.5rem;
  padding: 15px 30px;
}
.btn-glow-connect:hover {
  color: var(--bg-dark);
  background: var(--glow-cyan);
  box-shadow: 0 0 15px var(--glow-cyan), 0 0 30px var(--glow-cyan);
}

/* زرار الفصل */
.btn-glow-disconnect {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-danger);
  border-color: var(--glow-danger);
  text-shadow: 0 0 5px var(--glow-danger);
  padding: 5px 10px;
  font-size: 1rem;
  width: auto;
}
.btn-glow-disconnect:hover {
  color: var(--bg-dark);
  background: var(--glow-danger);
  box-shadow: 0 0 10px var(--glow-danger);
}

/* أزرار أساسية (تم التصحيح: رجعناها سماوي) */
.btn-glow-primary {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-cyan);
  border-color: var(--glow-cyan);
}
.btn-glow-primary:hover {
  color: var(--bg-dark);
  background: var(--glow-cyan);
  box-shadow: 0 0 10px var(--glow-cyan), 0 0 20px var(--glow-cyan);
}

/* أزرار ثانوية (Test / Info) */
.btn-glow-secondary {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-magenta);
  border-color: var(--glow-magenta);
}
.btn-glow-secondary:hover {
  color: var(--bg-dark);
  background: var(--glow-magenta);
  box-shadow: 0 0 10px var(--glow-magenta), 0 0 20px var(--glow-magenta);
}

/* أزرار الحفظ (Success) */
.btn-glow-success {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-green);
  border-color: var(--glow-green);
}
.btn-glow-success:hover {
  color: var(--bg-dark);
  background: var(--glow-green);
  box-shadow: 0 0 10px var(--glow-green), 0 0 20px var(--glow-green);
}

/* أزرار الخطر (تم التصحيح: رجعناها أحمر) */
.btn-glow-danger {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: var(--glow-danger);
  border-color: var(--glow-danger);
}
.btn-glow-danger:hover {
  color: var(--bg-dark);
  background: var(--glow-danger);
  box-shadow: 0 0 10px var(--glow-danger), 0 0 20px var(--glow-danger);
}

/* +++ إضافات جديدة للأزرار المخصصة (أحمر، أزرق، أبيض) +++ */

/* زرار الليد الأحمر */
.btn-glow-red {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: #ff0000;
  border-color: #ff0000;
  text-shadow: 0 0 5px #ff0000;
}
.btn-glow-red:hover {
  color: var(--bg-dark);
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
}

/* زرار الليد الأزرق */
.btn-glow-blue {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: #2979ff; 
  border-color: #2979ff;
  text-shadow: 0 0 5px #2979ff;
}
.btn-glow-blue:hover {
  color: var(--bg-dark);
  background: #2979ff;
  box-shadow: 0 0 10px #2979ff, 0 0 20px #2979ff;
}

/* زرار الإيقاف (أبيض) */
.btn-glow-white {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  
  color: #ffffff;
  border-color: #ffffff;
  text-shadow: 0 0 5px #ffffff;
}
.btn-glow-white:hover {
  color: var(--bg-dark);
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff;
}


/* ### تعديلات على الـ Modals ### */
.modal-content {
  border-width: 2px;
  box-shadow: 0 0 30px rgba(0, 240, 240, 0.5);
}
.modal-header {
  font-family: var(--font-hud);
  font-size: 1.5rem;
  color: var(--glow-cyan);
  border-bottom: 1px solid var(--border-color);
}
.modal-footer {
  border-top: 1px solid var(--border-color);
}
.modal-body {
  color: black;
}
.modal-body .list-group-item {
  border-color: rgba(0, 240, 240, 0.2);
}
.modal-body .list-group-item.active {
  background-color: var(--glow-cyan);
  color: var(--bg-dark) !important;
  border-color: var(--glow-cyan);
}
.modal-body .alert {
  background-color: rgba(0, 240, 240, 0.1);
  border-color: var(--border-color);
  color: var(--bs-white);
}

/* تعديل الـ Buttons اللي جوه الـ Modals */
.modal-footer .btn-primary {
  font-family: var(--font-hud);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 5px;
  border: 2px solid;
  background: transparent;
  transition: all 0.3s ease;
  width: auto;
  text-transform: uppercase;
  
  color: var(--glow-cyan);
  border-color: var(--glow-cyan);
}
.modal-footer .btn-primary:hover {
  color: var(--bg-dark);
  background: var(--glow-cyan);
  box-shadow: 0 0 10px var(--glow-cyan), 0 0 20px var(--glow-cyan);
}

.modal-footer .btn-outline-secondary {
    font-family: var(--font-hud);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 5px;
    border: 2px solid;
    background: transparent;
    transition: all 0.3s ease;
    width: auto;
    text-transform: uppercase;
    
    color: var(--glow-magenta);
    border-color: var(--glow-magenta);
}
.modal-footer .btn-outline-secondary:hover {
  color: var(--bg-dark);
  background: var(--glow-magenta);
  box-shadow: 0 0 10px var(--glow-magenta), 0 0 20px var(--glow-magenta);
}

.modal-footer .btn-secondary {
    font-family: var(--font-hud);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 5px;
    border: 2px solid;
    background: transparent;
    transition: all 0.3s ease;
    width: auto;
    text-transform: uppercase;
    
    color: #999;
    border-color: #555;
}
.modal-footer .btn-secondary:hover {
    color: #fff;
    background: #555;
}

/* ### تعديلات المتجاوبة (Responsive) ### */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr; /* عمود واحد فقط في الموبايل */
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .device-status {
    justify-content: space-between;
    margin-top: 10px;
  }
  .offline-container h1 {
    font-size: 1.8rem;
  }

  /* Font adjustments for mobile navbar */
  .navbar-brand {
    font-size: 1.4rem;
  }
  #lang-switcher .nav-link {
    font-size: 1rem;
  }
  
  /* FORCE VISIBILITY FOR CONTROLLER SVG ON MOBILE */
  .module-controller-svg {
    min-height: 250px !important; /* Force explicit height instead of auto */
  }
}

/* تعديلات متفرقة من الملف القديم */
dl.row dt {
  font-weight: normal;
  color: #aaa;
}
dl.row dd {
  font-family: monospace;
  color: #fff;
}
/* --- 
  Additions for Controller View & Rebuilt Modals
--- */

/* ### 5. Controller View Module ### */
.module-controller-svg {
  grid-column: span 1;
  padding: 1rem;
  display: flex; 
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%; /* مرونة العرض */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-module);
  min-height: 300px; /* This is overridden in media query now */
  justify-self: stretch;
}

#controller-svg-placeholder {
  width: 100%;
  max-width: 500px; /* تحكم في حجم الدراع نفسه من هنا */
  display: flex; 
  justify-content: center; 
  align-items: center; 
}

/* ### 3 & 4. Rebuilt Modal Styles ### */

/* خلفية المودال */
.modal-content {
  border-width: 2px !important;
  box-shadow: 0 0 30px rgba(0, 240, 240, 0.5) !important;
}

/* ستايل شاشة المعايرة (Wizard) */
.calib-wizard-header {
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.calib-step-counter {
  font-family: var(--font-hud);
  font-size: 1.2rem;
  color: #000;
}

.calib-wizard-content {
  text-align: center;
  padding: 1rem 0;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.calib-wizard-content h4 {
  font-family: var(--font-hud);
  font-size: 1.8rem;
  color: var(--glow-cyan);
  margin-bottom: 1rem;
  text-shadow: 0 0 5px var(--glow-cyan);
}

.calib-wizard-content p {
  font-size: 1.1rem;
  color: var(--bg-dark);
  max-width: 90%;
}

/* 4. ستايل الأنيميشن بتاع الأنالوج (Range Calib) */
.range-animation {
  width: 100px;
  height: 100px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin: 1.5rem auto;
  position: relative;
}
.range-stick {
  width: 30px;
  height: 30px;
  background-color: var(--glow-cyan);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--glow-cyan), 0 0 15px var(--glow-cyan);
  animation: rotate-stick 4s ease-in-out infinite;
}

/* أنيميشن دوران الأنالوج */
@keyframes rotate-stick {
  0% { transform: translate(calc(-50% + 0px), calc(-50% + 0px)); }
  10% { transform: translate(calc(-50% + 0px), calc(-50% - 35px)); } /* Top */
  20% { transform: translate(calc(-50% + 35px), calc(-50% - 35px)); } /* Top-Right */
  30% { transform: translate(calc(-50% + 35px), calc(-50% + 0px)); } /* Right */
  40% { transform: translate(calc(-50% + 35px), calc(-50% + 35px)); } /* Bottom-Right */
  50% { transform: translate(calc(-50% + 0px), calc(-50% + 35px)); } /* Bottom */
  60% { transform: translate(calc(-50% - 35px), calc(-50% + 35px)); } /* Bottom-Left */
  70% { transform: translate(calc(-50% - 35px), calc(-50% + 0px)); } /* Left */
  80% { transform: translate(calc(-50% - 35px), calc(-50% - 35px)); } /* Top-Left */
  90% { transform: translate(calc(-50% + 0px), calc(-50% - 35px)); } /* Top */
  100% { transform: translate(calc(-50% + 0px), calc(-50% + 0px)); } /* Center */
}

/* ### Button Test Module Styles ### */
#digital-buttons-container {
  text-align: center;
}
.btn-indicator {
  font-family: var(--font-hud);
  font-size: 1.2rem; /* كبر الفونت شوية للأيقونة */
  padding: 8px 10px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  background-color: rgba(16, 16, 36, 0.8);
  color: var(--text-light);
  transition: all 0.1s ease;
  opacity: 0.6;
  width: 50px; /* عرض ثابت */
  height: 45px; /* طول ثابت */
  display: inline-flex; /* عشان الأيقونة تتوسط */
  justify-content: center;
  align-items: center;
  line-height: 1;
}
/* تنسيق البار العمودي بنفس ستايل القديم */
.vertical-progress-container {
    height: 150px; /* طول البار */
    width: 25px;   /* عرض البار (نفس سمك القديم تقريباً) */
    background-color: #e9ecef; /* لون الخلفية الرمادي بتاع البوتستراب */
    border-radius: 0.375rem;
    display: flex;
    align-items: flex-end; /* عشان يبدأ ملو من تحت */
    overflow: hidden; /* عشان الحواف المدورة */
    margin: 0 auto; /* توسيط */
}

/* في الوضع الليلي نغمق الخلفية شوية */
body[data-bs-theme="dark"] .vertical-progress-container,
body.ds-i18n-ar .vertical-progress-container { 
    background-color: #2b3035; 
}

.vertical-progress-bar {
    width: 100%;
    background-color: var(--glow-cyan); /* نفس لونك المميز */
    transition: height 0.1s ease; /* نعومة الحركة */
}

.trigger-value-text {
    font-family: monospace;
    font-size: 1.1rem;
    color: white;
    margin-top: 5px;
}
.btn-indicator.pressed {
  background-color: var(--glow-cyan);
  color: var(--bg-dark);
  border-color: var(--glow-cyan);
  box-shadow: 0 0 10px var(--glow-cyan);
  opacity: 1;
  transform: scale(1.05);
}
#l2-progress, #r2-progress {
  background-color: var(--glow-magenta);
  transition: width 0.05s linear; /* حركة ناعمة للـ Triggers */
}
/* ### SVG Button Glow Effect ### */
#controller-svg-placeholder .pressed-glow {
  /* فلتر التوهج بلون السيان */
  filter: 
    drop-shadow(0 0 3px var(--glow-cyan)) 
    drop-shadow(0 0 6px var(--glow-cyan)) 
    brightness(1.5); /* زيادة السطوع */

  /* لون السيان لو الفلتر مش شغال */
  fill: var(--glow-cyan) !important; 
  stroke: var(--glow-cyan) !important;
}

/* أنيميشن ناعم للـ SVG */
#controller-svg-placeholder path,
#controller-svg-placeholder rect,
#controller-svg-placeholder circle,
#controller-svg-placeholder ellipse {
  transition: fill 0.1s ease, stroke 0.1s ease, filter 0.1s ease !important;
}
/* ### Header Board Model Style ### */
#d-board {
  font-family: var(--font-hud);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--bs-white);
  opacity: 0.7;
  margin-left: 1.5rem; /* مسافة من اسم الدراع */
}
#d-board::before {
  content: '|'; /* فاصل أنيق */
  margin-right: 1.5rem;
  opacity: 0.3;
}

/* ### Touchpad Visualizer ### */
.touchpad-area {
  width: 100%;
  max-width: 400px;
  height: 250px;
  background-color: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 240, 240, 0.1) inset;
}
/* لف السهم عند الفتح */
.accordion-button:not(.collapsed) .fa-chevron-down {
  transform: rotate(180deg);
}
/* إخفاء سهم البوتستراب الافتراضي عشان حطينا واحد احلى */
.accordion-button::after {
  display: none !important;
}
.touch-point {
  width: 20px;
  height: 20px;
  background-color: var(--glow-cyan);
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--glow-cyan), 0 0 20px var(--glow-cyan);
  pointer-events: none;
  transition: left 0.05s linear, top 0.05s linear;
}

.touch-point::after {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 1px solid var(--glow-cyan);
  border-radius: 50%;
  opacity: 0.5;
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.33); }
  80%, 100% { opacity: 0; }
}

/* استبدال الستايلات الداخلية (Inline Styles) الخاصة بالمودال */

.analysis-stat-card {
  border: 1px solid;
  transition: all 0.3s ease;
}
.analysis-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* كارت معدل التحديث (Polling Rate) */
.stat-polling {
  background-color: rgba(0, 240, 240, 0.05); 
  border-color: var(--border-color) !important;
}
.stat-polling h2 {
  color: var(--glow-cyan);
}

/* كارت التأخير (Latency) */
.stat-latency {
  background-color: rgba(240, 0, 240, 0.05); 
  border-color: rgba(240, 0, 240, 0.4) !important;
}
.stat-latency h2 {
  color: var(--glow-magenta);
}

/* كارت التذبذب (Jitter) */
.stat-jitter {
  background-color: rgba(255, 77, 77, 0.05); 
  border-color: rgba(255, 77, 77, 0.4) !important;
}
.stat-jitter h2 {
  color: var(--glow-danger);
}

/* الرسم البياني (Canvas Container) */
.analysis-graph-container {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
}
.analysis-graph-header {
  background-color: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-hud);
  color: var(--text-light);
}
/* ### Cookie Consent Banner ### */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--bg-module-heavy);
  border-top: 1px solid var(--border-color);
  padding: 1rem 0;
  z-index: 2000;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
  font-family: var(--font-hud);
}

/* ### Connection Overlay ### */
.connection-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.disconnected-svg {
  filter: grayscale(100%);
  opacity: 0.5;
  position: relative;
}

#onlinebar {
  position: relative;
  min-height: 200px;
}

#mainmenu {
  position: relative;
}

/* Ensure about section is always visible and below */
#about-section {
  display: block !important;
  margin-bottom: 0px;
  color: #fff !important;
}

#aboutCollapse .accordion-body {
  color: #fff !important;
}

#aboutCollapse ul li {
  color: #fff !important;
}

#aboutCollapse p {
  color: #fff !important;
}

/* Styles for fine-tuning interface */

/* Styling for coordinate labels - base state to prevent layout shift */
#finetuneStickCanvasLx-lbl,
#finetuneStickCanvasLy-lbl,
#finetuneStickCanvasRx-lbl,
#finetuneStickCanvasRy-lbl {
  padding: 2px 4px !important;
  border-radius: 3px !important;
  background-color: transparent !important;
}

/* Styling for finetune input boxes - base state to prevent layout shift */
input[id^="finetune"] {
  border: 1px solid transparent !important;
  width: 90px !important;
  min-width: 90px !important;
  color: #969696 !important;
}

/* Styling for highlighted coordinate labels */
#finetuneStickCanvasLx-lbl.text-primary,
#finetuneStickCanvasLy-lbl.text-primary,
#finetuneStickCanvasRx-lbl.text-primary,
#finetuneStickCanvasRy-lbl.text-primary {
  color: #0d6efd !important;
  background-color: rgba(13, 110, 253, 0.1) !important;
}

/* CSS Grid layout for finetune inputs around canvas */
.finetune-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
  ". top ."
  "left center right"
  ". bottom .";
  justify-items: center;
  align-items: center;
  width: 100%;
  margin: 0 auto;
  max-width: fit-content;
}

.finetune-top {
  grid-area: top;
}

.finetune-left {
  grid-area: left;
}

.finetune-center {
  grid-area: center;
}

.finetune-right {
  grid-area: right;
}

.finetune-bottom {
  grid-area: bottom;
}

/* Finetune mode visibility controls */
.finetune-center-mode {
  display: block;
}

.finetune-circularity-mode {
  display: none;
}

/* When circularity mode is active */
#finetuneModal.circularity-mode .finetune-center-mode {
  display: none;
}

#finetuneModal.circularity-mode .finetune-circularity-mode {
  display: block;
}

/* Hide raw numbers mode - hide input boxes when checkbox is unchecked */
#finetuneModal.hide-raw-numbers .finetune-top,
#finetuneModal.hide-raw-numbers .finetune-left,
#finetuneModal.hide-raw-numbers .finetune-right,
#finetuneModal.hide-raw-numbers .finetune-bottom {
  display: none;
}

/* Hide spacers when raw numbers are hidden */
#finetuneModal.hide-raw-numbers .spacer.hide-raw-numbers {
  display: none;
}

/* Adjust grid layout when raw numbers are hidden - center the canvas */
#finetuneModal.hide-raw-numbers .finetune-grid {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "center";
}

/* when element with id finetuneModal has class hide-raw-numbers, hide all elements with id finetuneStickCanvasL and finetuneStickCanvasR */
#finetuneModal.hide-raw-numbers #finetuneStickCanvasL,
#finetuneModal.hide-raw-numbers #finetuneStickCanvasR {
  display: none;
}
#finetuneModal:not(.hide-raw-numbers) #finetuneStickCanvasL,
#finetuneModal:not(.hide-raw-numbers) #finetuneStickCanvasR {
  display: block;
}
#finetuneModal.hide-raw-numbers #finetuneStickCanvasL_large,
#finetuneModal.hide-raw-numbers #finetuneStickCanvasR_large
{
  display: block;
}
#finetuneModal:not(.hide-raw-numbers) #finetuneStickCanvasL_large,
#finetuneModal:not(.hide-raw-numbers) #finetuneStickCanvasR_large {
  display: none;
}

/* Error slack button toggle states */
.left-stick-values,
.right-stick-values {
  display: block;
}

.left-stick-slider,
.right-stick-slider {
  display: none;
}

/* When left stick is in slider mode (only in circularity mode) */
#finetuneModal.circularity-mode #left-stick-card.show-slider .left-stick-values {
  display: none !important;
}

#finetuneModal.circularity-mode #left-stick-card.show-slider .left-stick-slider.finetune-circularity-mode {
  display: block !important;
}

/* When right stick is in slider mode (only in circularity mode) */
#finetuneModal.circularity-mode #right-stick-card.show-slider .right-stick-values {
  display: none !important;
}

#finetuneModal.circularity-mode #right-stick-card.show-slider .right-stick-slider.finetune-circularity-mode {
  display: block !important;
}

/* ستايل زراير الهيدر الجديدة */
.btn-neon-header {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* عرض ثابت عشان يبقوا مربعات مظبوطة */
    height: 38px;
    margin-right: 8px;
    border-radius: 8px; /* حواف ناعمة */
}

/* زرار الحفظ - أخضر */
.btn-neon-save:hover {
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    text-shadow: 0 0 5px #00ff00;
}

/* زرار الريستارت - برتقالي محمر */
.btn-neon-reboot:hover {
    border-color: #ff4444;
    color: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    text-shadow: 0 0 5px #ff4444;
}

/* تعديل بسيط لزرار Disconnect عشان يبقى نفس الارتفاع */
.btn-glow-disconnect {
    height: 38px;
    display: inline-flex;
    align-items: center;
}
/* كلاس جديد لتثبيت الترتيب من اليسار لليمين دائماً */
.fixed-ltr-row {
  direction: ltr !important;
}

/* عشان نضمن إن الكلام جوه الكروت يفضل واخد اتجاه اللغة (عربي أو إنجليزي) */
/* الكود ده بيرجع اتجاه النصوص لطبيعته حسب لغة الموقع */
body[dir="rtl"] .fixed-ltr-row .dash-module {
  direction: rtl; 
}
/* --- Mobile Menu Fixes --- */
/* جعل زر القائمة أبيض بدلاً من الأسود */
.navbar-toggler {
    color: var(--text-light) !important;
    border-color: var(--border-color) !important;
}

/* إضافة تأثير التوهج عند الضغط عليه */
.navbar-toggler:focus {
    box-shadow: 0 0 5px var(--glow-cyan);
    outline: none;
}
/* --- Desktop Layout: Clean Fix --- */
@media (min-width: 992px) { 
  /* ضمان أن الكروت تملأ ارتفاع الصف بالكامل */
  .dash-module {
    height: 100% !important;
  }
  
  /* تضبيط المسافات للإعلان */
  #mid-section-ad {
    margin: 15px 0;
  }

  /* تأكيد إلغاء أي هوامش زيادة للصفوف */
  .row {
      margin-left: 0;
      margin-right: 0;
  }
}
/* --- Fix Bottom Spacing (Force) --- */

/* 1. إزالة أي مسافة سفلية من القائمة الرئيسية ومحتوياتها */
#mainmenu, 
#mainTabsContent, 
#controller-content {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* 2. استهداف الصف الأخير (صف الكاليبريشن والتاتش) وإلغاء المسافة تحته */
#controller-content > .row:last-child {
    margin-bottom: 10px !important; /* مسافة صغيرة جداً 10 بيكسل */
}

/* 3. التحكم في مربع الإعلان السفلي مباشرة */
#bottom-ad-container {
    margin-top: 0 !important; /* إلغاء المسافة العلوية تماماً */
    padding-top: 0 !important;
}
/* === HUD Modal Styling === */
.hud-modal {
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 40px rgba(0, 240, 240, 0.15);
    border-radius: 15px;
    overflow: hidden;
}

.modal-glow-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% -20%, rgba(0, 240, 240, 0.1), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.hud-title {
    font-family: 'Teko', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--glow-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 240, 0.5);
}

/* Stepper */
.calib-stepper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    margin-top: 10px;
}

.calib-stepper .step {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
    font-family: 'Teko', sans-serif;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.calib-stepper .step.active {
    background: var(--glow-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--glow-cyan);
    border-color: var(--glow-cyan);
    transform: scale(1.1);
}

.calib-stepper .line {
    width: 30px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 5px;
}

/* Stick Visualizer Animation */
.stick-visual {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
}

.stick-knob {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, var(--glow-cyan) 0%, #008888 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px var(--glow-cyan);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Animation Classes for Stick */
.move-top-left { transform: translate(-120%, -120%); }
.move-top-right { transform: translate(20%, -120%); }
.move-bottom-left { transform: translate(-120%, 20%); }
.move-bottom-right { transform: translate(20%, 20%); }

/* Alerts */
.alert-dark-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 204, 0, 0.3);
    color: #ccc;
    border-radius: 8px;
}

/* Buttons */
.hud-btn-primary {
    background: linear-gradient(45deg, transparent 5%, var(--glow-cyan) 5%);
    color: #000;
    border: 0;
    font-family: 'Teko', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
    padding: 8px 30px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.3s;
}

.hud-btn-primary:hover {
    background: var(--glow-cyan);
    box-shadow: 0 0 20px var(--glow-cyan);
    transform: translateY(-2px);
    color: #000;
}

.hud-btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Teko', sans-serif;
    font-size: 1.1rem;
    margin-right: 15px;
}

.text-cyan { color: var(--glow-cyan); }
.text-magenta { color: var(--glow-magenta); 
}
/* === زرار الدعم الذهبي === */
:root {
  --glow-gold: #ffcc00;
}

.btn-glow-gold {
  font-family: var(--font-hud);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 5px 20px;
  border-radius: 50px;
  border: 2px solid var(--glow-gold);
  background: transparent;
  transition: all 0.3s ease;
  color: var(--glow-gold);
  text-shadow: 0 0 5px var(--glow-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-glow-gold:hover {
  background: var(--glow-gold);
  color: #000;
  box-shadow: 0 0 15px var(--glow-gold);
  transform: translateY(-2px);
}

/* تعديل بسيط لزراير النسخ في المودال */
.input-group .btn-outline-light:hover {
    background-color: var(--glow-cyan);
    color: black;
    border-color: var(--glow-cyan);
}
/* =========================================
   Cyberpunk Info Modal Override
   (تحديث شكل قائمة المعلومات لتشبه باقي الموديلات)
========================================= */

/* 1. تحويل جسم النافذة للستايل الزجاجي المضيء */
#controllerInfoModal .modal-content {
    background: rgba(10, 10, 26, 0.95); /* خلفية كحلي غامق شفاف */
    backdrop-filter: blur(15px);         /* تأثير الزجاج الضبابي */
    border: 1px solid var(--glow-cyan);  /* حدود سماوي نيون */
    box-shadow: 0 0 40px rgba(0, 240, 240, 0.2); /* توهج حول النافذة */
    border-radius: 15px;
}

/* 2. تنسيق العنوان (الهيدر) */
#controllerInfoModal .modal-header {
    border-bottom: 1px solid rgba(0, 240, 240, 0.3);
}

#controllerInfoModal .modal-title {
    font-family: var(--font-hud); /* استخدام خط Teko المميز */
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 2px;
    color: var(--glow-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 240, 0.6); /* ظل للنص */
    text-transform: uppercase;
}

/* 3. زر الإغلاق (X) */
#controllerInfoModal .btn-close {
    filter: invert(1) drop-shadow(0 0 2px var(--glow-cyan)); /* جعل الزر أبيض ومضيء */
}

/* 4. تنسيق عناصر القائمة (البيانات) لتشبه شاشات الهاكرز */
#modal-info-list .list-group-item {
    background: linear-gradient(90deg, rgba(0, 240, 240, 0.05) 0%, transparent 100%); /* تدرج خفيف */
    border: none !important; /* إلغاء الحدود العادية */
    border-left: 3px solid var(--glow-cyan) !important; /* وضع خط نيون ع الشمال */
    margin-bottom: 6px; /* مسافة بين كل سطر */
    transition: all 0.3s ease;
    color: #fff; /* لون النص */
}

/* حركة بسيطة عند مرور الماوس على البيانات */
#modal-info-list .list-group-item:hover {
    background: linear-gradient(90deg, rgba(0, 240, 240, 0.15) 0%, transparent 100%);
    padding-left: 25px !important; /* السطر يتحرك لليمين قليلاً */
    box-shadow: -5px 0 10px rgba(0, 240, 240, 0.1);
}

/* 5. تنسيق زر Close السفلي */
#controllerInfoModal .modal-footer {
    border-top: 1px solid rgba(0, 240, 240, 0.3);
}

#controllerInfoModal .modal-footer .btn-secondary {
    background: transparent;
    border: 1px solid var(--glow-cyan);
    color: var(--glow-cyan);
    font-family: var(--font-hud);
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

#controllerInfoModal .modal-footer .btn-secondary:hover {
    background: var(--glow-cyan);
    color: #000; /* الكتابة تسود عند التحويم */
    box-shadow: 0 0 20px var(--glow-cyan); /* توهج قوي */
}

/* تعديل ألوان النصوص داخل القائمة */
#modal-info-list span.text-secondary {
    color: rgba(255, 255, 255, 0.6) !important; /* جعل عناوين البيانات (Key) رمادي فاتح */
}

#modal-info-list span {
    font-family: 'Consolas', monospace; /* خط رقمي للبيانات */
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}
/* === إصلاح تنسيق النصوص العربية === */

body.ds-i18n-ar .accordion-body,
body.ds-i18n-ar p,
body.ds-i18n-ar .lead,
body.ds-i18n-ar li,
body.ds-i18n-ar .footer-text {
    /* 1. إجبار المحاذاة لليمين */
    text-align: right !important;
    
    /* 2. تأكيد اتجاه النص من اليمين لليسار */
    direction: rtl !important;
    
    /* 3. زيادة المسافة بين السطور (مهم جداً عشان الكلام ميبقاش لازق في بعضه) */
    line-height: 1.8 !important; 
    
    /* 4. تكبير حجم الخط العربي سنة بسيطة عشان يبقى مقروء */
    font-size: 1.1rem;
}

/* إصلاح مشكلة الأيقونات اللي بتلزق في الكلام في العربي */
body.ds-i18n-ar .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

body.ds-i18n-ar .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

/* تحسين شكل القوائم (النقط) في العربي */
body.ds-i18n-ar ul li {
    margin-bottom: 8px; /* مسافة بين كل نقطة والتانية */
    display: flex;      /* عشان الأيقونة والكلام يبقوا على سطر واحد مظبوط */
    align-items: center;
}
/* --- Floating Action Buttons --- */
.fab-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: flex;
    flex-direction: column-reverse;
    gap: 15px;
    z-index: 9999; /* فوق كل حاجة */
}

.fab-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
}

.fab-btn:hover {
    transform: scale(1.1);
    color: white;
}

/* WhatsApp Style */
.fab-whatsapp {
    background: #25D366;
    border: 2px solid #128C7E;
}
.fab-whatsapp:hover {
    box-shadow: 0 0 20px #25D366;
}

/* Notification Bell Style */
.fab-notify {
    background: #333;
    border: 2px solid var(--glow-cyan);
    color: var(--glow-cyan);
    position: relative;
}

/* النقطة الحمراء */
.notification-dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 10px;
    height: 10px;
    background-color: #ff3b30;
    border-radius: 50%;
    border: 2px solid #333;
    display: none; /* مخفية افتراضياً */
}

/* تأثير النبض (Glow Animation) */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(0, 240, 240, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(0, 240, 240, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 240, 240, 0); }
}

.fab-notify.has-updates {
    animation: pulse-glow 2s infinite;
}
.fab-notify.has-updates .notification-dot {
    display: block;
}