/* styles.css - Conference Invites System
   هدفه: يجعل الواجهة متناسقة على iPad / Tablet / Mobile بدون ما نغيّر لوجك الجافاسكربت.
*/

/* Base */
:root{
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html, body { height: 100%; }
body{
  font-family: 'Tajawal', sans-serif;
  background:#f1f5f9;
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Prevent iOS input zoom (>=16px) */
input, select, button, textarea { font-size: 16px; }

/* Better touch targets */
button, [role="button"], .btn {
  touch-action: manipulation;
}
button{ -webkit-tap-highlight-color: transparent; }

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

td, th { vertical-align: top; }

/* Layout polish for small screens */
@media (max-width: 640px){
  /* Nav + main paddings become tighter */
  .mobile-tight { padding-left: 12px !important; padding-right: 12px !important; }
  /* Reduce max-height list so it doesn't feel cramped */
  .list-max { max-height: 64vh !important; }
}

/* Table -> Cards on small screens (mobile friendly) */
@media (max-width: 860px){
  table.responsive-table thead{ display:none; }
  table.responsive-table, 
  table.responsive-table tbody, 
  table.responsive-table tr, 
  table.responsive-table td{
    display:block;
    width:100%;
  }
  table.responsive-table tbody{ padding: 6px 10px 14px; }
  table.responsive-table tr{
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
  }
  table.responsive-table td{
    padding: 12px 14px !important;
    border-bottom: 1px solid #f1f5f9;
  }
  table.responsive-table td:last-child{ border-bottom: none; }
  table.responsive-table td::before{
    content: attr(data-label);
    display:block;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color:#94a3b8;
    font-weight: 800;
    margin-bottom: 6px;
  }
  /* Align action buttons nicely */
  .actions-wrap{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-start;
    gap: 10px;
  }
  .actions-wrap > button{
    flex: 1 1 140px;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }
}

/* iPad: make header safe and nicer */
nav.sticky{
  padding-top: var(--safe-top);
}

/* Modal: better sizing on phones */
@media (max-width: 480px){
  #modal > div, #confirmModal > div, #pinModal > div{
    max-width: 100% !important;
    padding: 18px !important;
    border-radius: 18px !important;
  }
}

/* Toast: keep above safe area */
#toast{
  bottom: calc(20px + var(--safe-bottom)) !important;
}

/* =========================================================
   ✅ Header Fix (Responsive)
   - يزيل مشكلة h-16 الثابتة
   - يخلي الأزرار تلف/تترتب بدون ما تنكسر
   - يخلي الهيدر قابل للتمرير أفقياً كحل أخير على الشاشات الصغيرة
========================================================= */

/* خلي شريط الهيدر يلتزم بالـ safe-area مضبوط */
nav.sticky{
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* بالوضع الطبيعي: خليه يلف لو كثرت الأزرار */
nav.sticky > .max-w-7xl{
  height: auto !important;          /* override h-16 */
  min-height: 64px;                 /* نفس إحساس h-16 */
  padding-top: 12px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;                  /* أهم سطر: لف العناصر */
}

/* خلي بلوك الأزرار يتصرف صح */
nav.sticky > .max-w-7xl > .flex.items-center.gap-2{
  flex: 1 1 520px;                  /* يسمح له ينزل سطر ثاني */
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 260px;
}

/* بلوك العنوان ما ينضغط أكثر من اللازم */
nav.sticky > .max-w-7xl > .flex.items-center.gap-3{
  flex: 1 1 320px;
  min-width: 240px;
}

/* موبايل/تابلت صغير: رصّ الأزرار صفين + تمرير أفقي إذا اضطر */
@media (max-width: 900px){
  nav.sticky > .max-w-7xl{
    align-items: flex-start;
  }

  /* صغر حجم الأزرار حتى ما تكسر */
  nav.sticky button,
  nav.sticky label{
    padding: 10px 12px !important;
    font-size: 12px !important;
    border-radius: 12px !important;
    line-height: 1.1;
    white-space: nowrap;
  }

  /* خليه يقدر يسوي سكرول أفقي كحل احتياطي */
  nav.sticky > .max-w-7xl > .flex.items-center.gap-2{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  nav.sticky > .max-w-7xl > .flex.items-center.gap-2::-webkit-scrollbar{
    height: 6px;
  }
}

/* موبايل جداً: خلي الأزرار تاخذ عرض أكبر وتترتب بشكل مريح */
@media (max-width: 520px){
  nav.sticky > .max-w-7xl{
    padding-top: 10px;
    padding-bottom: 10px;
  }

  nav.sticky > .max-w-7xl > .flex.items-center.gap-2{
    width: 100%;
    justify-content: flex-start;
    flex: 1 1 100%;
    min-width: 0;
  }

  nav.sticky button,
  nav.sticky label{
    flex: 1 1 160px;               /* زرّين بالسطر عادة */
  }

  /* العنوان يصير أوضح */
  nav.sticky .text-lg,
  nav.sticky .sm\:text-xl{
    font-size: 16px !important;
  }
}
