/**
 * تنسيقات النماذج المخصصة
 * يشمل النافذة المنبثقة والنموذج الثابت
 */

/* ===================================
   النافذة المنبثقة (Modal)
   =================================== */

.custom-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.custom-form-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

/* رأس النافذة */
.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* محتوى النافذة */
.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #667eea;
}

.modal-loading i {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal-loading p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* ذيل النافذة */
.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    background: #f8f9fa;
}

.modal-footer .btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    width: 100%;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.modal-footer .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modal-footer .btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.modal-footer .btn-secondary:hover {
    background: #d0d0d0;
}

/* ===================================
   النموذج
   =================================== */

.custom-order-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-description {
    grid-column: 1 / -1;
    padding: 15px;
    background: #f0f8ff;
    border-right: 4px solid #667eea;
    border-radius: 6px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field-half {
    grid-column: span 1;
}

.form-label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-label .required {
    color: #e74c3c;
    font-size: 16px;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:invalid:not(:placeholder-shown) {
    border-color: #e74c3c;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-left: 40px;
}

/* مجموعات Radio و Checkbox */
.form-radio-group,
.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-radio-item,
.form-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.form-radio-item:hover,
.form-checkbox-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.form-radio-item input,
.form-checkbox-item input {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.form-radio-item label,
.form-checkbox-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
}

/* ===================================
   النموذج الثابت (Inline)
   =================================== */

.custom-form-inline {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

.custom-form-inline .form-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.custom-form-inline .form-header h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 20px;
}

.custom-form-inline .form-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.custom-form-inline .custom-order-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.custom-form-inline .form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.custom-form-inline .btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.custom-form-inline .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.custom-form-inline .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ===================================
   زر "اشتري الآن"
   =================================== */

.btn-buy-now,
.buy-now-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-buy-now:hover,
.buy-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-buy-now:active,
.buy-now-btn:active {
    transform: translateY(0);
}

.btn-buy-now:disabled,
.buy-now-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-buy-now i,
.buy-now-btn i {
    font-size: 18px;
}

/* ===================================
   الرسوم المتحركة
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   التجاوب مع الشاشات الصغيرة
   =================================== */

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    .custom-order-form {
        grid-template-columns: 1fr;
    }
    
    .form-field-half {
        grid-column: 1 / -1;
    }
    
    .custom-form-inline .custom-order-form {
        grid-template-columns: 1fr;
    }
    
    .btn-buy-now {
        padding: 12px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
    
    .custom-form-inline {
        padding: 20px;
    }
}

/* ===================================
   حالات خاصة
   =================================== */

/* عندما يكون النموذج معطلاً */
.custom-form-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* رسالة خطأ */
.form-error-message {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    padding: 12px 15px;
    color: #c33;
    font-size: 14px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-error-message i {
    font-size: 18px;
}

/* رسالة نجاح */
.form-success-message {
    background: #efe;
    border: 1px solid #cfc;
    border-radius: 6px;
    padding: 12px 15px;
    color: #3c3;
    font-size: 14px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-success-message i {
    font-size: 18px;
}


/* النموذج الثابت في صفحة المنتج - بسيط بدون خلفية */
#custom-form-inline {
    width: 100%;
    margin-top: 20px;
    padding: 0;
    background: transparent;
    border: none;
}

#custom-form-inline .custom-order-form {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

#custom-form-inline .form-field {
    margin-bottom: 0;
}

#custom-form-inline .form-field-full {
    grid-column: 1 / -1;
}

#custom-form-inline .form-field-half {
    grid-column: span 1;
}

#custom-form-inline .form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

#custom-form-inline .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

#custom-form-inline .form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

#custom-form-inline .form-actions {
    margin-top: 5px;
}

#custom-form-inline .form-actions button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: Cairo, sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#custom-form-inline .form-actions button:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

#custom-form-inline .form-actions button:active {
    transform: translateY(0);
}

#custom-form-inline .form-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#custom-form-inline .required {
    color: #dc3545;
    margin-right: 3px;
}

/* Radio and Checkbox groups in inline form */
#custom-form-inline .form-radio-group,
#custom-form-inline .form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#custom-form-inline .form-radio-item,
#custom-form-inline .form-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#custom-form-inline .form-radio-item:hover,
#custom-form-inline .form-checkbox-item:hover {
    border-color: #007cba;
    background: #f8f9ff;
}

#custom-form-inline .form-radio-item input,
#custom-form-inline .form-checkbox-item input {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #007cba;
}

#custom-form-inline .form-radio-item label,
#custom-form-inline .form-checkbox-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
}

/* Textarea in inline form */
#custom-form-inline textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Select in inline form */
#custom-form-inline select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-left: 40px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #custom-form-inline {
        margin-top: 15px;
    }
    
    #custom-form-inline .custom-order-form {
        grid-template-columns: 1fr;
    }
    
    #custom-form-inline .form-field-half {
        grid-column: 1 / -1;
    }
    
    #custom-form-inline .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    #custom-form-inline .form-actions button {
        padding: 12px;
        font-size: 15px;
    }
}

/* ===================================
   ملخص الطلب في النافذة المنبثقة
   =================================== */

.order-summary {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.order-summary h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: #555;
}

.summary-row span:first-child {
    font-weight: 500;
}

.summary-row span:last-child {
    font-weight: 600;
    color: #333;
}

.summary-discounts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.discount-row {
    color: #28a745;
    padding: 8px 12px;
    background: #e8f5e9;
    border-radius: 6px;
    font-size: 14px;
}

.discount-row .discount-amount {
    color: #28a745;
    font-weight: 700;
}

.summary-total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid #dee2e6;
    font-size: 17px;
    font-weight: 700;
}

.summary-total span {
    color: #667eea;
}

.summary-total .summary-final {
    font-size: 20px;
    color: #667eea;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .order-summary {
        padding: 15px;
    }
    
    .order-summary h3 {
        font-size: 16px;
    }
    
    .summary-row {
        font-size: 14px;
    }
    
    .summary-total {
        font-size: 16px;
    }
    
    .summary-total .summary-final {
        font-size: 18px;
    }
}
/* ===================================
   ملخص الطلب (Order Summary)
   =================================== */

.order-summary {
    margin-bottom: 20px;
}

.order-summary h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.summary-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row.discount-row {
    color: #28a745;
    font-size: 13px;
}

.summary-row.summary-total {
    font-weight: bold;
    font-size: 16px;
    padding-top: 10px;
    border-top: 2px solid #dee2e6;
    margin-top: 10px;
    color: #007cba;
}

.discount-amount {
    font-weight: 600;
}

.summary-subtotal,
.summary-shipping,
.summary-final {
    font-weight: 600;
    color: #495057;
}

.summary-final {
    color: #007cba !important;
    font-size: 18px !important;
}

/* ===================================
   شاشة التحميل
   =================================== */

.modal-loading {
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.modal-loading i {
    font-size: 24px;
    color: #007cba;
    animation: spin 1s linear infinite;
}

.modal-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   تحسينات إضافية
   =================================== */

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    background: #f8f9fa;
}

.modal-submit {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.modal-submit:hover {
    background: #005a8b;
    transform: translateY(-1px);
}

.modal-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* ===================================
   الرسوم المتحركة
   =================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===================================
   التجاوب مع الشاشات الصغيرة
   =================================== */

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .summary-content {
        padding: 15px;
    }
    
    .summary-row.summary-total {
        font-size: 15px;
    }
    
    .summary-final {
        font-size: 16px !important;
    }
}
/* ===================================
   قسم المنتجات في النافذة المنبثقة
   =================================== */

.cart-items-section {
    margin-bottom: 20px;
}

.cart-items-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.cart-items-list {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

/* Scrollbar styling */
.cart-items-list::-webkit-scrollbar {
    width: 6px;
}

.cart-items-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-items-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.cart-items-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* تخطيط سطح المكتب */
.cart-item {
    padding: 15px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item:hover {
    background-color: #f8f9fa;
}

/* الصف الأول: الصورة والتفاصيل */
.cart-item-row-1 {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cart-item .item-image {
    width: 60px;
    height: 60px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item .item-details {
    flex: 1;
    min-width: 0;
}

.cart-item .item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.4;
}

/* الصف الثاني: أزرار الكمية والسعر والحذف */
.cart-item-row-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cart-item .quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item .quantity-controls .quantity-btn {
    border: 1px solid #dee2e6;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.cart-item .quantity-controls .decrease-btn {
    background: #f8f9fa;
    color: #495057;
}

.cart-item .quantity-controls .decrease-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.cart-item .quantity-controls .decrease-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cart-item .quantity-controls .increase-btn {
    background: #007cba;
    border-color: #007cba;
    color: white;
}

.cart-item .quantity-controls .increase-btn:hover {
    background: #0056b3;
}

.cart-item .quantity-controls span {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    min-width: 25px;
    text-align: center;
}

.cart-item .item-total {
    font-weight: 600;
    color: #007cba;
    font-size: 15px;
    flex-shrink: 0;
}

.cart-item .remove-item-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cart-item .remove-item-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.cart-item .remove-item-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* تحسينات للشاشات الصغيرة - بقوة أكبر */
@media screen and (max-width: 768px) {
    .cart-items-list {
        max-height: 450px !important;
    }
    
    .cart-item {
        padding: 15px 12px !important;
        display: block !important;
    }
    
    .cart-item-row-1 {
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 12px !important;
    }
    
    .cart-item .item-image {
        width: 70px !important;
        height: 70px !important;
        flex-shrink: 0 !important;
    }
    
    .cart-item .item-details {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .cart-item .item-name {
        font-size: 14px !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.5 !important;
    }
    
    .cart-item-row-2 {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        padding-top: 12px !important;
        border-top: 1px solid #f1f3f4 !important;
        margin-top: 0 !important;
    }
    
    .cart-item .quantity-controls {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
    
    .cart-item .quantity-controls .quantity-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }
    
    .cart-item .quantity-controls span {
        font-size: 15px !important;
        min-width: 30px !important;
        text-align: center !important;
    }
    
    .cart-item .item-total {
        font-size: 16px !important;
        font-weight: 700 !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }
    
    .cart-item .remove-item-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }
}

@media screen and (max-width: 480px) {
    .cart-item {
        padding: 12px 10px !important;
    }
    
    .cart-item .item-image {
        width: 60px !important;
        height: 60px !important;
    }
    
    .cart-item .item-name {
        font-size: 13px !important;
    }
    
    .cart-item .quantity-controls .quantity-btn {
        width: 30px !important;
        height: 30px !important;
    }
    
    .cart-item .quantity-controls span {
        font-size: 14px !important;
        min-width: 28px !important;
    }
    
    .cart-item .item-total {
        font-size: 15px !important;
    }
    
    .cart-item .remove-item-btn {
        width: 30px !important;
        height: 30px !important;
    }
}

/* ===================================
   التخطيط المرن للنماذج
   =================================== */

/* دعم التخطيط المرن */
.custom-order-form.flexible-layout {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
}

.custom-order-form.flexible-layout .form-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.custom-order-form.flexible-layout .form-field-half {
    flex: 1;
    min-width: 0;
}

.custom-order-form.flexible-layout .form-field-full {
    width: 100%;
}

/* النموذج الثابت مع التخطيط المرن */
#custom-form-inline.flexible-layout .custom-order-form {
    display: flex !important;
    flex-direction: column;
    gap: 15px;
}

#custom-form-inline.flexible-layout .form-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

#custom-form-inline.flexible-layout .form-field-half {
    flex: 1;
    min-width: 0;
}

#custom-form-inline.flexible-layout .form-field-full {
    width: 100%;
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 768px) {
    .custom-order-form.flexible-layout .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .custom-order-form.flexible-layout .form-field-half {
        width: 100%;
    }
    
    #custom-form-inline.flexible-layout .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    #custom-form-inline.flexible-layout .form-field-half {
        width: 100%;
    }
}
