/* استدعاء خط يدعم الكوردية بامتياز من جوجل */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500&display=swap');
body {
    margin: 0;
   font-family: 'Tajawal', sans-serif;
    color: #2c2c2c;
        padding-bottom: 80px;

    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;
     transition: background-color 0.3s ease, color 0.3s ease;
}



/* تنسيق عنوان الجامعة داخل الجدول */
.university-header-cell {
    background-color: #1e5aaf !important;
    color: #ffffff !important;
    font-weight: bold;
    font-size: 12px !important;
    text-align: center;
    padding: 10px !important;
}

/* تنسيق الوضع الليلي لعنوان الجامعة */
body[data-theme='dark'] .university-header-cell {
    background-color: #1e4273 !important;
    color: #ffffff !important;
}

.side-menu {
  background-color: #f6f6f6;
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(5px);
  padding-top: 58px;
  position: fixed;
  right: -262px;
  top: 0;
  z-index: 1002;
  transition: right 0.3s ease;
  width: 260px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  border-left: 2px solid #e8e8e8;
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #f5f5f5;
  direction: rtl;
}

.side-menu button {
  background: none;
  border: none;
  color: #333333;
  width: 100%;
  padding: 12px 20px;
  text-align: right;
   font-family: 'Tajawal', sans-serif;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.3s;
}

#swipe-open-area {
  position: fixed;
  top: 60px;
  right: 0;
  width: 30px; /* تقريبًا نصف سم */
  height: 82vh;
  z-index: 9999;
  background : transparent; /* خلفية شفافة */
  touch-action: none; /* تمنع تصرفات النظام على الحافة */
}

.side-menu button i {
  color: #3b82f6;
  margin-left: 10px;
}

.side-menu button:hover {
  background-color: #f8f9fa;
}

.side-menu.open {
  right: 0;
}

/* Dropdown section */
.menu-toggle {
  justify-content: space-between;
}

.submenu {
  display: flex;
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.submenu.open {
  max-height: 500px;
  opacity: 1;
}

.submenu button {
  background-color: #f8f9fa;
  padding-right: 30px;
  font-size: 13px;
  color: #666666;
  display: flex;
  align-items: center;
  border: none;
  text-align: right;
}

.submenu button i {
  color: #344465;
  margin-left: 10px;
  min-width: 18px;
}

.submenu button:hover {
  background-color: #e9ecef;
}

.menu-toggle {
  justify-content: space-between;
  position: relative;
}



.submenu.open ~ .arrow-icon,
.menu-toggle.open .arrow-icon {
  transform: rotate(180deg);
}

.side-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 0;
}

.side-logo img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.side-logo:hover img {
    transform: scale(1.05) translateY(-2px);
    opacity: 0.9;
}

.heart {
  color: #e74c3c;
  font-size: 1.2em;
  animation: beat 1s infinite;
  margin: 0 2px;
  display: inline-block;
  vertical-align: middle;
}

@keyframes beat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

.by-ali {
  font-weight: 600;
  bottom: 100px;
  width: 100%;
  text-align: center;
  font-size: 12px;
  margin-top: 10%;
  color: #888888;
  padding-bottom: 5px;
  user-select: none;
  letter-spacing: 0.5px;
  user-select: none;
}

.arrow-icon {
  transition: transform 0.3s ease;
  margin-right: auto;  /* يجعل السهم في أقصى اليسار */
  font-size: 13px;
}

#nav-icon1 {
    width: 26px;
        height: 26px; /* بدل 3px حتى يحتوي الخطوط الثلاثة + مساحة حولها */

    position: fixed;
    right: 14px;
    top: 20px;
    cursor: pointer;
    
    transition: .5s ease-in-out;
    z-index: 1001;
}



#nav-icon1 span {
    display: block;
    position: absolute;
    height: 2px;
    width: 83%;
    background: #333333;
    border-radius: 9px;
    left: 0;
    transition: .25s ease-in-out;
}

#nav-icon1 span:nth-child(1) {
    top: 0px;
}

#nav-icon1 span:nth-child(2) {
    top: 8px;
}

#nav-icon1 span:nth-child(3) {
    top: 16px;
}

#nav-icon1.open span:nth-child(1) {
    top: 8px;
    transform: rotate(135deg);
     background-color: rgb(182, 84, 84); /* Added this line */
}

#nav-icon1.open span:nth-child(2) {
    opacity: 0;
    left: -60px;
   
}

#nav-icon1.open span:nth-child(3) {
    top: 8px;
    transform: rotate(-135deg);
    background-color: rgb(182, 84, 84); /* Added this line */

}


/* Basic styling for the header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 20px; /* Reduced the top and bottom padding to 5px */
  background-color: #fcfcfc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  
  /* These are the key properties to make it sticky */
  position: sticky;
  top: 0;
  z-index: 1009; /* Ensures the top bar stays on top of other content */
}

/* Styling for the left section (logo and name) */
.left-section {
  display: flex;
  align-items: center;
}

/* New CSS to style the dotLottie logo */
.dotlottie-logo {
  /* This is the key part to make it smaller */
  width: 50px; 
  height: 50px;
  margin-right: 10px; /* Provides spacing between the logo and the site name */
}

.site-name {
  font-size: 18px;
  font-weight: bold;
  color: #333333;
}






.content {
    padding: 20px 20px 0px 20px;
    background-color: #ffffff;
    border-radius: 8px;
    color: #2c2c2c;
}

.content h1 {
    text-align: center;
    color: #236bd0;
   font-family: 'Tajawal', sans-serif;
    font-size: 22px;
}

.content h2 {
    text-align: center;
    font-size: 13px;
    margin: 20px 0;
    line-height: 1.6;
    color: #565a61;
}

.academic-year {
    display: inline-block;
    color: #2563eb;
    font-weight: 700;
    background: linear-gradient(100deg, #1d4ed8 0%, #3b82f6 42%, #2563eb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.content label {
    font-size: 14px;
    margin: 10px 0;
    display: block;
    color: #374151;
    text-align: right;
    direction: rtl;
}

/* تنسيق الحقول المدخلة وقوائم الاختيار */
.content input[type="number"],
.content input[type="text"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    width: 100%;
    height: 38px; /* ✅ توحيد الارتفاع */
    line-height: 1.5;
    padding: 10px 12px; /* ✅ مساحة داخلية جيدة */
    margin-top: 0;
    font-family: 'Tajawal', sans-serif;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: 5px;
    border: 1.5px solid #a1a8b3;
    background-color: #ffffff;
    color: #374151;
    font-size: 14px;
    text-align: right;
    direction: rtl;
    position: relative;
}

.content input[type="number"],
.content input[type="text"] {
    cursor: text;
}

.content input::placeholder {
    color: #9ca3af;
}

#data-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    background-color: #f1f1f1;
    border-radius: 8px;
    overflow: hidden;
     border: 1px solid #e5e7eb;
}


#data-table th,
#data-table td {
    padding: 10px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

#data-table td {
    position: relative;
}

#data-table td.grade-cell {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#data-table td.grade-cell:active {
    background-color: #e8f2ff;
}

.cell-action-menu {
    position: fixed;
    z-index: 1100;
    width: min(230px, calc(100vw - 16px));
    padding: 7px;
    border: 1px solid #d7e2ef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(31, 53, 80, 0.2);
    direction: rtl;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.cell-action-menu.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.cell-action-menu-title {
    padding: 7px 10px 8px;
    color: #526174;
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid #edf1f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-action-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #344054;
    font: inherit;
    font-size: 13px;
    text-align: right;
    cursor: pointer;
    touch-action: manipulation;
}

.cell-action-menu button:hover,
.cell-action-menu button:focus-visible {
    background: #eef6ff;
    outline: none;
}

.cell-action-menu button i {
    width: 18px;
    color: #3779cf;
    text-align: center;
}

.cell-action-menu button.is-favorite i {
    color: #d99420;
}

#data-table th {
    background-color: #f7fbfef1;
    color: #374151;
    font-weight: 600;
}

#data-table td {
    background-color: #fffffff9;
    color: #525763;
}

.college-header-cell {
   font-weight: bold;
    font-size: 13px !important
}



#data-table tbody tr:not(.college-header-row):hover td {
  background-color: #f5faff !important;
  transition: background-color 0.2s ease;
}


@media (max-width: 600px) {
    #data-table {
        font-size: 15px;
    }

    #data-table th,
    #data-table td {
  padding: 10px 8px;
          font-size: 15px;
    }

    #data-table-container {
        overflow: visible;
    }

    #data-table th {
        white-space: nowrap;
    }

    #data-table td {
        word-break: break-word;
    }
}

.highlight-fail { 
    animation: fadeInRed 0.2s ease-out forwards; 
}

@keyframes fadeInRed { 
    from { 
        color: inherit; 
    } 
    to { 
        color: #db5e5e; 
    } 
}



label i {
    margin-left: 5px;
    color: #3b82f6;
}

#table-title {
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #8a5a00;
    background: #fff8e6;
    border: 1px solid #f4d58a;
    border-radius: 10px;
    margin: 6px auto 12px;
}

#table-title:empty {
    display: none;
}

#department-count {
    margin: 0 auto 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

#department-count:empty {
    display: none;
}

/* This code hides the tab bar by default on large screens */
.tab-bar {
  display: none;
}




/* Media query to show the tab bar on mobile devices */
@media (max-width: 1100px) {
  .tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 3px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    display: flex;
  }

  .site-name {
 margin-top: 4px;
}


  .tab-list {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .tab-item {
    flex-grow: 1;
    text-align: center;
  }

  /* Adjustments for a slightly smaller size */
  .tab-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 7px 0; /* Slightly reduced padding */
    text-decoration: none;
    color: #5b7396;
    font-size: 11px; /* Slightly reduced font size */
    transition: color 0.3s ease;
  }

  /* Adjusting icon size */
  .tab-item a i {
    font-size: 22px; /* Slightly reduced icon size */
    margin-bottom: 8px; /* Slightly reduced space below icon */
  }

  .tab-label {
    display: block;
  }

  /* Hover and active state styling */
  .tab-item a:hover,
  .tab-item a:focus,
  .tab-item.active a {
    color: #1470d3;
  }

  .tab-item a:hover i,
  .tab-item a:focus i,
  .tab-item.active a i {
    transform: scale(1.1);
  }
}




.theme-toggle-button-container {
            position: absolute;
            top: 0.65rem;
            right: 3.4rem;
        }
        
        .theme-toggle-button {
            background: none;
            border: none;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: background-color 0.3s ease;
            line-height: 0;
        }

        .theme-toggle-button:hover {
 transform: scale(1.1);  
      }
        
      

        .theme-icon {
            width: 22px;
            height: 22px;
            transition: transform 0.6s ease-in-out;
            /* Removed SVG-specific stroke-width */
        }

        .tooltip {
            position: absolute;
            top: 98%; /* Position it below the button */
            right: 47%;
            transform: translateX(50%) translateY(0.5rem);
            background-color: rgba(0, 0, 0, 0.7);
            
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 0.5rem;
            font-size: 0.83rem;
            white-space: nowrap;
            opacity: 0; /* Initially hidden */
            pointer-events: none; /* Allows clicks to pass through */
            transition: opacity 0.5s ease-in-out;
        }

        .tooltip.visible {
            opacity: 1;
        }

        /* Arrow for the tooltip */
        .tooltip::before {
            content: '';
            position: absolute;
            bottom: 100%;
            right: 50%;
            transform: translateX(50%);
            border-width: 0.5rem;
            border-style: solid;
            border-color: transparent transparent rgba(0, 0, 0, 0.7) transparent;
        }
     

        #table-title {
    color: #8a5a00;
}

/* ===================================== */
/* ==   Dark Mode Override Styles     == */
/* ===================================== */
body[data-theme='dark'] {
    background-color: #2d3748;
    color: #e2e8f0;
     transition: background-color 0.3s ease, color 0.3s ease;
}

/* Keep the circular theme reveal on the compositor-friendly view-transition layer. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    animation: themeReveal 0.45s ease-out both;
    clip-path: circle(0 at var(--theme-x) var(--theme-y));
}

@keyframes themeReveal {
    to {
        clip-path: circle(150vmax at var(--theme-x) var(--theme-y));
    }
}

body[data-theme='dark'] .side-menu {
    background-color: #2d3748;
    border-left-color: #4a5568;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
}

body[data-theme='dark'] .side-menu button {
    color: #e2e8f0;
    border-bottom-color: #374153;
}

body[data-theme='dark'] .side-menu button:hover {
    background-color: #4a5568;
}

body[data-theme='dark'] .side-menu button i {
    color: #63b3ed;
}

body[data-theme='dark'] #nav-icon1 span {
    background: #e2e8f0;
}

body[data-theme='dark'] .top-bar {
    background-color: #28303d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

body[data-theme='dark'] .site-name {
    color: #e2e8f0;
}

body[data-theme='dark'] .content  {
   background-color: #2d3748;
}

body[data-theme='dark'] .content h1 {
    color: #f1f1f1;
}



body[data-theme='dark'] .content h2 {
    color: #a0aec0;
}

body[data-theme='dark'] .academic-year {
  background: linear-gradient(100deg, #3b82f6 0%, #549cf4 42%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body[data-theme='dark'] .content label {
    color: #e2e8f0;
}

body[data-theme='dark'] .content input[type="number"],
body[data-theme='dark'] .content input[type="text"] {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body[data-theme='dark'] #data-table {
    border-color: #4a5568;
     border: 1px solid #4a5568;
     background-color: #4a5568;
}



body[data-theme='dark'] #data-table th, 
body[data-theme='dark'] #data-table td {
    border-color: #4a5568;
}

body[data-theme='dark'] #data-table th {
    background-color: #353f54;
    color: #e2e8f0;
}

body[data-theme='dark'] #data-table td {
    background-color: #2d3748;
    color: #c6cfda;
}

body[data-theme='dark'] #data-table td.grade-cell:active {
    background-color: #44566f;
}

body[data-theme='dark'] .cell-action-menu {
    border-color: #53647c;
    background: #263244;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
}

body[data-theme='dark'] .cell-action-menu-title {
    color: #d5deea;
    border-bottom-color: #3b4a60;
}

body[data-theme='dark'] .cell-action-menu button {
    color: #e3eaf3;
}

body[data-theme='dark'] .cell-action-menu button:hover,
body[data-theme='dark'] .cell-action-menu button:focus-visible {
    background: #35465e;
}

body[data-theme='dark'] #data-table tbody tr:not(.college-header-row):hover td {
    background-color: #3d4657 !important;
}

body[data-theme='dark'] .highlight-fail {
    color: #f86969;
}

body[data-theme='dark'] .tab-bar {
    background-color: #28303d;
    border-top-color: #4a5568;
}

body[data-theme='dark'] .tab-item a {
    color: #a0aec0;
}

body[data-theme='dark'] .tab-item a:hover, 
body[data-theme='dark'] .tab-item.active a {
    color: #63b3ed;
}



body[data-theme='dark'] .submenu button {
  background-color: #2e3746;
}



body[data-theme='dark'] #table-title {
    color: #f8d98b;
    background: #493b20;
    border-color: #80652d;
}

body[data-theme='dark'] #department-count {
    color: #94a3b8;
}

body[data-theme='dark'] .by-ali {
  color: #e1e1e1;
}


    /* تنسيق الاسم الكردي تحت القسم */
.kurdish-name {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif !important; /* خط مخصص للكوردي */
    text-rendering: optimizeLegibility !important; /* إجبار المتصفح على معالجة ترابط الحروف */
    display: block; /* لضمان نزوله في سطر جديد مرتب */
    font-size: 11px; /* خط أصغر */
    color: #71717a; /* لون رمادي خفيف */
    margin-top: 3px; /* مسافة بسيطة بين الاسمين */
}

/* تنسيق الاسم الكردي في الوضع الليلي (Dark Mode) */
body[data-theme='dark'] .kurdish-name {
    color: #a1a1aa; /* لون رمادي فاتح ليناسب الخلفية الغامقة */
}

/* ========================================= */
/* == تنسيقات الأدوات الجديدة (المدن والإعدادات) == */
/* ========================================= */

.settings-box {
    background: #fdfdfd;
    padding: 15px;
    border-radius: 8px;
    direction: rtl;
    text-align: right;
    border: 1.5px solid #a1a8b3;
}

.settings-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-style: dashed;
    background: #f7fbfef1;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item label {
    margin: 0;
    font-size: 14px;
    color: #374151;
}

/* زر التبديل (Toggle Switch) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s ease;
}
.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s ease;
}
.toggle-switch input:checked + .slider {
    background-color: #346cc6;
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
}
.toggle-switch .slider.round {
    border-radius: 24px;
}
.toggle-switch .slider.round:before {
    border-radius: 50%;
}

/* صف عنوان المحافظة داخل الجدول */
.city-header-cell {
    background: #f8fafc !important;
    color: #2f5fa8 !important;
    font-weight: 700;
    font-size: 14px !important;
    text-align: right;
    padding: 12px 16px !important;
}

/* التنسيق للأسماء الكردية */
.kurdish-name {
    display: inline-block;
    color: #71717a;
    margin-top: 2px;
}

/* ========================================= */
/* == دعم الوضع الليلي (Dark Mode) للأدوات == */
/* ========================================= */

body[data-theme='dark'] .settings-box {
    background-color: #2d3748;
    border-color: #4a5568;
}
body[data-theme='dark'] .setting-item label {
    color: #e2e8f0;
}
body[data-theme='dark'] .kurdish-name {
    color: #a1a1aa;
}
body[data-theme='dark'] .city-header-cell {
     background-color: #202a38b0 !important;
    color: #4299e1 !important;
}

/* ========================================= */
/* == إصلاح خلية الجدول والـ Tooltip الكردي == */
/* ========================================= */



/* ========================================= */
/* == إصلاح خلية الجدول والـ Tooltip الكردي == */
/* ========================================= */

#data-table td {
    position: relative;
}

#data-table td.dept-cell {
    position: relative;
    cursor: pointer;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.kurdish-name {
    display: inline-block;
    color: #71717a;
    margin-top: 2px;
}

body.hide-kurdish .ku-br {
    display: none !important;
}

body.hide-kurdish .kurdish-name {
    display: none;
}

/* ========================================= */
/* == Tooltip الكردي - سطر واحد وتعديل الحواف == */
/* ========================================= */

body.hide-kurdish .dept-cell:hover .kurdish-name,
body.hide-kurdish .dept-cell:focus .kurdish-name,
body.hide-kurdish .dept-cell:focus-within .kurdish-name,
body.hide-kurdish .dept-cell:active .kurdish-name,
body.hide-kurdish .dept-cell.active-tooltip .kurdish-name {
    display: block !important;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;

    background: linear-gradient(135deg, #1e5aaf, #346cc6);
    color: #ffffff;
    font-size: 12px !important;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    
    /* Force single line text */
    white-space: nowrap;
    max-width: min(420px, calc(100vw - 16px));
    box-sizing: border-box;
    
    z-index: 99999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    pointer-events: none;

    opacity: 0;
    transform: translateX(calc(-50% + var(--shift-x, 0px))) translateY(6px);
    animation: kurdishTooltipShow 0.2s ease forwards;
}

@keyframes kurdishTooltipShow {
    from {
        opacity: 0;
        transform: translateX(calc(-50% + var(--shift-x, 0px))) translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateX(calc(-50% + var(--shift-x, 0px))) translateY(0);
    }
}

/* السهم السفلي للـ Tooltip مع المحافظة على الإشارة إلى المنتصف */
body.hide-kurdish .dept-cell:hover .kurdish-name::after,
body.hide-kurdish .dept-cell:focus .kurdish-name::after,
body.hide-kurdish .dept-cell:focus-within .kurdish-name::after,
body.hide-kurdish .dept-cell:active .kurdish-name::after,
body.hide-kurdish .dept-cell.active-tooltip .kurdish-name::after {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(50% - var(--shift-x, 0px));
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #203d81 transparent transparent transparent;
}

/* التنسيق في الوضع الليلي Dark Mode */
body[data-theme='dark'].hide-kurdish .dept-cell:hover .kurdish-name,
body[data-theme='dark'].hide-kurdish .dept-cell:focus .kurdish-name,
body[data-theme='dark'].hide-kurdish .dept-cell:focus-within .kurdish-name,
body[data-theme='dark'].hide-kurdish .dept-cell:active .kurdish-name,
body[data-theme='dark'].hide-kurdish .dept-cell.active-tooltip .kurdish-name {
    background-color: #f8fafc;
   
}

body[data-theme='dark'].hide-kurdish .dept-cell:hover .kurdish-name::after,
body[data-theme='dark'].hide-kurdish .dept-cell:focus .kurdish-name::after,
body[data-theme='dark'].hide-kurdish .dept-cell:focus-within .kurdish-name::after,
body[data-theme='dark'].hide-kurdish .dept-cell:active .kurdish-name::after,
body[data-theme='dark'].hide-kurdish .dept-cell.active-tooltip .kurdish-name::after {
    border-color: #447bc2 transparent transparent transparent;
}

/* ========================================= */
/* == التوضيح المنبثق لزر الأسماء الكوردية == */
/* ========================================= */
/* ========================================= */
/* == التوضيح المنبثق لزر الأسماء الكوردية == */
/* ========================================= */
.toggle-hint-tooltip {
    position: absolute;
    bottom: calc(100% + 10px); /* يظهر فوق الزر مباشرة */
    left: 0; /* يبدأ من حافة الزر اليسرى ويمتد لليمين */
    right: auto;
    background: linear-gradient(135deg, #1e5aaf, #346cc6);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(30, 90, 175, 0.3);
    text-align: right;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                visibility 0.3s;
    pointer-events: none;
    direction: rtl;
}

/* السهم السفلي يتجه نحو منتصف زر التبديل */
.toggle-hint-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 16px; /* محاذاة السهم فوق الزر مباشرة */
    border-width: 6px;
    border-style: solid;
    border-color: #346cc6 transparent transparent transparent;
}

/* حالة ظهور التوضيح عند التفعيل */
.toggle-hint-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* حركة أنيميشن لأيقونة المصباح */
.toggle-hint-tooltip .hint-icon {
    display: inline-block;
    margin-left: 4px;
    animation: hintBounce 1.5s infinite;
}

@keyframes hintBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* دعم الوضع الليلي (Dark Mode) */
body[data-theme='dark'] .toggle-hint-tooltip {
    background: linear-gradient(135deg, #2b6cb0, #1e3a8a);
    color: #f1f5f9;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

body[data-theme='dark'] .toggle-hint-tooltip::after {
    border-color: #1e3a8a transparent transparent transparent;
}

/* تجاوب الشاشات الصغيرة */
@media (max-width: 480px) {
    .toggle-hint-tooltip {
        font-size: 11px;
        padding: 6px 10px;
    }
}


/* ========================================= */
/* == بوكس البحث العائم الشفاف عند التمرير == */
/* ========================================= */
.floating-search-container {
    position: fixed;
    bottom: calc(75px + var(--keyboard-offset, 0px));
    left: 12px;
    z-index: 999;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.55); /* شفافية أكبر */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(162, 175, 190, 0.207);
    border-radius: 25px;
    padding: 5px 5px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s, left 0.35s ease;
    direction: rtl;
    isolation: isolate;
}

/* حالة ظهور الصندوق عند التمرير للأسفل */
.floating-search-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-search-container.visible.at-page-end {
    opacity: 1;
}

/* زر التثبيت / الطي الجانبي (أصغر وأكثر شفافية) */
.floating-toggle-btn {
    background: rgba(52, 108, 198, 0.85); /* شفاف قليلاً */
    color: #ffffff;
    border: none;
    width: 32px; /* تصغير الحجم */
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(52, 108, 198, 0.25);
    transition: background-color 0.2s, transform 0.2s;
}

.floating-toggle-btn:hover {
    background-color: rgba(37, 99, 235, 0.95);
    transform: scale(1.05);
}

/* محتوى إدخال البحث */
.floating-search-body {
    display: flex;
    align-items: center;
    padding: 0 6px;
    overflow: hidden;
    max-width: 150px; /* العرض أصغر */
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease, opacity 0.3s ease;
}

.search-inner-icon {
    color: #64748b;
    font-size: 11px;
    margin-left: 6px;
}

.floating-search-body input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    font-family: 'Tajawal', sans-serif;
    font-size: 12px; /* خط أصغر */
    color: #1e293b;
    width: 105px; /* تصغير حقل الكتابة */
    padding: 4px 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.floating-search-body input::placeholder {
    color: #94a3b8;
}

.clear-floating-search {
    color: #5b6474;
    cursor: pointer;
    font-size: 12px;
    padding: 9px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.clear-floating-search:hover,
.clear-floating-search:focus-visible {
    color: #97a2b6;
    outline: none;
   
}

body[data-theme='dark'] .clear-floating-search {
       color: #9ca3af;

}

body[data-theme='dark'] .clear-floating-search:hover,
body[data-theme='dark'] .clear-floating-search:focus-visible {
    color: #bdc6d6;
}

.department-suggestion {
    position: absolute;
    top: auto;
    bottom: calc(100% + 8px);
    inset-block-start: auto;
    left: 0;
    width: fit-content;
    max-width: min(210px, calc(100vw - 16px));
    box-sizing: border-box;
    padding: 6px 9px;
    border: 1px solid rgba(71, 85, 105, 0.25);
    border-radius: 8px;
    background: rgba(241, 245, 249, 0.97);
    color: #364150;
    cursor: pointer;
    font: 500 11px 'Tajawal', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
    text-align: right;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.department-suggestion:hover,
.department-suggestion:focus-visible {
    background: #e8edf3;
    outline: 2px solid rgba(71, 85, 105, 0.12);
}

body[data-theme='dark'] .department-suggestion {
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(100, 116, 139, 0.35);
    color: #c3cfdc;
}

/* حالة طي/إخفاء البوكس إلى الزر الجانبي فقط */
.floating-search-container.collapsed .floating-search-body {
    max-width: 0;
    padding: 0;
    opacity: 0;
}

.floating-search-container.collapsed .clear-floating-search {
    display: none;
}

.floating-search-container.collapsed .department-suggestion {
    display: none;
}

/* لون الزر عند الطي */
.floating-search-container.collapsed .floating-toggle-btn {
    background: rgba(21, 63, 131, 0.75);
}

/* 🌙 دعم الوضع الليلي (Dark Mode) بشفافية أعلى */
body[data-theme='dark'] .floating-search-container {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(81, 100, 127, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

body[data-theme='dark'] .floating-search-body input {
    color: #f1f5f9;
}

body[data-theme='dark'] .search-inner-icon {
    color: #94a3b8;
}

body[data-theme='dark'] .floating-search-container.collapsed .floating-toggle-btn {
    background: rgba(37, 83, 156, 0.85);
     color: #cad8e9;
}

/* شاشات الهواتف الصغرى */
@media (max-width: 480px) {
    .floating-search-container {
        bottom: calc(72px + var(--keyboard-offset, 0px));
        left: 8px;
    }
    .floating-search-body {
        max-width: 125px;
    }
    .floating-search-body input {
        width: 85px;
    }

    .setting-item input[type="range"] {
        width: 78px;
    }
}

@media (max-width: 600px) {
    .chip-checkbox {
        display: inline-flex;
       
        overflow: hidden;
    }

    .chip-text {
        font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
      
    }
}


/* ========================================= */
/* == إطار تنبيه باللون الأحمر عند الخطأ == */
/* ========================================= */

/* بوكس البحث العائم عند عدم وجود نتائج */
.floating-search-container.search-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

/* دعم الوضع الليلي لتنبيه الخطأ */
body[data-theme='dark'] .floating-search-container.search-error {
    border-color: #f87171bf !important;
}
/* ========================================= */
/* == تنسيقات Chips لاختيار المحافظات == */
/* ========================================= */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
    justify-content: center;
    gap: 8px;
    margin: 0 0 10px;
}

.chip-checkbox {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.chip-checkbox input[type="checkbox"] {
    display: none; /* إخفاء مربع الاختيار التقليدي */
}

.chip-text {
    display: inline-block;
    padding: 7px 15px;
    border-radius: 16px;
    background-color: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    
    font-weight: 500;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}

.chip-checkbox input[type="checkbox"]:checked + .chip-text {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    border-color: #2563eb;
}

/* الوضع الليلي للـ Chips */
body[data-theme='dark'] .chip-text {
    background-color: #334155;
    color: #94a3b8;
    border-color: #475569;
}
body[data-theme='dark'] .chip-checkbox input[type="checkbox"]:checked + .chip-text {
    background: linear-gradient(135deg, #1f5d9c, #124892);
    color: #c3dcf2;
    border-color: #2b628f;
    box-shadow: 0 2px 6px rgba(20, 70, 110, 0.35);
}
/* ========================================= */
/* == تنسيق حقل المعدل المصغر في الإعدادات == */
/* ========================================= */
.grade-setting {
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

.small-grade-input {
    width: 112px !important;
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    text-align: center !important;
    border-radius: 8px !important;
    margin-bottom: 0 !important;
    border: 1px solid #b9c7d8 !important;
    background: #fbfdfe !important;
    color: #334155 !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.small-grade-input:focus {
    outline: none !important;
    border-color: #346cc6 !important;
    box-shadow: 0 0 0 3px rgba(52, 108, 198, 0.14);
}

body[data-theme='dark'] .grade-setting {
    border-top-color: #475569;
}

body[data-theme='dark'] .small-grade-input {
    background: #344155 !important;
    border-color: #52627a !important;
    color: #f1f5f9 !important;
}

@media (hover: none) and (pointer: coarse) {

    /* لا تسمح للـ hover/focus/active بإظهار Tooltip قديم */
    body.hide-kurdish .dept-cell:not(.active-tooltip):hover .kurdish-name,
    body.hide-kurdish .dept-cell:not(.active-tooltip):focus .kurdish-name,
    body.hide-kurdish .dept-cell:not(.active-tooltip):focus-within .kurdish-name,
    body.hide-kurdish .dept-cell:not(.active-tooltip):active .kurdish-name {
        display: none !important;
    }

}

/* ========================================= */
/* == تصغير قائمة الإجراءات Context Menu على الجوال == */
/* ========================================= */
@media (max-width: 600px) {
    .cell-action-menu {
        width: min(200px, calc(100vw - 16px)); /* تصغير العرض */
        padding: 5px; /* تقليل الحواف الداخلية */
    }
    
    .cell-action-menu button {
        font-size: 12px; /* تصغير الخط */
        min-height: 38px; /* تقليل الارتفاع */
        padding: 6px 8px;
        gap: 7px; /* تقليل المسافة بين الأيقونة والنص */
    }
    
    .cell-action-menu-title {
        font-size: 11px; /* تصغير عنوان القسم */
        padding: 5px 8px 6px;
    }
}

/* ========================================= */
/* == خط تمييز معدل الزانكولاين (المفضلة) == */
/* ========================================= */
.fav-zankoline-underline {
    position: relative;
    display: inline-block;
}

.fav-zankoline-underline::after {
    content: "★";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #facc15;
    line-height: 1;
}

body[data-theme='dark'] .fav-zankoline-underline::after {
    color: #eab308;
}
/* ========================================= */
/* == تصميم إشعار Toast أنيق == */
/* ========================================= */

.toast-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);

    background: rgba(35, 38, 45, 0.96);
    color: #ffffff;

    padding: 13px 25px;
    border-radius: 14px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;

    text-align: center;
    direction: rtl;

    max-width: calc(100% - 40px);
    width: max-content;
    box-sizing: border-box;

    z-index: 10000;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

/* إظهار الإشعار */

.toast-notification.show {
    opacity: 1;
    visibility: visible;

    transform: translate(-50%, -50%) scale(1);
}

/* الوضع الليلي */

body[data-theme='dark'] .toast-notification {
    background: rgba(45, 50, 62, 0.97);
    color: #f8fafc;

    border: 1px solid rgba(255, 255, 255, 0.07);

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}
.golden-favorite-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #FFD700, #f5be0b);
    color: #292524;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
    z-index: 9999;
    pointer-events: none;
        transform: translateY(40%);
    opacity: 0;
    animation: popIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

/* السهم */
.golden-favorite-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #f5b70b transparent transparent transparent;
}

/* حركة الظهور */
@keyframes popIn {
    from {
        opacity: 0;
        margin-top: 8px;
    }
    to {
        opacity: 1;
        margin-top: 0;
    }
}

/* الاختفاء */
.golden-favorite-tooltip.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#show-favorite-departments span {
   font-weight: 500;
}

/* ========================================= */
/* == نافذة فلاتر الكليات (iOS Bottom Sheet - حجم مصغّر) == */
/* ========================================= */

.filters-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                visibility 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    direction: rtl;
}

.filters-modal.show {
    opacity: 1;
    visibility: visible;
}

.filters-modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    max-height: 70vh; /* تم تقليل الارتفاع من 86vh إلى 60vh حتى لا تأخذ طول الشاشة */
    border-radius: 20px 20px 0 0; /* تصغير الانحناء العلوي */
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    position: relative;
    overflow: hidden;
}

/* مقبض السحب (Grabber) بحجم أصغر */
.filters-modal-content::before {
    content: '';
    display: block;
    width: 32px;
    height: 4px;
    background-color: #cbd5e1;
    border-radius: 10px;
    margin: 8px auto 2px;
    flex-shrink: 0;
}

.filters-modal.show .filters-modal-content {
    transform: translateY(0);
}

.filters-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px 10px; /* تقليل المسافات */
    border-bottom: 1px solid #f1f5f9;
}

.filters-modal-header h3 {
    margin: 1;
    color: #1e293b;
    font-size: 14px; /* خط أصغر */
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filters-modal-header h3 i {
    color: #3b82f6;
     padding: 4px; 
}

.close-btn {
    background: #f1f5f9;
    border: none;
    width: 26px;
    font-family: Arial, Helvetica, sans-serif !important;
    height: 26px;
    border-radius: 50%;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:active {
    transform: scale(0.92);
    background-color: #e2e8f0;
}

.filters-modal-body {
    padding: 10px 12px; /* تقليل الحواف الداخلية */
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
}

/* كروت الكليات والبطاقات الداخلية بالحجم المصغّر */
.filter-category {
    margin-bottom: 8px; /* تقليل المسافة بين الأقسام */
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.category-header {
    background: #f8fafc;
    padding: 10px 12px; /* ضغط ارتفاع العنوان */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.category-header:active {
    background: #f1f5f9;
}

.category-header span {
    font-weight: 600;
    color: #334155;
    font-size: 13px; /* خط أصغر */
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-colleges {
    display: none;
    padding: 4px 12px 8px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.category-colleges.open {
    display: block;
    animation: fadeInSheet 0.2s ease-out;
}

@keyframes fadeInSheet {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

.college-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0; /* تقليل المسافة العمودية */
    border-bottom: 1px dashed #f1f5f9;
}

.college-item:last-child {
    border-bottom: none;
}

.college-item span {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}

/* شريط الأزرار السفلية بمساحة مضغوطة */
.filters-modal-footer {
    padding: 10px 14px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
}

.apply-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    padding: 9px;
    border-radius: 10px;
    cursor: pointer;
    flex-grow: 1;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.apply-btn:active {
    transform: scale(0.98);
}



.clear-btn:active {
    transform: scale(0.98);
    background: #e2e8f0;
}

/* الشاشات اللوحية والكمبيوتر */
@media (min-width: 640px) {
    .filters-modal {
        align-items: center;
    }
    
    .filters-modal-content {
        border-radius: 18px;
        max-height: 70vh;
        transform: translateY(15px) scale(0.96);
    }
    
    .filters-modal.show .filters-modal-content {
        transform: translateY(0) scale(1);
    }
}

/* ========================================= */
/* == الوضع الليلي Dark Mode المصغر == */
/* ========================================= */
body[data-theme='dark'] .filters-modal-content {
    background: #1e293b;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

body[data-theme='dark'] .filters-modal-content::before {
    background-color: #475569;
}

body[data-theme='dark'] .filters-modal-header {
    border-bottom-color: #334155;
}

body[data-theme='dark'] .filters-modal-header h3 {
    color: #f8fafc;
}

body[data-theme='dark'] .close-btn {
    background: #334155;
    color: #94a3b8;
}

body[data-theme='dark'] .close-btn:active {
    background: #475569;
    color: #ffffff;
}

body[data-theme='dark'] .filter-category {
    background: #0f172a;
    border-color: #334155;
}

body[data-theme='dark'] .category-header {
    background: #1e293b;
}

body[data-theme='dark'] .category-header:active {
    background: #334155;
}

body[data-theme='dark'] .category-header span {
    color: #f1f5f9;
}

body[data-theme='dark'] .category-colleges {
    background: #0f172a;
    border-top-color: #1e293b;
}

body[data-theme='dark'] .college-item {
    border-bottom-color: #1e293b;
}

body[data-theme='dark'] .college-item span {
    color: #cbd5e1;
}

body[data-theme='dark'] .filters-modal-footer {
    background: rgba(30, 41, 59, 0.95);
    border-top-color: #334155;
}

body[data-theme='dark'] .clear-btn {
    background: #334155;
    color: #cbd5e1;
}

body[data-theme='dark'] .clear-btn:active {
    background: #475569;
}

.filters-hint {
    margin: 2px 0 0;
    font-size: 13px;
    color: #4e5460;
}

body[data-theme='dark'] .filters-hint {
   color: #cbd5e1;
}

/* ========================================= */
/* == Tooltip التحذيري لإدخال المعدل == */
/* ========================================= */
.grade-warning-tooltip {
    position: absolute;
    bottom: calc(100% + 8px); 
    left: 15px; /* يظهر فوق مربع الإدخال على اليسار */
    background: linear-gradient(135deg, #ef4444, #b91c1c); /* تدرج أحمر جذاب */
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.089);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                visibility 0.3s;
    z-index: 1005;
    pointer-events: none;
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grade-warning-tooltip i {
    font-size: 12px;
}

.grade-warning-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border-width: 6px;
    border-style: solid;
    border-color: #b91c1c transparent transparent transparent;
}

.grade-warning-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* دعم التنبيه في الوضع الليلي */
body[data-theme='dark'] .grade-warning-tooltip {
    background: linear-gradient(135deg, #c54848, #c21f1f);
    box-shadow: 0 6px 16px rgba(248, 113, 113, 0.14);
}

body[data-theme='dark'] .grade-warning-tooltip::after {
    border-color: #dc2626 transparent transparent transparent;
}

.city-header-cell i {
    margin-left: 6px;
}



.phone {
  height: 50px;
  width: 100px;
  border: 3px solid white;
  border-radius: 10px;
  animation: rotate 1.5s ease-in-out infinite alternate;
  /* display: none; */
}

.message {
  color: white;
  font-size: 1em;
  margin-top: 40px;
  /* display: none; */
}

@keyframes rotate {
  0% {
		transform: rotate(0deg)
	}
	50% {
		transform: rotate(-90deg)
	}
	100% {
		transform: rotate(-90deg)
	}
}



@media only screen and (max-device-width: 812px) and (orientation: landscape) {
  .phone, .message {
    display: block;
  }
}





#custom-display-container {
    position: fixed; /* يجعل الحاوية تطفو فوق الشاشة */
    top: 0;
    left: 0;
    width: 100vw; /* عرض الشاشة بالكامل */
    height: 100vh; /* طول الشاشة بالكامل */
    background-color: #080b11d1; /* لون الخلفية */
    z-index: 99999; /* يضمن ظهورها فوق جميع العناصر الأخرى (الهيدر، الفوتر، الخ) */
    
    /* توسيط المحتوى داخل النافذة */
    display: none; /* يتم التحكم به عبر الجافاسكربت */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    padding: 20px;
    margin: 0;
    box-sizing: border-box;
}

/* تنسيق حاوية الجدول بداخل النافذة */
.rates-table-wrapper.protected-content {
    width: 100%;
    flex: 1;
    min-height: 0;
    max-width: none;
    max-height: none;
    overflow: auto;
    background-color: transparent;
}

#phone-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    text-align: center;
}

/* إطار الهاتف */
.phone {
    position: relative;
    width: 64px;
    height: 112px;
    border: 1px solid #ffffff;
    border-radius: 13px;
    box-sizing: border-box;
    background: linear-gradient(145deg, #0e141c, #0d131f);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 8px 25px rgba(0, 0, 0, 0.3);
    animation: rotate 1.5s ease-in-out infinite alternate;
}

/* الكاميرا الأمامية */
.phone::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8baccb;
    border: 2px solid #ffffff;
    box-sizing: border-box;
}

/* زر الهاتف السفلي */
.phone::after {
    content: "";
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 3px;
    border-radius: 5px;
    background: #ffffff;
    opacity: 0.9;
}

/* رسالة التوجيه */
.message {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.8;
    margin: 0;
    text-align: center;
}

/* حركة تدوير الهاتف */
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(90deg);
    }
}







/* حاوية الجدول */
.rates-table-wrapper {
    width: 100%;
    max-height: 75vh;
    overflow: auto;
    background: #151e2d;
    border: 1px solid #344052;
    direction: ltr;
    -webkit-overflow-scrolling: touch;
}

/* الجدول */
.rates-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #f4f7fb;
}

/* الخلايا */
.rates-table th,
.rates-table td {
    height: 30px;
    padding: 4px 8px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid #344052;
    border-bottom: 1px solid #344052;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* تثبيت صف العناوين */
.rates-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #102a43;
    color: #ffffff;
    font-weight: 800;
    height: 39px;
}

/* ألوان العناوين */
.rates-table th.online-col {
    background: #102a43;
}

.rates-table th.parallel-col {
    background: #08652f;
}

.rates-table th.evening-col {
    background: #50123e;
}

/* ألوان الصفوف بالتناوب */
.rates-table tbody tr:nth-child(odd) td {
    background: #202b3a;
}

.rates-table tbody tr:nth-child(even) td {
    background: #141e2d;
}

/* النصوص العربية والكردية */
.rates-table td:nth-child(2),
.rates-table td:nth-child(3),
.rates-table td:nth-child(4),
.rates-table td:nth-child(5) {
    direction: rtl;
    unicode-bidi: isolate;
}

/* درجات القبول */
.rates-table .rate-online,
.rates-table .rate-parallel,
.rates-table .rate-evening {
    font-weight: 700;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

/* عرض الأعمدة بنفس ترتيب الصورة */
.rates-table .city-col {
    width: 7.7%;
}

.rates-table .university-col {
    width: 15.3%;
}

.rates-table .college-col {
    width: 16.8%;
}

.rates-table .department-ku-col {
    width: 22.5%;
}

.rates-table .department-ar-col {
    width: 19.6%;
}

.rates-table .online-col {
    width: 5.8%;
}

.rates-table .parallel-col {
    width: 5.7%;
}

.rates-table .evening-col {
    width: 5.6%;
}

/* شريط تمرير متناسق */
.rates-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.rates-table-wrapper::-webkit-scrollbar-track {
    background: #141e2d;
}

.rates-table-wrapper::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 8px;
}

/* الجوال */
@media (max-width: 768px) {
    .rates-table-wrapper {
        max-height: 80vh;
    }

    .rates-table {
        min-width: 1000px;
        font-size: 13px;
    }

    .rates-table th,
    .rates-table td {
        padding: 4px 6px;
    }
}


/* ==================================
   حماية محتوى الموقع من النسخ
   ================================== */

/* منع تحديد النص والصور */
.protected-content,
.protected-content * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;

    -webkit-touch-callout: none;
}

/* منع سحب الصور */
.protected-content img {
    -webkit-user-drag: none;
    pointer-events: auto;
}

/* منع القائمة الناتجة عن الضغط بالزر الأيمن */
.protected-content {
    -webkit-tap-highlight-color: transparent;
}

#custom-display-container {
 background-color: rgba(5, 7, 11, 0.652);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);    border-radius: 8px;
    height: 100dvh;
    padding: 2px;
    margin: 0;
}

#phone-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* تعديل الهاتف ليكون متناسقاً في المنتصف */
.phone {
    height: 50px;
    width: 100px;
    border: 3px solid white;
    border-radius: 10px;
    animation: rotate 1.5s ease-in-out infinite alternate;
    margin: 0 auto;
}

.message {
    color: white;
    font-size: 1em;
    margin-top: 40px;
    text-align: center;
}


/* إصلاح ظهور المعدلات كاملة */
.rates-table td.rate-online,
.rates-table td.rate-parallel,
.rates-table td.rate-evening {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 12px;
    padding-left: 2px;
    padding-right: 2px;
    letter-spacing: -0.3px;
}

/* منع اختصار الأرقام في عناوين أعمدة المعدلات */
.rates-table th.online-col,
.rates-table th.parallel-col,
.rates-table th.evening-col {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    padding-left: 2px;
    padding-right: 2px;
}

/* توسيع أعمدة المعدلات قليلاً */
.rates-table .online-col {
    width: 6.5%;
}

.rates-table .parallel-col {
    width: 6.5%;
}

.rates-table .evening-col {
    width: 6.5%;
}


/* تغيير لون الصف بالكامل عند تمرير الماوس */
.rates-table tbody tr:hover td {
    background: #334b66 !important;
    transition: background 0.15s ease;
}

/* إبراز الصف عند تحديده باللمس */
@media (hover: none) {
    .rates-table tbody tr:active td {
        background: #334b66 !important;
    }
}

#close-custom-display {
    position: absolute;
   bottom: 18px;
right: 18px;
top: auto;
    background-color: rgba(0, 0, 0, 0.719);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: rgb(253, 112, 112);
    border: 2px solid rgb(246, 105, 105);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000; /* لضمان ظهوره فوق كل شيء داخل النافذة */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}

#close-custom-display:hover {
    background-color: #ff4d4d; /* لون أحمر عند التمرير أو اللمس */
    color: white;
    border-color: #ff4d4d;
}