/* تنسيقات محسنة لعرض السلة على الهاتف المحمول */

/* أيقونة سلة التسوق على الهاتف */
@media (max-width: 768px) {
  .mobile-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
  }
  
  .mobile-cart-icon i {
    font-size: 1.3rem;
    color: #333;
  }
  
  #mobile-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #ff5252;
    font-size: 0.7rem;
    color: white;
    border: 2px solid white;
    font-weight: bold;
  }
  
  .mobile-cart {
    background: transparent;
    border: none;
    padding: 0;
    margin-right: 10px;
    box-shadow: none;
  }
  
  /* زيادة حجم الخط الرئيسي */
  .fa-shopping-cart {
    font-size: 1.3rem;
  }

  /* التنسيق العام للسلة على الجوال */
  #cartModal .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
  }
  
  #cartModal .modal-content {
    height: 100%;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  
  #cartModal .modal-header {
    background-color: white;
    color: #333;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    align-items: center;
  }
  
  #cartModal .modal-title {
    font-weight: bold;
    font-size: 1.3rem;
    color: #4c66e0;
  }
  
  #cartModal .close {
    color: #333;
    opacity: 0.7;
    font-size: 1.8rem;
    padding: 0 10px;
    margin: -15px -10px -15px auto;
    z-index: 1050; 
    position: relative; 
  }
  
  #cartModal .close:hover {
    opacity: 1;
    color: #dc3545;
  }
  
  #cartModal .modal-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    background-color: white;
  }
  
  /* إخفاء ترويسة الجدول على الجوال */
  #cartModal .table thead {
    display: none;
  }
  
  /* تنسيق عناصر السلة على الجوال */
  #cartModal .table tbody tr {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #fff;
    position: relative;
  }
  
  #cartModal .table td {
    display: block;
    border: none;
    padding: 5px 10px;
    text-align: right;
  }
  
  /* تنسيق خاص بصورة المنتج */
  #cartModal .table td:first-child {
    width: 25%;
    padding: 0;
  }
  
  #cartModal .table td:first-child img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 80px;
    object-fit: contain;
  }
  
  /* تنسيق خاص باسم المنتج */
  #cartModal .table td:nth-child(2) {
    width: 75%;
    font-weight: bold;
    font-size: 1rem;
    padding-top: 0;
    padding-bottom: 0;
  }
  
  /* تنسيق خاص بالسعر والنقاط */
  #cartModal .table td:nth-child(3),
  #cartModal .table td:nth-child(4) {
    width: 50%;
    font-size: 0.9rem;
    color: #555;
  }
  
  /* تنسيق خاص بالكمية */
  #cartModal .table td:nth-child(5) {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin: 5px 0;
  }
  
  #cartModal .table td:nth-child(5) button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: white;
    border: 1px solid #dee2e6;
    color: #4c66e0;
  }
  
  #cartModal .table td:nth-child(5) .quantity-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
  }
  
  /* تنسيق خاص بإجمالي سعر المنتج */
  #cartModal .table td:nth-child(6) {
    width: 50%;
    font-weight: bold;
    font-size: 1.1rem;
    color: #28a745;
  }
  
  /* تنسيق خاص بزر الحذف */
  #cartModal .table td:nth-child(7) {
    width: 50%;
    text-align: left;
  }
  
  #cartModal .table td:nth-child(7) button {
    background-color: #fff0f0;
    color: #dc3545;
    border: none;
    box-shadow: none;
    border-radius: 5px;
    padding: 5px 10px;
  }
  
  #cartModal .table td:nth-child(7) button:hover {
    background-color: #ffd5d5;
  }
  
  /* تنسيق السعر الإجمالي والنقاط */
  #cartModal .modal-body > p,
  #cartModal .modal-body > h5 {
    margin: 10px 5px;
    padding: 12px 15px;
    background-color: #fff;
    border-radius: 8px;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  }
  
  #cartModal .modal-body > h5 {
    background-color: #e9f7ef;
    color: #28a745;
  }
  
  /* تنسيق أزرار التذييل */
  #cartModal .modal-footer {
    padding: 10px 15px;
    border-top: none;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    justify-content: space-between;
    background-color: white;
  }
  
  #cartModal .modal-footer .btn {
    flex: 1;
    margin: 0 5px;
    border-radius: 8px;
    padding: 12px 0;
    font-weight: bold;
  }
  
  #cartModal .modal-footer .btn-primary {
    background: linear-gradient(135deg, #4c66e0, #2c42a3);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #cartModal .modal-footer .btn-primary .badge {
    margin-right: 8px;
    background-color: white;
    color: #4c66e0;
    font-weight: bold;
  }
  
  /* رسالة السلة الفارغة */
  #cartModal .table tbody tr td[colspan="7"] {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.1rem;
    color: #6c757d;
    width: 100%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  }
  
  #cartModal .table tbody tr td[colspan="7"]::before {
    content: "\f07a";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    display: block;
    font-size: 3rem;
    margin-bottom: 15px;
    color: #dee2e6;
  }
  
  /* تنسيق حاوية زر الإغلاق في الأعلى */
  .top-close-button-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1050;
  }
  
  /* تنسيق زر الإغلاق في الأعلى */
  .top-close-button {
    background: #2a3548;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
  }
  
  .top-close-button:hover {
    background: #3a4a66;
    transform: scale(1.1);
  }
  
  .top-close-button:focus {
    outline: none;
  }
  
  /* تنسيق زر الإغلاق بجوار عنوان السلة */
  .close-cart-button {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #2a3548;
    opacity: 0.8;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .close-cart-button:hover {
    opacity: 1;
    transform: scale(1.1);
  }
  
  .close-cart-button:focus {
    outline: none;
  }
  
  /* تنسيق زر الإغلاق الرئيسي في الموديل */
  .mobile-close-button {
    color: white;
    border: none;
    background-color: #e74c3c;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.2s ease;
    z-index: 100;
  }
  
  /* تنسيق خاص لزر الإغلاق */
  .mobile-close-container {
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px;
    z-index: 2000;
  }
  
  .mobile-close-button:hover {
    background-color: #ff3737;
  }
  
  .mobile-close-button:active {
    background-color: #cc2f2f;
  }
  
  .mobile-close-button span {
    position: relative;
    top: -2px;
  }
  
  /* تنسيق زر الإغلاق النصي في الأعلى */
  .cart-close-text-button {
    padding: 3px 10px;
    margin-right: 10px;
    background-color: #f8f9fa;
    color: #2a3548;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .cart-close-text-button:hover {
    background-color: #e9ecef;
    color: #212529;
  }
  
  .cart-close-text-button:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(42, 53, 72, 0.25);
  }
  
}

/* تنسيقات لتحسين عرض السلة على الهواتف الصغيرة جدًا */
@media (max-width: 375px) {
  #cartModal .table td:first-child {
    width: 30%;
  }
  
  #cartModal .table td:nth-child(2) {
    width: 70%;
  }
  
  #cartModal .modal-body > p,
  #cartModal .modal-body > h5 {
    font-size: 1rem;
  }
}
