/* Book Card Enhanced Styles */
.product-content {
    padding: 1.5rem;
    background: #fff;
    border-radius: 0 0 12px 12px;
    border: 1px solid #e9ecef;
    border-top: none;
    transition: all 0.3s ease;
}

.product-card4:hover .product-content {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-5px);
}

.category-badge {
    margin-bottom: 1rem;
}

.category-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.category-link:hover {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.title-link {
    color: #212529;
    text-decoration: none;
    transition: color 0.3s ease;
}

.title-link:hover {
    color: #0d6efd;
}

.book-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.book-author i {
    color: #6c757d;
}

.book-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    font-size: 0.875rem;
}

.book-price {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #fff8e1 0%, #ffe8a1 100%);
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.old-price {
    font-size: 1rem;
    color: #6c757d;
    text-decoration: line-through;
}

.discount-badge {
    padding: 0.25rem 0.75rem;
    background: #dc3545;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.book-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.book-actions .btn {
    flex: 1;
    padding: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.book-actions .btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
}

.book-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 110, 253, 0.3);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
}

/* Modal Enhanced Styles */
.modal-content {
    border-radius: 20px;
    overflow: hidden;
    border: none;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.modal-header .modal-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.modal-body .bg-light {
    background: #f8fafc !important;
}

.order-summary .card {
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.order-summary .card:hover {
    transform: translateY(-2px);
}

.delivery-options .card-option {
    position: relative;
}

.card-option .form-check-input {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
}

.card-option .form-check-label {
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-option .form-check-input:checked + .form-check-label {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, 0.05);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.1);
}

.option-content {
    text-align: center;
}

.form-floating .form-control {
    border-radius: 10px;
    border: 1px solid #dee2e6;
    padding: 1rem 0.75rem;
    height: calc(3.5rem + 2px);
    transition: all 0.3s ease;
}

.form-floating .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-floating label {
    color: #6c757d;
    padding: 1rem 0.75rem;
}

.btn-outline-primary {
    border-radius: 10px;
    padding: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

.btn-lg {
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.3);
}

/* List Group Styling */
.list-group-item {
    border-radius: 8px !important;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background: #f8f9fa;
    border-color: #0d6efd;
}

.list-group-item.active {
    background: #0d6efd;
    border-color: #0d6efd;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body .row {
        flex-direction: column;
    }
    
    .modal-body .col-md-5,
    .modal-body .col-md-7 {
        width: 100%;
    }
    
    .book-actions {
        flex-direction: column;
    }
    
    .book-actions .btn {
        width: 100%;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
}


/* تحسين هيكل المعلومات */
.book-info-header {
    text-align: right; /* لأن الموقع RTL */
}

.book-info-header .category-badge {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.book-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0.5rem 0 0.75rem;
    color: #212529;
}

.book-title a.title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-title a.title-link:hover {
    color: #0d6efd;
}

.book-author {
    font-size: 0.95rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-author i {
    font-size: 0.9rem;
    color: #888;
}

/* Meta Row - أفقي ومتوازن */
.book-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.875rem;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: #495057;
    border: 1px solid #e9ecef;
}

.book-meta-row .meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.book-meta-row .meta-item i {
    color: #6c757d;
    width: 16px;
    text-align: center;
}

.book-meta-row .rating {
    margin-left: auto; /* يدفع التقييم لليمين (في RTL يصبح يسار) */
}

.book-meta-row .rating small {
    font-size: 0.75rem;
}

/* تحسين الفئة */
.category-link {
    font-size: 0.8rem;
    padding: 0.35rem 0.85rem;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.15);
}

.category-link:hover {
    background: #1976d2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(25, 118, 210, 0.25);
}

.category-link i {
    font-size: 0.8rem;
}

/* ===== Compact & Modern Book Header ===== */
.book-header-compact {
    padding: 0 0.25rem;
}

.title-author-row {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* العنوان الرئيسي */
.book-title-compact {
    font-size: 1.22rem !important;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    color: #1a1a1a;
    word-break: break-word;
    hyphens: auto;
}

.book-title-compact a:hover {
    color: #0d6efd !important;
}

/* المؤلف + "بواسطة" */
.author-by {
    font-size: 0.92rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.by-text {
    color: #888;
    font-weight: 500;
}

.author-name {
    color: #333;
}

.translator {
    color: #666;
    font-size: 0.85rem;
}

/* الفئة (صغيرة جدًا في الأعلى) */
.category-pill-mini a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #0d6efd;
    color: white;
    font-size: 0.69rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.25);
    transition: all 0.3s ease;
}

.category-pill-mini a:hover {
    background: #0a58ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.35);
}

/* البادجات الصغيرة (تاج، نجمة...) */
.badges-group {
    display: flex;
    gap: 6px;
}

.status-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.status-badge.bestseller {
    background: linear-gradient(135deg, #f9d71c, #f1c40f);
    color: #8B4513;
}

.status-badge.new {
    background: linear-gradient(135deg, #00E5FF, #00B0FF);
    color: white;
}

.title-clickable-area {
    cursor: pointer;
    transition: opacity 0.2s ease;
    padding: 8px 4px;
    margin: -8px -4px; /* لتعويض الـ padding ويبدو طبيعيًا */
    border-radius: 8px;
}

.title-clickable-area:hover {
    opacity: 0.85;
    background-color: rgba(13, 110, 253, 0.03);
}

/* تأثير أخضر أنيق عند الإضافة بنجاح */
.add-to-cart-btn.added-to-cart-success {
    animation: cartSuccessPulse 1.5s ease-out;
    border-color: #28a745 !important;
}

@keyframes cartSuccessPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(40, 167, 69, 0.3);
        transform: scale(1.08);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
        transform: scale(1);
    }
}

/* تحسين بسيط للزر أثناء التحميل */
.add-to-cart-btn i.fa-spinner {
    color: #666;
    font-size: 0.9em;
}


/* تأثير أخضر أنيق للمفضلة عند الإضافة */
.add-to-wishlist-btn.added-to-wishlist-success {
    animation: wishlistSuccessPulse 1.5s ease-out;
    border-color: #28a745 !important;
}

@keyframes wishlistSuccessPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(40, 167, 69, 0.3);
        transform: scale(1.08);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
        transform: scale(1);
    }
}


.book-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.add-to-cart-main-btn {
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.85rem 1.5rem;
    border-radius: 14px;
    transition: all 0.3s ease;
    min-height: 52px;
    box-shadow: 0 4px 15px rgba(139, 61, 255, 0.2);
}

.add-to-cart-main-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(139, 61, 255, 0.35);
}

.added-to-cart-success {
    background: linear-gradient(135deg, #4caf50, #66bb6a) !important;
    border-color: #4caf50 !important;
}

/* تأكيد إن الأزرار الصغيرة متساوية ومتوسطة */
.action-buttons {
    order: 2;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: 1.5px solid #e0e0e0;
}

.btn-icon:hover {
    transform: translateY(-3px);
    border-color: #8b3dff;
    color: #8b3dff;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .add-to-cart-main-btn {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}