/* ============================================
   Card Actions Bar - نظام مركزي إلزامي v2.0
   يظهر على كل بطاقة في المنصة تلقائياً
   ============================================ */

/* Container الرئيسي */
.ca-wrap {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 14px 14px;
    flex-wrap: nowrap;
    position: relative;
}

/* RTL support */
[dir="rtl"] .ca-wrap,
html[lang="ar"] .ca-wrap {
    direction: rtl;
}

/* الأزرار الأساسية */
.ca-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    color: #b8b8d8 !important;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    height: 32px;
    min-width: 70px;
    text-decoration: none;
    font-family: inherit;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.ca-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #d4c4ff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* زر المفضلة */
.ca-btn.ca-fav {
    color: #b8b8d8 !important;
}

.ca-btn.ca-fav .ca-fav-icon {
    font-size: 14px;
    line-height: 1;
    display: inline-block;
}

.ca-btn.ca-fav.ca-fav--active,
.ca-btn.ca-fav.saved,
.ca-btn.ca-fav.active {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.45);
    color: #fbbf24 !important;
}

.ca-btn.ca-fav.ca-fav--active:hover,
.ca-btn.ca-fav.saved:hover,
.ca-btn.ca-fav.active:hover {
    background: rgba(245, 158, 11, 0.28);
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

/* زر المشاركة */
.ca-btn.ca-share {
    color: #b8b8d8 !important;
}

.ca-btn.ca-share:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* wrapper للزر مع النافذة المنبثقة */
.ca-share-wrapper {
    position: relative;
    display: inline-flex;
}

/* نافذة المشاركة المنبثقة */
.ca-share-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #1a1a35;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px;
    padding: 12px;
    min-width: 220px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    gap: 8px;
}

/* RTL: popup يظهر من اليسار */
[dir="rtl"] .ca-share-popup,
html[lang="ar"] .ca-share-popup {
    right: auto;
    left: 0;
}

.ca-share-popup.open {
    display: flex !important;
}

/* مثلث صغير */
.ca-share-popup::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: #1a1a35;
    border-right: 1px solid rgba(139, 92, 246, 0.35);
    border-bottom: 1px solid rgba(139, 92, 246, 0.35);
    transform: rotate(45deg);
}

[dir="rtl"] .ca-share-popup::after,
html[lang="ar"] .ca-share-popup::after {
    right: auto;
    left: 14px;
}

.ca-share-popup a,
.ca-share-popup button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    color: #c8c8e8 !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    width: 100%;
    text-align: right;
    direction: rtl;
}

.ca-share-popup a:hover,
.ca-share-popup button:hover {
    background: rgba(139, 92, 246, 0.18);
    color: #e0d4ff !important;
    transform: translateX(-2px);
}

.ca-share-wa {
    color: #25d366 !important;
}
.ca-share-wa:hover {
    background: rgba(37, 211, 102, 0.12) !important;
    color: #25d366 !important;
}

.ca-share-x {
    color: #60a5fa !important;
}
.ca-share-x:hover {
    background: rgba(96, 165, 250, 0.12) !important;
    color: #93c5fd !important;
}

.ca-share-copy:hover {
    background: rgba(139, 92, 246, 0.18) !important;
}

.ca-share-close {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #f87171 !important;
    justify-content: center !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    margin-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding-top: 8px !important;
}
.ca-share-close:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    transform: none !important;
}

/* Toast notification */
.ca-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e1e3a;
    color: #e0d4ff;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-family: inherit;
}

.ca-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* نافذة تسجيل الدخول */
.ca-login-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    padding: 20px;
}

.ca-login-modal.open {
    display: flex !important;
}

.ca-login-box {
    background: #1a1a35;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    padding: 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    animation: caModalIn 0.3s ease;
}

@keyframes caModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ca-login-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.ca-login-title {
    font-size: 18px;
    font-weight: 700;
    color: #e0d4ff;
    margin-bottom: 8px;
}

.ca-login-text {
    font-size: 14px;
    color: #9090b8;
    margin-bottom: 24px;
    line-height: 1.6;
}

.ca-login-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ca-login-btns a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.ca-login-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff !important;
    border: none;
}
.ca-login-btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.ca-login-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #9090b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
}
.ca-login-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #c8c8e8 !important;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .ca-wrap {
        padding: 8px 10px;
        gap: 8px;
    }

    .ca-btn {
        padding: 6px 10px;
        font-size: 11px;
        height: 28px;
        min-width: 60px;
    }

    .ca-share-popup {
        min-width: 170px;
        right: -10px;
    }

    [dir="rtl"] .ca-share-popup,
    html[lang="ar"] .ca-share-popup {
        right: auto;
        left: -10px;
    }
}

@media (max-width: 360px) {
    .ca-btn .ca-fav-label,
    .ca-btn span:last-child {
        display: none;
    }

    .ca-btn {
        min-width: 36px;
        padding: 6px 8px;
        justify-content: center;
    }
}
