/* ATC Popup styles - namespaced under .atc-popup to avoid any collision with Journal classes */

body.atc-popup-open {
    overflow: hidden;
}

.atc-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 20, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 16px;
    box-sizing: border-box;
}

.atc-popup-overlay.atc-popup-visible {
    opacity: 1;
}

.atc-popup-overlay.atc-popup-closing {
    opacity: 0;
}

.atc-popup {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 380px;
    padding: 40px 32px 28px;
    text-align: center;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    font-family: var(--atc-popup-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif);
}

.atc-popup * {
    font-family: inherit;
}

/* شريط تقدّم الإغلاق التلقائي، اختياري ويظهر فقط عند تفعيله من لوحة التحكم */
.atc-popup-progress {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 18px 18px;
    overflow: hidden;
    background: transparent;
}

.atc-popup-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--atc-popup-icon-color, #2fb56b);
    transform-origin: right;
    transform: scaleX(1);
}

[dir="ltr"] .atc-popup-progress-bar {
    transform-origin: left;
}

.atc-popup-overlay.atc-popup-visible .atc-popup {
    transform: scale(1);
    opacity: 1;
}

.atc-popup-close {
    position: absolute;
    top: 12px;
    left: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #9b9b9b;
    cursor: pointer;
    padding: 4px;
}

.atc-popup-close:hover {
    color: #444;
}

.atc-popup-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--atc-popup-icon-color, #2fb56b);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: atc-popup-pop 0.35s ease;
}

.atc-popup-title {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 700;
    color: #1f1f1f;
}

.atc-popup-product {
    margin: 0 0 16px;
    font-size: 14px;
    color: #8a8a8a;
}

.atc-popup-product-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
}

.atc-popup-product-image {
    width: var(--atc-popup-image-size, 84px);
    height: var(--atc-popup-image-size, 84px);
    object-fit: cover;
    border-radius: 12px;
    background: #f4f0f2;
}

.atc-popup-product-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 280px;
}

.atc-popup-product-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--atc-popup-name-color, #1f1f1f);
    text-align: center;
}

.atc-popup-product-price {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--atc-popup-price-color, #6c2a3e);
    text-align: center;
}

.atc-popup-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f0f2;
    color: #6b6b6b;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 999px;
    margin-bottom: 22px;
}

.atc-popup-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.atc-popup-btn {
    flex: 1;
    border-radius: 10px;
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.15s ease;
}

.atc-popup-btn:hover {
    opacity: 0.9;
}

.atc-popup-btn-primary {
    background: var(--atc-popup-primary-color, #6c2a3e);
    color: #ffffff;
}

.atc-popup-btn-secondary {
    background: #ffffff;
    color: #444;
    border-color: #dcdcdc;
}

.atc-popup-checkout-link {
    display: inline-block;
    font-size: 13px;
    color: #6b6b6b;
    text-decoration: none;
}

.atc-popup-checkout-link:hover {
    color: var(--atc-popup-primary-color, #6c2a3e);
    text-decoration: underline;
}

@keyframes atc-popup-pop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 420px) {
    .atc-popup {
        padding: 32px 22px 22px;
    }
}

/* ============================================================
   نمط "جريء" (Bold) - نفس هيكل النافذة المنتصفة لكن بألوان
   وتأثيرات أقوى، يُفعَّل بإضافة كلاس atc-popup--bold
   ============================================================ */
.atc-popup--bold {
    background: linear-gradient(180deg, #ffffff 0%, #fbf7f8 100%);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.atc-popup--bold .atc-popup-icon {
    width: 88px;
    height: 88px;
    box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.06);
}

.atc-popup--bold .atc-popup-title {
    font-size: 22px;
    color: var(--atc-popup-primary-color, #6c2a3e);
}

.atc-popup--bold .atc-popup-btn-primary {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.atc-popup--bold .atc-popup-btn-secondary {
    border-width: 2px;
    border-color: var(--atc-popup-primary-color, #6c2a3e);
    color: var(--atc-popup-primary-color, #6c2a3e);
}

/* ============================================================
   نمط "شريط علوي" (Top Bar) - إشعار رفيع بدون تعتيم الخلفية،
   لا يمنع التفاعل مع باقي الصفحة، يظهر منزلقًا من الأعلى
   ============================================================ */
.atc-popup-topbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: block;
    padding: 0;
    opacity: 0;
    transform: translateY(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.atc-popup-topbar-wrapper.atc-popup-visible {
    opacity: 1;
    transform: translateY(0);
}

.atc-popup-topbar-wrapper.atc-popup-closing {
    opacity: 0;
    transform: translateY(-100%);
}

.atc-popup-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 10px 20px;
    position: relative;
    font-family: var(--atc-popup-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif);
}

.atc-popup-topbar-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--atc-popup-icon-color, #2fb56b);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.atc-popup-topbar-image {
    width: var(--atc-popup-image-size, 40px);
    height: var(--atc-popup-image-size, 40px);
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.atc-popup-topbar-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #1f1f1f;
    overflow: hidden;
    white-space: nowrap;
}

.atc-popup-topbar-text strong {
    font-weight: 700;
    flex-shrink: 0;
}

.atc-popup-topbar-name {
    color: var(--atc-popup-name-color, #444444);
    overflow: hidden;
    text-overflow: ellipsis;
}

.atc-popup-topbar-price {
    color: var(--atc-popup-price-color, #6c2a3e);
    font-weight: 700;
    flex-shrink: 0;
}

.atc-popup-topbar-count {
    background: #f4f0f2;
    color: #6b6b6b;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}

.atc-popup-topbar-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 13px;
}

.atc-popup-topbar-close {
    position: static;
    flex-shrink: 0;
    font-size: 20px;
}

.atc-popup-topbar-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    overflow: hidden;
}

/* على الشاشات الصغيرة نخفي تفاصيل الاسم/السعر ونكتفي بالعنوان والزر لضيق المساحة */
@media (max-width: 720px) {
    .atc-popup-topbar-name,
    .atc-popup-topbar-price {
        display: none;
    }
}
