* { padding: 0; margin: 0; }
body { font-family: Arial, sans-serif; margin: 0px; }

/* في ملف CSS الخاص بك */
#games-table {
    content-visibility: auto; 
    contain-intrinsic-size: 1000px; /* تقدير ارتفاع الجدول غير المرئي */
}

body {
  font-family: Arial, sans-serif;
  margin: 0;   
  padding: 0;
  
    background-image: url('wall2.png');
  background-repeat: repeat;
  background-size: auto;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: white;
  opacity: 0.96;
  pointer-events: none;
  z-index: -1;
}
.logz {
  display: flex;
  justify-content: center; 
  align-items: center;     
  gap: 10px;               
  margin-bottom: 0px; 
}

.logz img {
  width: 100px;
  margin: 0;
}
#scrollTopBtn {
    position: fixed;
    bottom: 20px;
    left: 20px; /* بدل right: 20px */
    display: none;       /* يظهر فقط عند نهاية الصفحة */
    padding: 10px 15px;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    background-color: #144B5E;
    color: white;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: background-color 0.2s;
}

#scrollTopBtn:hover {
    background-color: #0d3a66;
}

/* شبكة الكروت */
.recent-container{
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 10px;
  margin: 20px auto;
  max-width: 95%;
}
.xclear{
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 10px;
  margin: 20px auto;
  max-width: 95%;
}

#mini-cart-badge {
  position: absolute;
  top: -25px;
  right: -5px;
  background: #6eb9ffe0;
  color: rgb(0, 0, 0);
  font-weight: bold;
  padding: 15px 0px;
  border-radius: 50%;
  font-size: 14px;
  text-align: center;
  font-family: "Sansation", sans-serif;
}
.game-card {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-family: 'Almarai', sans-serif;
  overflow: hidden;
}

.game-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 5px;
}

.game-card h3 {
  font-size: 14px;
  margin: 5px 0;
  height: 35px;
  overflow: visible;
}
img {
    -webkit-touch-callout: none; /* Safari iOS */
    -webkit-user-select: none;   /* Safari */
    -khtml-user-select: none;    
    -moz-user-select: none;      /* Firefox */
    -ms-user-select: none;       
    user-select: none;           
}
.game-card p {
  font-size: 18px;
  color: #444;
  margin-top: 30px;
}

.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
}

.game-card .remove-btn {
  background-color: #dc3545; /* لون خلفية أحمر */
  color: #fff; /* لون الخط أبيض */
  border: none;
  border-radius: 5px;
  padding: 3px 0px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
  width: 100%; /* لجعله يأخذ نصف مساحة البطاقة */
  margin-left: 5px; /* لإضافة مسافة بينه وبين زر "إضافة للسلة" */
  text-align: center;
}

.game-card .remove-btn:hover {
  background-color: #c82333; /* لون أغمق عند مرور الماوس */
}

.game-card button {
  background: #51b1ff;
  color: #fff;
  padding: 5px 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Almarai', sans-serif;
}

.game-card button:hover {
  background: #05517e;
}
.logz h1 {
  font-size: 32px;
  font-weight: bold;
  color: #0f94d7;
  background: #e6f2ff;
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  margin-bottom: 10px; 
  width: auto;    
  margin: 0;      
  text-align: center;
  font-family: "Bree Serif", serif;
}

.added-to-cart {
  background-color: #d3d3d3 !important; /* رمادي */
}

.cart-controls {
  display: none;
  margin-top: 5px;
  font-size: 14px;
}

#thumbnail-container {
  display:flex; justify-content:center; gap:5px; margin-bottom:5px;
}
.thumbnail {
  width: 600x;
  height: 600px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 5px;
  transition: transform 0.2s ease-in-out;
  margin: 0px; 
}
.thumbnail:hover { transform: scale(1.2); transition: all 1s ease;}

#hide-cart-btn {
  width: 100%; 
  display: block;
  background: #0f94d7;
  color: white;
  border: none;
  margin: 10px 0 0 0;
  border-radius: 5px;
  padding: 5px 0;
  font-size: 16px;
  font-family: 'Almarai', sans-serif;
  white-space: nowrap;       
  overflow: hidden;          
  text-overflow: ellipsis;   
  box-sizing: border-box;
}

.parent-search {
  display: flex; 
  justify-content: center;
  align-items: center; 
  width: 100%;
  margin-top: 20px; /* ممكن تزود مسافة من فوق */
  position: sticky;  /* تخلي العنصر ثابت عند scroll */
  top: 50px; /* المسافة من أعلى الصفحة قبل ما يبدأ الثبات */
  z-index: 9999; /* للتأكد إنه فوق كل العناصر */
}

/* الجزء الخاص بـ search-container */
#search-container {
  display: flex;
  gap: 5px;
  width: max-content;
}
#search-input { width: 300px; padding: 8px; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; }
#clear-btn { padding: 8px 12px; font-family: 'Almarai', sans-serif; font-size: 16px; border-radius: 5px; border: 1px solid #ccc; background-color: #ff4d4d; color: white; cursor: pointer; }
#clear-btn:hover { background-color: #e60000; }

.selected-row { background-color: #108ab65a; }

table { margin-top: 10px; font-family: "Sansation", sans-serif;
  font-weight: 300; width: 100%; border-collapse: collapse; text-align: center; font-size: 30px; }
th, td { border: 1px solid #ccc; padding: 10px; font-weight: bold; vertical-align: middle; }
th { background: #0f94d7; color: white; }
td[data-label="اسم اللعبة"] { text-align: center; }

.game-img { width: 190px; height: 190px; object-fit: contain; }

.cart {
  position: fixed;
  top: 10px;
  right: 180px;
  width: 320px;
  max-height: calc(100vh - 20px);
  max-width: 320px;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #108ab65a;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  overflow: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Almarai', sans-serif; 
}
.cart-logo { display: flex; justify-content: center; margin-bottom: 5px; }
.cart-logo img { display: block; }
.cart h3 { margin-top: 0; font-size: 18px; text-align:center; }
.cart-info { overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; display: block; background: #108ab65a; padding: 3px 6px; border-radius: 5px; font-weight: bold; margin-top: 5px; text-align: center; }
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(3 * 80px + 20px);
  overflow-y: auto;
  padding: 5px;
}
.cart-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  border: 1px solid #ccc;
  padding: 5px;
  border-radius: 5px;
  background: #f9f9f9;
}
.cart-list img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
td[data-label="اختيار"] {
    position: relative;
    text-align: center; /* لجعل المحتوى يتوسط الخلية أفقياً */
    vertical-align: middle; /* لجعل المحتوى يتوسط الخلية رأسياً */
}

td[data-label="اختيار"] label {
    display: inline-block; /* لجعل الـ label يأخذ فقط المساحة التي يحتاجها */
    padding: 10px 0%; /* لإضافة مساحة أكبر حول مربع الاختيار */
    cursor: pointer;
    user-select: none;
    position: relative; /* مهم لضمان عمله بشكل صحيح */
}
.cart-list div {
  display: flex;
  flex-direction: column;
  white-space: normal;
}
.cart-list span {
  font-weight: bold;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
}
.cart-list button {
  width: 200px; margin-top: 2px; padding: 3px 5px; font-size: 12px; background-color: #ff4d4d; border: none; color: white; font-weight: bold; border-radius: 5px; cursor:pointer;
}
.cart-list button:hover { background-color: #e60000; }
.copy-btn {
  margin-top: 10px; font-family: 'Almarai', sans-serif; padding: 5px 10px; cursor: pointer; background: #1f76a1; color: white; border: none; width: 100%; font-weight: bold; font-size: 16px; border-radius: 5px;
}

#imageModal {
  display: none; position: fixed; z-index: 2000; padding-top: 60px; left: 0; top: 0;
  width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.8);
  z-index: 10000000000;
}
#imageModal img { margin:auto; display:block; max-width:90%; max-height:80%; transition: transform 0.3s ease-in-out; }
#imageModal .modal-close { position:absolute; top:15px; right:35px; color:#fff; font-size:40px; font-weight:bold; cursor:pointer; }
#imageModal .prev, #imageModal .next {
  position: absolute; top:50%; color:white; font-size:50px; font-weight:bold; cursor:pointer;
  user-select:none; padding:0 12px; transform:translateY(-50%);
}
#imageModal .prev { left:10px; }
#imageModal .next { right:10px; }

/* حاوية الأزرار */
#grid1-buttons,
#grid2-buttons {
    display: flex;
    justify-content: center; /* يخليهم في النص أفقياً */
    gap: 10px;              /* مسافة بين الزرار */
    margin: 20px 0;         /* مسافة فوق وتحت */
}

/* حاوية الأزرار تتوضع على يمين الصفحة */
#grid1-buttons,
#grid2-buttons {
    display: flex;
    justify-content: center; /* يحرك المحتوى لليمين */
    gap: 10px; /* مسافة بين الزرار */
    margin: 10px 0; /* مسافة بسيطة فوق وتحت */
}

/* تنسيق الزرار */
#grid1-buttons button,
#grid2-buttons button {
    padding: 10px 10px;
    font-size: 12px;
    font-weight: bold;
    background-color: #4a84c7a4; /* أزرق جميل */
    color: rgb(255, 255, 255);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    font-family: 'Almarai', sans-serif;
}

/* تأثير عند المرور بالفأرة */
#grid1-buttons button:hover,
#grid2-buttons button:hover {
    background-color: #173d49; /* أزرق أغمق */
    transform: scale(1.10);
}

/* زرار الرجوع يظهر/يختفي */
#grid1-buttons button.back-btn,
#grid2-buttons button.back-btn {
    background-color: #FF4D4D; /* أحمر للرجوع */
}

/* إضافي: إذا حبيت تخلي الزرار ثابت في النص عند الهواتف */
@media screen and (max-width: 768px) {
    #grid1-buttons,
    #grid2-buttons {
        flex-direction: row;
        gap: 8px;
        justify-content: center; /* يبقى دائمًا في يمين الصفحة */
    }
}
#alpha-filter {
    display: flex;
    justify-content: center; /* في وسط الصفحة */
    flex-wrap: wrap;
    margin: 20px 0;
    gap: 5px; /* مسافة بين الحروف */
}

#alpha-filter .alpha-btn {
    padding: 8px 12px;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #1c55979c;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

#alpha-filter .alpha-btn:hover {
    background-color: #2b89c7;
    transform: scale(1.1);
}

#alpha-filter .alpha-btn.active {
    background-color: #144B5E;
    color: white;
    border-color: #0D4EA1;
    transform: scale(1.1);
}

/* Media Queries */
@media screen and (max-width: 1024px) {
  .logz h1 {
    font-size: 28px;
    font-weight: bold;
    color: #0f94d7;
    background: #e6f2ff;
    padding: 5px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    width: auto;
    margin: 0;
    text-align: center;
  }
  
  #hide-cart-btn {
    width: 100%; 
    display: block;
    background: #0f94d7;
    color: white;
    border: none;
    margin: 10px 0 0 0;
    border-radius: 5px;
    padding: 5px 0;
    font-size: 16px;
    font-family: 'Almarai', sans-serif;
    white-space: nowrap;       
    overflow: hidden;          
    text-overflow: ellipsis;   
    box-sizing: border-box;
  }
  #alpha-filter {
    display: grid;
    grid-template-columns: repeat(14, auto); /* 14 حرف في كل صف */
    justify-content: center; /* تمركز الصفوف */
    gap: 4px;
    padding: 10px 0;
}

#alpha-filter .alpha-btn {
    font-size: 10px;       /* حجم أصغر */
    padding: 5px 6px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: #1c55979c;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

#alpha-filter .alpha-btn.active {
    background-color: #144B5E;
    color: #fff;
}
  #cart-icon {
    display: none;
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: #8d8f0a54;
    color: white;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1100;
    justify-content: center;
    align-items: center;
  }
  table {
    table-layout: auto !important;
    width: 100% !important;
    font-size: 14px;
  }
  #mini-cart {
    display: none;
    position: fixed;
    bottom: 10px;
    right: 85px !important;
    cursor: pointer;
    z-index: 1100;
    justify-content: center;
    align-items: center;
    opacity:0.95;
  }
  #mini-cart img {
    display: block;
  }
  #mini-cart-badge {
    position: absolute;
    top: -18px;
    right:-10px;
    background: #6eb9ffe0;
    color: rgb(0, 0, 0);
    font-weight: bold;
    padding: 10px 0px;
    border-radius: 50%;
    font-size: 13px;
    text-align: center;
    font-family: "Sansation", sans-serif;
    width: 60px !important;
    height: 15px !important;
  }
  .cart {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    display: flex ;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 1000 !important;
  }
  th, td {
    padding: 6px 4px !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center;
  }
  td[data-label="اسم اللعبة"], th[data-label="اسم اللعبة"] {
    min-width: 120px !important;
  }
  td[data-label="المساحة"], th[data-label="المساحة"] {
    min-width: 30px !important;
    white-space: nowrap !important;
  }
  td[data-label="الصورة"], th[data-label="الصورة"] {
    width: 100px !important;
  }
  td[data-label="ID"], th[data-label="ID"],
  td[data-label="اختيار"], th[data-label="اختيار"] {
    min-width: auto !important;
  }
  .game-img {
    width: 100px !important;
    height: 100px !important;
    object-fit: contain;
  }

.parent-search {
  display: flex; 
  justify-content: center;
  align-items: center; 
  width: 100%;
  margin-top: 20px; /* ممكن تزود مسافة من فوق */
  /* margin-left: 200px; */
  position: sticky;  /* تخلي العنصر ثابت عند scroll */
  top: 50px; /* المسافة من أعلى الصفحة قبل ما يبدأ الثبات */
  z-index: 9999; /* للتأكد إنه فوق كل العناصر */
}

/* الجزء الخاص بـ search-container */
#search-container {
  display: flex;
  gap: 5px;
  width: max-content;
}



  #thumbnail-container {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 0px 0px 10px auto !important;
    position: relative !important;
    width: auto !important;
  }
  .thumbnail {
    width: 200px !important;
    height: 200px !important;
    object-fit: cover !important;
    cursor: pointer !important;
    border: 1px solid #ccc !important;
    border-radius: 5px !important;
    transition: transform 0.2s ease-in-out !important;
  }
  .thumbnail:hover { transform: scale(1.2) !important; transition: all 1s ease !important; }
}

#clear-btn {
  padding: 8px 12px !important;
  font-size: 16px !important;
}

#thumbnail-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 50px auto 20px auto;
  
}

.thumb-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  
}

.thumb-text {
    font-family: 'Almarai', sans-serif; 
    margin-top: 8px;
    font-size: 19px;
    font-weight: bold;
    text-align: center;
    color: #0f94d7;
    background: #e6f2ff;
    padding: 5px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    width: 150px;
}

.recent-container{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 10px;
  overflow: hidden;
}
.xclear{

  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 10px;
  overflow: hidden;
}



.game-card h3 {
  font-size: 12px;
  line-height: 16px;
  margin: 0;
  padding: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;  
  overflow: hidden;
  word-break: break-word;  
  white-space: normal;
  box-sizing: border-box;
  min-height: calc(16px * 4); 
  font-family: "Sansation", sans-serif
}
.game-card p {
  font-size: 18px;
  color: #444;
  margin-top: 0px;
  font-family: "Sansation", sans-serif
}
.game-card button {
  background: #51b1ff;
  color: #fff;
  padding: 5px 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Almarai', sans-serif;
}
.recentimage img,.recentimageu img ,  .tableimage img{
width: 480px;   
height: 75px;  
}

@media screen and (min-width: 1025px) {
  .game-img {
    width: 190px !important;
    height: 190px !important;
    object-fit: contain;
  }
  .recentimage img,.recentimageu img ,  .tableimage img{
width: 900px;   
height: 150px;  
}
}
