/* ========================================================================= */
/* NEBULA GLASS THEME - GLOBAL STYLES                                        */
/* ========================================================================= */
:root {
    --bg-base: #06090f; --glass: rgba(255, 255, 255, 0.03); --border: rgba(255, 255, 255, 0.08);
    --primary: #00d2ff; --success: #38ef7d; --warning: #f2c94c; --danger: #ff416c; --offline: #6c757d;
}

body { 
    font-family: 'Tajawal', sans-serif; background-color: var(--bg-base); 
    color: #e2e8f0; margin: 0; padding-bottom: 90px; overflow-x: hidden;
    background-image: radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.1), transparent 50%);
}

/* الهيدر والبحث */
.mobile-header { position: sticky; top: 0; z-index: 1000; background: rgba(6, 9, 15, 0.85); backdrop-filter: blur(15px); border-bottom: 1px solid var(--border); padding: 15px; }
.search-capsule { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 25px; padding: 10px 15px; display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.search-capsule input { background: none; border: none; color: white; width: 100%; outline: none; }

/* فلاتر الحالة */
.filter-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-btn { background: var(--glass); border: 1px solid var(--border); color: #94a3b8; border-radius: 20px; padding: 5px 15px; white-space: nowrap; cursor: pointer; transition: 0.3s; }
.filter-btn.active { background: rgba(0, 210, 255, 0.15); color: var(--primary); border-color: var(--primary); }

/* الكروت بنظام الشبكة مع حالة الإضاءة */
.device-card { background: var(--glass); border: 1px solid var(--border); border-radius: 18px; padding: 15px; display: flex; align-items: center; gap: 12px; position: relative; transition: transform 0.2s, box-shadow 0.2s; height: 100%; }
.device-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); }
.device-card.status-online { box-shadow: inset -4px 0 0 var(--success); }
.device-card.status-failed { box-shadow: inset -4px 0 0 var(--danger); border-color: rgba(255, 65, 108, 0.5); }

/* التشيك بوكس */
.check-container { position: relative; width: 26px; height: 26px; flex-shrink: 0; cursor: pointer;}
.device-check { display: none; }
.checkmark { position: absolute; top: 0; left: 0; height: 26px; width: 26px; background: rgba(255,255,255,0.05); border: 2px solid var(--border); border-radius: 6px; }
.device-check:checked + .checkmark { background: var(--success); border-color: var(--success); }
.device-check:checked + .checkmark::after { content: "\f00c"; font-family: "Font Awesome 5 Free"; font-weight: 900; color: black; font-size: 14px; position: absolute; left: 4px; top: 1px; }

/* بيانات الجهاز */
.device-info { flex-grow: 1; min-width: 0; cursor: pointer; }
.device-name { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: white; }
.device-meta { font-size: 0.8rem; color: #94a3b8; display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.text-ip { color: #f2c94c; font-family: monospace; font-weight: bold; background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 6px; }
.error-msg { font-size: 0.75rem; color: var(--danger); font-weight: bold; display: block; margin-top: 5px; }

/* الشريط السفلي والـ Modals */
.bottom-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: rgba(6, 9, 15, 0.95); backdrop-filter: blur(15px); border-top: 1px solid var(--border); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 2000; }
.modal-content { background-color: #0d1117; border: 1px solid #30363d; border-radius: 20px; color: #e6edf3; }
.modal-header { border-bottom: 1px solid #30363d; padding: 15px 20px; }
.form-control, .form-select { background: rgba(255,255,255,0.05) !important; border: 1px solid var(--border) !important; color: white !important; border-radius: 12px; }
.form-control:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 0.25rem rgba(0, 210, 255, 0.2) !important; }
/* إصلاح ظهور القوائم المنسدلة داخل الثيم الداكن و SweetAlert */
.form-select option,
.form-select optgroup,
.swal2-select option,
.swal2-select optgroup {
  background: #0f172a !important;
  color: #ffffff !important;
}
.swal2-select {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #475569 !important;
  border-radius: 12px !important;
}
.swal2-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 210, 255, 0.2) !important;
}


/* أزرار التطبيقات (App Grid) */
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.app-btn { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 16px; padding: 15px 5px; color: #e6edf3; text-align: center; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: 0.2s; }
.app-btn:hover { background: rgba(255,255,255,0.08); transform: scale(1.05); }
.app-btn i { display: block; font-size: 1.8rem; margin-bottom: 8px; }
/* Mobile/UX hardening added */
@media (max-width: 768px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .device-card { min-height: 86px; align-items: stretch; }
  .device-name { font-size: 15px; line-height: 1.35; word-break: break-word; }
  .device-meta { flex-wrap: wrap; gap: 6px; }
  .modal-dialog { margin: .5rem; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bottom-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}


/* قائمة صفحات الأدوات اليمنى للداشبورد */
.dashboard-with-tools .tools-sidebar{
  position:fixed; top:86px; right:14px; bottom:104px; width:255px; z-index:1050;
  background:rgba(15,23,42,.86); border:1px solid rgba(255,255,255,.08); border-radius:22px;
  box-shadow:0 18px 45px rgba(0,0,0,.28); backdrop-filter:blur(16px); overflow:hidden;
}
.dashboard-with-tools .tools-sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px;border-bottom:1px solid rgba(255,255,255,.08)}
.dashboard-with-tools .tools-sidebar-kicker{font-size:10px;letter-spacing:2px;color:#67e8f9;font-weight:900;line-height:1;margin-bottom:5px}
.dashboard-with-tools .tools-mini-link{width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;text-decoration:none;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08)}
.dashboard-with-tools .tools-sidebar-scroll{overflow:auto;padding:12px;scrollbar-width:thin;height:100%}
.dashboard-with-tools .tools-group-title{font-size:12px;font-weight:900;color:#facc15;margin:10px 4px 8px;border-bottom:1px solid rgba(255,255,255,.07);padding-bottom:6px}
.dashboard-with-tools .tools-side-btn{display:flex;align-items:center;gap:9px;padding:10px 11px;margin-bottom:7px;border-radius:15px;text-decoration:none;color:#dbeafe;background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.065);transition:.2s;line-height:1.25;font-size:13px;font-weight:800}
.dashboard-with-tools .tools-side-btn i{width:18px;text-align:center;flex-shrink:0}.dashboard-with-tools .tools-side-btn:hover{background:rgba(0,210,255,.12);border-color:rgba(0,210,255,.26);color:#fff;transform:translateX(-2px)}
.dashboard-with-tools .tools-fab{position:fixed;right:14px;bottom:96px;z-index:2100;display:flex;align-items:center;gap:7px;border:0;border-radius:999px;padding:11px 14px;background:linear-gradient(135deg,#0ea5e9,#2563eb);color:white;font-weight:900;box-shadow:0 12px 30px rgba(37,99,235,.35)}
@media (min-width: 1200px){.dashboard-with-tools main.container-fluid,.dashboard-with-tools .mobile-header,.dashboard-with-tools .bottom-bar{padding-right:285px!important}.dashboard-with-tools .bottom-bar{width:calc(100% - 270px);left:0;right:auto}}
@media (max-width: 1199.98px){.dashboard-with-tools .offcanvas{width:min(88vw,390px)}.dashboard-with-tools .tools-side-btn{font-size:14px}}

/* ========================================================================= */
/* UI polish: tools menu + bottom actions buttons                              */
/* ========================================================================= */
.dashboard-with-tools .tools-sidebar{
  top:92px;
  right:16px;
  bottom:112px;
  width:270px;
  border-radius:26px;
  background:
    linear-gradient(180deg, rgba(15,23,42,.95), rgba(2,6,23,.92)),
    radial-gradient(circle at 100% 0%, rgba(0,210,255,.18), transparent 40%);
  border:1px solid rgba(148,163,184,.16);
  box-shadow:0 22px 55px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.05);
}
.dashboard-with-tools .tools-sidebar-head{
  padding:16px 16px 14px;
  background:linear-gradient(135deg, rgba(14,165,233,.16), rgba(37,99,235,.05));
}
.dashboard-with-tools .tools-sidebar-head h6{font-size:15px;letter-spacing:.1px;}
.dashboard-with-tools .tools-mini-link{
  width:38px;height:38px;
  background:rgba(255,255,255,.08);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08);
}
.dashboard-with-tools .tools-mini-link:hover{background:rgba(14,165,233,.18);color:#fff;}
.dashboard-with-tools .tools-sidebar-scroll{
  padding:12px 12px 18px;
  padding-bottom:74px;
}
.dashboard-with-tools .tools-group-title{
  display:flex;align-items:center;gap:7px;
  color:#fbbf24;
  font-size:11px;
  letter-spacing:.2px;
  margin:14px 4px 8px;
  border:0;
  padding:0;
}
.dashboard-with-tools .tools-group-title::before{
  content:"";width:7px;height:7px;border-radius:99px;background:#fbbf24;box-shadow:0 0 12px rgba(251,191,36,.55);
}
.dashboard-with-tools .tools-side-btn{
  position:relative;
  min-height:46px;
  padding:11px 12px;
  margin-bottom:8px;
  border-radius:18px;
  color:#e5edf8;
  background:linear-gradient(135deg, rgba(255,255,255,.065), rgba(255,255,255,.026));
  border:1px solid rgba(148,163,184,.13);
  box-shadow:0 8px 22px rgba(0,0,0,.12);
  overflow:hidden;
}
.dashboard-with-tools .tools-side-btn::after{
  content:"";position:absolute;top:10px;bottom:10px;right:0;width:3px;border-radius:99px;background:linear-gradient(180deg,#00d2ff,#38ef7d);opacity:.85;
}
.dashboard-with-tools .tools-side-btn i{
  width:31px;height:31px;border-radius:13px;
  display:inline-flex;align-items:center;justify-content:center;
  background:rgba(255,255,255,.075);
  margin-inline-end:2px;
}
.dashboard-with-tools .tools-side-btn span{
  flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.dashboard-with-tools .tools-side-btn:hover{
  background:linear-gradient(135deg, rgba(14,165,233,.22), rgba(56,239,125,.08));
  border-color:rgba(14,165,233,.35);
  transform:translateX(-4px);
}
.dashboard-with-tools .tools-fab{
  right:auto;
  left:50%;
  transform:translateX(-50%);
  bottom:104px;
  min-width:118px;
  height:48px;
  justify-content:center;
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(135deg,#0ea5e9,#2563eb 58%,#1d4ed8);
  box-shadow:0 16px 38px rgba(37,99,235,.45), inset 0 1px 0 rgba(255,255,255,.18);
}
.dashboard-with-tools .tools-fab:hover{filter:brightness(1.06);}
.dashboard-with-tools .offcanvas{
  background:linear-gradient(180deg,#0b1120,#020617)!important;
  border-right:1px solid rgba(255,255,255,.08);
}
.dashboard-with-tools .offcanvas-body{padding-bottom:110px;}

/* Bottom action bar: desktop */
.dashboard-with-tools .bottom-bar{
  gap:12px;
  min-height:78px;
  background:linear-gradient(180deg, rgba(6,9,15,.90), rgba(6,9,15,.98));
  box-shadow:0 -16px 42px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
}
.dashboard-with-tools .bottom-bar > .d-flex{
  align-items:center;
  gap:8px!important;
}
.dashboard-with-tools .bottom-bar .btn{
  min-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border-radius:999px!important;
  font-weight:900;
  white-space:nowrap;
  box-shadow:0 8px 22px rgba(0,0,0,.16);
}
.dashboard-with-tools #device-count{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:34px;height:34px;border-radius:13px;
  background:rgba(14,165,233,.14);
  border:1px solid rgba(14,165,233,.22);
  margin-inline-end:6px;
}

@media (min-width: 1200px){
  .dashboard-with-tools main.container-fluid,
  .dashboard-with-tools .mobile-header,
  .dashboard-with-tools .bottom-bar{padding-right:306px!important;}
  .dashboard-with-tools .bottom-bar{width:calc(100% - 286px);left:0;right:auto;}
}

@media (max-width: 1199.98px){
  body.dashboard-with-tools{padding-bottom:132px;}
  .dashboard-with-tools .offcanvas{width:min(88vw,390px);}
  .dashboard-with-tools .tools-side-btn{font-size:14px;min-height:48px;}
  .dashboard-with-tools .tools-fab{bottom:122px;}
  .dashboard-with-tools .bottom-bar{
    left:10px;
    right:10px;
    bottom:10px;
    width:auto;
    min-height:auto;
    padding:10px;
    border-radius:24px;
    border:1px solid rgba(255,255,255,.10);
    display:grid;
    grid-template-columns:1fr auto;
    align-items:center;
    backdrop-filter:blur(18px);
  }
  .dashboard-with-tools .bottom-bar > .d-flex{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px!important;
    order:2;
  }
  .dashboard-with-tools .bottom-bar .btn{
    min-height:36px;
    padding:7px 10px!important;
    font-size:12px;
  }
  .dashboard-with-tools .bottom-bar > .fw-bold{
    order:1;
    align-self:stretch;
    min-width:56px;
    padding:8px 6px;
    border-radius:18px;
    background:rgba(14,165,233,.10);
    border:1px solid rgba(14,165,233,.18);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    font-size:11px;
    line-height:1.25;
    text-align:center;
  }
  .dashboard-with-tools #device-count{margin:0 0 3px 0;min-width:30px;height:28px;border-radius:11px;font-size:13px;}
}

@media (max-width: 420px){
  body.dashboard-with-tools{padding-bottom:150px;}
  .dashboard-with-tools .mobile-header{padding:12px;}
  .dashboard-with-tools .tools-fab{bottom:140px;height:44px;min-width:110px;font-size:13px;}
  .dashboard-with-tools .bottom-bar{
    grid-template-columns:1fr;
    gap:8px;
  }
  .dashboard-with-tools .bottom-bar > .fw-bold{
    order:1;
    flex-direction:row;
    gap:5px;
    min-width:0;
    padding:6px 8px;
  }
  .dashboard-with-tools .bottom-bar > .d-flex{order:2;grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-with-tools .bottom-bar .btn{font-size:11.5px;padding:7px 8px!important;}
}

/* ========================================================================= */
/* Mobile readability upgrade - larger project font for phone usage           */
/* Added 2026-05-22                                                           */
/* ========================================================================= */
html { font-size: 17px; }
body { font-size: 1rem; line-height: 1.65; }
button, input, select, textarea, .btn, .form-control, .form-select {
  font-size: 1rem !important;
  line-height: 1.45 !important;
}
.device-name { font-size: 1.15rem; }
.device-meta, .error-msg { font-size: .92rem; }
.app-btn { font-size: .92rem; min-height: 92px; }
.dashboard-with-tools .tools-side-btn { font-size: .98rem; min-height: 52px; }
.modal-content { font-size: 1rem; }
.modal-title { font-size: 1.2rem; font-weight: 900; }
.table, .table td, .table th { font-size: .96rem; }
.result-box, pre, code { font-size: .94rem; }

@media (max-width: 768px) {
  html { font-size: 18px; }
  body { line-height: 1.7; }
  .mobile-header { padding: 16px 14px; }
  .mobile-header h1, .mobile-header h2, .mobile-header h3,
  .mobile-header .h1, .mobile-header .h2, .mobile-header .h3 { font-size: 1.28rem !important; }
  .search-capsule { padding: 13px 16px; border-radius: 28px; }
  .filter-btn { font-size: .98rem; padding: 8px 17px; }
  .app-grid { gap: 14px; }
  .app-btn { font-size: .98rem !important; padding: 18px 8px; min-height: 105px; border-radius: 18px; }
  .app-btn i { font-size: 2rem; }
  .device-card { min-height: 104px; padding: 17px; gap: 14px; }
  .device-name { font-size: 1.08rem !important; white-space: normal; }
  .device-meta { font-size: .94rem !important; }
  .text-ip { font-size: .96rem; padding: 4px 8px; }
  .bottom-bar .btn, .bottom-bar .fw-bold { font-size: .95rem !important; min-height: 44px; }
  .modal-dialog { margin: .65rem; }
  .modal-header, .modal-body, .modal-footer { padding: 1rem !important; }
  .form-control, .form-select { min-height: 48px; }
  .btn { min-height: 46px; }
}
