/* Developed by Louai | Connect 2026 */

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background-color: #e3e3e3;
  margin: 0;
  padding: 10px;
  direction: rtl; /* اتجاه الصفحة العام عربي */
  display: flex;
  flex-direction: column;
  align-items: center; /* يضمن توسيط جميع العناصر في الصفحة */
}

h2 { text-align: center; color: #1c1c1e; margin: 10px 0; width: 100%; }

#reader-container {
  position: relative;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid #007bff;
  background: #000;
}

#reader video {
  width: 100% !important;
  transition: transform 0.2s ease-out;
}

.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 100px;
  border: 2px solid #ffffff;
  border-radius: 12px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
  z-index: 5;
  pointer-events: none;
}

#zoom-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  z-index: 25;
}

.zoom-controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
}

.zoom-controls button {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 10px 15px;
  border-radius: 10px;
  font-weight: bold;
}

select, .btn-main {
  width: 100%;
  max-width: 450px; /* لضمان عدم تمدد العناصر بشكل مبالغ فيه على الآيباد */
  padding: 16px;
  margin: 8px auto;
  border-radius: 12px;
  font-size: 17px;
  display: block;
}

.btn-main { background-color: #007bff; color: white; border: none; font-weight: 600; }
.btn-download { background-color: #34c759; }

.table-container {
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  direction: ltr;
  /* التعديل الجوهري للتوسيط */
  margin: 25px auto 0 auto; 
}

table { width: 100%; border-collapse: collapse; }

th, td { 
  padding: 10px 8px;
  border-bottom: 1px solid #f2f2f7; 
  font-size: 10px; 
  text-align: center; 
  vertical-align: middle;
}

th { background: #f7fafc; color: #718096; text-transform: uppercase; }
td { color: #2d3748; }

/* توزيع الأعمدة */
th:nth-child(1), td:nth-child(1) { width: 35%; text-align: center; } 
th:nth-child(2), td:nth-child(2) { width: 40%; text-align: center; } 
th:nth-child(3), td:nth-child(3) { width: 25%; text-align: center; } 

.toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 25px;
  border-radius: 20px;
  color: white;
  z-index: 9999;
  font-weight: 500;
  text-align: center;
}

.connect-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px 0;
  color: #86868b;
  font-size: 11px;
  border-top: 1px solid #d2d2d7;
  width: 85%;
  max-width: 480px; /* تناسق مع الجدول */
  margin: 40px auto 20px auto;
  direction: ltr;
}

.connect-footer strong { color: #007aff; font-weight: 600; }
/* تنسيق مجموعة الأزرار لتكون أفقية */
.button-group {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 450px; /* ليتناسب مع عرض الكاميرا */
    margin: 8px auto;
}

.button-group .btn-main {
    flex: 1; /* يجعل الزرين بنفس العرض */
    margin: 0; /* إزالة الهوامش التلقائية القديمة */
}

/* لون مميز لزر التحديث */
.btn-refresh {
    background-color: #8e8e93 !important; /* لون رمادي أبل الشهير */
}
