/* ==========================================================
   UA TRUE GLOBAL GLASS SYSTEM
   طبقة موحدة نهائية لتطبيق شفافية Glass على الكروت والأشرطة
   في صفحات البرنامج العادية، النوافذ المنبثقة، وصفحات embed داخل iframe.
   لا تلمس منطق PHP؛ فقط تكسر الخلفيات الصلبة المحلية وتحافظ على القراءة.
   ========================================================== */
:root{
  --ua-glass-final-card: rgba(6, 16, 31, .42);
  --ua-glass-final-card-2: rgba(6, 16, 31, .24);
  --ua-glass-final-card-strong: rgba(6, 16, 31, .54);
  --ua-glass-final-panel: rgba(5, 14, 28, .34);
  --ua-glass-final-bar: rgba(5, 14, 28, .48);
  --ua-glass-final-table: rgba(6, 16, 31, .30);
  --ua-glass-final-border: rgba(255,255,255,.145);
  --ua-glass-final-gold: rgba(243,186,47,.25);
  --ua-glass-final-cyan: rgba(67,217,255,.18);
  --ua-glass-final-shadow: 0 18px 46px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.075);
  --ua-glass-final-blur: blur(17px) saturate(138%);
}

html,
html body.ua-authed,
html body.ua-shell-chrome,
html.ua-embed-glass,
html.ua-embed-glass body{
  background-color:#061428 !important;
}

html body.ua-authed,
html.ua-embed-glass body{
  color:#eef4ff;
}

/* الصفحة نفسها لا يجب أن تغطي الخلفية */
html body.ua-authed.ua-shell-chrome :is(
  .ua-shell,.ua-main,.ua-page,.ua-page-body,.ua-content,.ua-shell-content,.ua-frame-content,
  .content-wrapper,.content,.main-content,.page-content,.container,.container-fluid,
  .wrapper,.layout-page,.layout-wrapper,.app-content,.ua-extracted-page,.ua-network-page,
  .ua-billing-page,.ua-comms-page,.ua-comms-content,.network-shell,.settings-shell,
  .finance-shell,.billing-shell,.messages-shell,.automation-shell,.reports-shell,
  section.content,section.content-header
),
html.ua-embed-glass body :is(
  .content-wrapper,.content,.main-content,.page-content,.container,.container-fluid,
  .ua-extracted-page,.ua-network-page,.ua-billing-page,.ua-comms-page,.ua-comms-content,
  section.content,section.content-header
){
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none;
}

/* الكروت والألواح الأساسية - specificity عالي لكسر CSS المحلي حتى مع !important */
html body.ua-authed.ua-shell-chrome :is(
  .card,.box,.panel,.well,.callout,.jumbotron,
  .ua-card,.ua-panel,.ua-box,.ua-widget,.ua-studio-card,.ua-studio-panel,.ua-page-card,.ua-page-panel,
  .nocx-card,.nocx-panel,.mk-stat-card,.dashboard-card,.metric-card,.small-box,.info-box,.stat-card,.widget,.widget-card,
  .profile-card,.settings-card,.invoice-card,.voucher-card,.agent-card,.finance-card,.report-card,.message-card,
  .fin-card,.fin-kpi,.sales-card,.purchase-card,.package-card,.router-card,.sector-card,.airmax-card,.airmax-panel,
  .ua-comms-card,.ua-router-card,.ua-result-card,.ua-comms-note,.ua-comms-alert,.ua-comms-modal__dialog,
  .secmon-card,.secmon-kpi,.history-card,.ua-history-clear-card,.sa-card,.sa-hero,.sa-summary,
  .subsx-card,.subsx-table-card,.subsx-toolbar,.subsx-side-card,.subsx-meta-card,
  .modal-content,.dropdown-menu,.popover,.toast,.alert,.list-group,.list-group-item
),
html.ua-embed-glass body :is(
  .card,.box,.panel,.well,.callout,.jumbotron,
  .ua-card,.ua-panel,.ua-box,.ua-widget,.ua-page-card,.ua-page-panel,
  .small-box,.info-box,.stat-card,.widget,.widget-card,.profile-card,.settings-card,
  .invoice-card,.voucher-card,.agent-card,.finance-card,.report-card,.message-card,.fin-card,.fin-kpi,
  .ua-comms-card,.ua-router-card,.ua-result-card,.ua-comms-note,.ua-comms-alert,.ua-comms-modal__dialog,
  .secmon-card,.secmon-kpi,.history-card,.sa-card,.sa-hero,.sa-summary,.subsx-card,.subsx-table-card,.subsx-toolbar,
  .modal-content,.dropdown-menu,.popover,.toast,.alert,.list-group,.list-group-item
),
html body.ua-authed.ua-shell-chrome :is(
  [class*="-card"],[class*="_card"],[class*="Card"],
  [class*="-panel"],[class*="_panel"],[class*="Panel"],
  [class*="-box"],[class*="_box"],[class*="Box"],
  [class*="-widget"],[class*="_widget"],[class*="Widget"]
):not(.btn):not(button):not(input):not(select):not(textarea):not(option):not(.badge):not(.label):not(.chip):not(.pill):not(.progress):not(.progress-bar):not(.ua-page-winbtn):not(.nocx-stat-chip):not(.nocx-user-chip),
html.ua-embed-glass body :is(
  [class*="-card"],[class*="_card"],[class*="Card"],
  [class*="-panel"],[class*="_panel"],[class*="Panel"],
  [class*="-box"],[class*="_box"],[class*="Box"],
  [class*="-widget"],[class*="_widget"],[class*="Widget"]
):not(.btn):not(button):not(input):not(select):not(textarea):not(option):not(.badge):not(.label):not(.chip):not(.pill):not(.progress):not(.progress-bar){
  background:
    radial-gradient(circle at 18% 0%, rgba(67,217,255,.105), transparent 36%),
    linear-gradient(180deg, var(--ua-glass-final-card), var(--ua-glass-final-card-2)) !important;
  background-color: transparent !important;
  border-color: var(--ua-glass-final-border) !important;
  box-shadow: var(--ua-glass-final-shadow) !important;
  backdrop-filter: var(--ua-glass-final-blur) !important;
  -webkit-backdrop-filter: var(--ua-glass-final-blur) !important;
  background-clip: padding-box !important;
}

/* الأشرطة والعناوين والتبويبات */
html body.ua-authed.ua-shell-chrome :is(
  .ua-topbar,.ua-topbar-stats,.ua-unified-stats,.main-header,.navbar,.navbar-custom-menu,
  .content-header,.page-header,.ua-page-titlebar,.ua-titlebar,.ua-toolbar,
  .ua-unified-shell-block,.ua-page-windowbar,.ua-windowbar,.ua-tabsbar,.ua-subnav,
  .toolbar,.page-toolbar,.actions-bar,.filter-bar,.search-bar,.button-bar,
  .card-header,.box-header,.panel-heading,.modal-header,.card-footer,.box-footer,.panel-footer,.modal-footer,
  .ua-card-head,.ua-card-header,.ua-panel-head,.ua-studio-head,.nocx-card-head,.widget-header,.profile-header,.settings-header,
  .ua-comms-head,.ua-comms-head__actions,.ua-comms-action-row,.ua-comms-modal__head,.ua-comms-modal__foot,.ua-comms-steps,
  .secmon-head,.secmon-toolbar,.breadcrumb,.nav-tabs,.nav-pills,.ua-atabs,.ua-ctabs,.ua-ftabs,.ua-mtabs,.ua-stabs
),
html.ua-embed-glass body :is(
  .main-header,.navbar,.content-header,.page-header,.ua-page-titlebar,.ua-titlebar,.ua-toolbar,
  .toolbar,.page-toolbar,.actions-bar,.filter-bar,.search-bar,.button-bar,
  .card-header,.box-header,.panel-heading,.modal-header,.card-footer,.box-footer,.panel-footer,.modal-footer,
  .ua-card-head,.ua-card-header,.ua-panel-head,.widget-header,.profile-header,.settings-header,
  .ua-comms-head,.ua-comms-modal__head,.ua-comms-modal__foot,.ua-comms-steps,
  .breadcrumb,.nav-tabs,.nav-pills,.ua-atabs,.ua-ctabs,.ua-ftabs,.ua-mtabs,.ua-stabs
),
html body.ua-authed.ua-shell-chrome :is(
  [class*="-head"],[class*="_head"],[class*="Head"],
  [class*="-header"],[class*="_header"],[class*="Header"],
  [class*="-toolbar"],[class*="_toolbar"],[class*="Toolbar"],
  [class*="-bar"],[class*="_bar"],[class*="Bar"],
  [class*="-tabs"],[class*="_tabs"],[class*="Tabs"]
):not(.progress-bar):not(.scrollbar):not(.btn):not(button):not(input):not(select):not(textarea):not(.ua-shell-gold-line):not(.ua-shell-scrollbar):not(.ua-shell-scroll-nav):not(.nocx-gold-scrollbar),
html.ua-embed-glass body :is(
  [class*="-head"],[class*="_head"],[class*="Head"],
  [class*="-header"],[class*="_header"],[class*="Header"],
  [class*="-toolbar"],[class*="_toolbar"],[class*="Toolbar"],
  [class*="-bar"],[class*="_bar"],[class*="Bar"],
  [class*="-tabs"],[class*="_tabs"],[class*="Tabs"]
):not(.progress-bar):not(.scrollbar):not(.btn):not(button):not(input):not(select):not(textarea){
  background:
    radial-gradient(circle at 75% 0%, rgba(243,186,47,.12), transparent 34%),
    linear-gradient(180deg, rgba(8,21,39,.58), var(--ua-glass-final-bar)) !important;
  background-color: transparent !important;
  border-color: var(--ua-glass-final-gold) !important;
  box-shadow: 0 14px 36px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.07) !important;
  backdrop-filter: blur(16px) saturate(135%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(135%) !important;
}

/* معالجة inline styles الصلبة داخل الصفحات القديمة */
html body.ua-authed.ua-shell-chrome :is(div,section,article,header,footer,main,aside,nav,form)[style*="background"],
html body.ua-authed.ua-shell-chrome :is(div,section,article,header,footer,main,aside,nav,form)[style*="background-color"],
html.ua-embed-glass body :is(div,section,article,header,footer,main,aside,nav,form)[style*="background"],
html.ua-embed-glass body :is(div,section,article,header,footer,main,aside,nav,form)[style*="background-color"]{
  background:
    radial-gradient(circle at 18% 0%, rgba(67,217,255,.09), transparent 35%),
    linear-gradient(180deg, rgba(6,16,31,.40), rgba(6,16,31,.22)) !important;
  background-color: transparent !important;
  border-color: rgba(255,255,255,.13) !important;
  backdrop-filter: blur(14px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(130%) !important;
}

/* الجداول: الحاوية شفافة والصفوف مقروءة */
html body.ua-authed.ua-shell-chrome :is(
  .table-responsive,.table-wrapper,.grid-wrapper,.list-wrapper,.dataTables_wrapper,.dt-container,
  .table-card,.ua-table-card,.ua-table-wrap,.table-container,.table-panel,.card-body:has(table)
),
html.ua-embed-glass body :is(
  .table-responsive,.table-wrapper,.grid-wrapper,.list-wrapper,.dataTables_wrapper,.dt-container,
  .table-card,.ua-table-card,.ua-table-wrap,.table-container,.table-panel,.card-body:has(table)
),
html body.ua-authed.ua-shell-chrome :is([class*="table-card"],[class*="table-wrap"],[class*="table-container"],[class*="-table"]):not(table):not(thead):not(tbody):not(tr):not(td):not(th),
html.ua-embed-glass body :is([class*="table-card"],[class*="table-wrap"],[class*="table-container"],[class*="-table"]):not(table):not(thead):not(tbody):not(tr):not(td):not(th){
  background: rgba(6,16,31,.30) !important;
  background-color: rgba(6,16,31,.30) !important;
  border-color: rgba(243,186,47,.18) !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.055) !important;
  backdrop-filter: blur(13px) saturate(125%) !important;
  -webkit-backdrop-filter: blur(13px) saturate(125%) !important;
}

html body.ua-authed.ua-shell-chrome :is(table,.table),
html.ua-embed-glass body :is(table,.table){
  background: transparent !important;
  background-color: transparent !important;
}
html body.ua-authed.ua-shell-chrome :is(table,.table) :is(tbody tr,tbody td,tbody th),
html.ua-embed-glass body :is(table,.table) :is(tbody tr,tbody td,tbody th){
  background-color: rgba(7,17,32,.24) !important;
}
html body.ua-authed.ua-shell-chrome :is(table,.table) :is(thead tr,thead th,thead td),
html.ua-embed-glass body :is(table,.table) :is(thead tr,thead th,thead td){
  background-color: rgba(6,16,30,.46) !important;
}
html body.ua-authed.ua-shell-chrome :is(table,.table) :is(tbody tr:hover,tbody tr:hover td),
html.ua-embed-glass body :is(table,.table) :is(tbody tr:hover,tbody tr:hover td){
  background-color: rgba(67,217,255,.10) !important;
}

/* حقول الإدخال تبقى مقروءة وغير صلبة */
html body.ua-authed.ua-shell-chrome :is(
  .form-control,.form-select,select,textarea,
  input[type="text"],input[type="password"],input[type="number"],input[type="email"],input[type="date"],input[type="search"],input[type="tel"],input[type="url"],input[type="time"]
),
html.ua-embed-glass body :is(
  .form-control,.form-select,select,textarea,
  input[type="text"],input[type="password"],input[type="number"],input[type="email"],input[type="date"],input[type="search"],input[type="tel"],input[type="url"],input[type="time"]
){
  background: rgba(6,16,30,.46) !important;
  background-color: rgba(6,16,30,.46) !important;
  border-color: rgba(255,255,255,.16) !important;
  color:#f8fafc !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}
html body.ua-authed.ua-shell-chrome :is(select option,.form-select option),
html.ua-embed-glass body :is(select option,.form-select option){
  color:#08111f !important;
  background:#eef4ff !important;
}

/* iframe / embed: إزالة الأبيض وتفعيل الشفافية داخل الإطارات */
html body.ua-authed.ua-shell-chrome :is(.ua-embed-frame,iframe){
  background: transparent !important;
  background-color: transparent !important;
}
html.ua-embed-glass body{
  margin:0;
  min-height:100vh;
  background: transparent !important;
  background-color: transparent !important;
}

/* السايدبار يبقى زجاجي بدون فقدان التباين */
html body.ua-authed.ua-shell-chrome :is(.ua-sb3,.main-sidebar,.control-sidebar){
  background:
    radial-gradient(circle at 68% 0%, rgba(67,217,255,.14), transparent 34%),
    linear-gradient(180deg, rgba(7,17,31,.64), rgba(3,9,18,.72)) !important;
  backdrop-filter: blur(18px) saturate(135%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(135%) !important;
  box-shadow: -18px 0 55px rgba(0,0,0,.22), inset 1px 0 0 rgba(255,255,255,.05) !important;
}
html body.ua-authed.ua-shell-chrome :is(.ua-sb3 .ua-sb3-item,.ua-sb3 a,.ua-sb3-menu a,.sidebar-menu a){
  background-color: rgba(6,16,30,.32) !important;
}

/* لا نحول الأزرار والمؤشرات إلى كروت زجاجية */
html body.ua-authed.ua-shell-chrome :is(.btn,button,[role="button"],.badge,.label,.pill,.chip,.progress,.progress-bar,.ua-page-winbtn,.nocx-stat-chip,.nocx-user-chip),
html.ua-embed-glass body :is(.btn,button,[role="button"],.badge,.label,.pill,.chip,.progress,.progress-bar){
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* إزالة طبقات before/after الصلبة فوق الكروت */
html body.ua-authed.ua-shell-chrome :is(.ua-comms-head,.sa-hero,.card,.box,.panel,.ua-card,.ua-panel,.ua-page-card,.subsx-card,.fin-card)::before,
html body.ua-authed.ua-shell-chrome :is(.ua-comms-head,.sa-hero,.card,.box,.panel,.ua-card,.ua-panel,.ua-page-card,.subsx-card,.fin-card)::after,
html.ua-embed-glass body :is(.ua-comms-head,.sa-hero,.card,.box,.panel,.ua-card,.ua-panel,.ua-page-card,.subsx-card,.fin-card)::before,
html.ua-embed-glass body :is(.ua-comms-head,.sa-hero,.card,.box,.panel,.ua-card,.ua-panel,.ua-page-card,.subsx-card,.fin-card)::after{
  background-color: transparent !important;
}

/* تحسين قراءة alert بعد تحويلها للزجاج */
html body.ua-authed.ua-shell-chrome :is(.alert-success,.alert-info,.alert-warning,.alert-danger),
html.ua-embed-glass body :is(.alert-success,.alert-info,.alert-warning,.alert-danger){
  color:#f8fafc !important;
}
