/* public/assets/css/popup.css */

/* ===== المتغيرات العامة ===== */
:root {
    --popup-overlay-bg: rgba(0, 0, 0, 0.5);
    --popup-close-bg: #ffffff;
    --popup-close-color: #333333;
    --popup-close-hover-bg: #f0f0f0;
    --popup-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --popup-border-radius: 12px;
    --popup-transition: all 0.3s ease;
}

/* ===== الحاوية الرئيسية ===== */
.popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}

/* ===== طبقة الخلفية ===== */
.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--popup-overlay-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: var(--popup-transition);
}

/* ===== حاوية المحتوى ===== */
.popup-container {
    position: absolute;
    z-index: 100000;
}

/* ===== أوضاع العرض المختلفة ===== */
.popup-container.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.popup-container.position-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.popup-container.position-bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.popup-container.position-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.popup-container.position-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.popup-container.position-top-left {
    top: 20px;
    left: 20px;
}

.popup-container.position-top-right {
    top: 20px;
    right: 20px;
}

.popup-container.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.popup-container.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.popup-container.position-fullscreen {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== محتوى النافذة ===== */
.popup-content {
    position: relative;
    border-radius: var(--popup-border-radius);
    overflow: hidden;
    box-shadow: var(--popup-shadow);
    background-color: #ffffff;
    max-height: 90vh;
    overflow-y: auto;
}

/* تخصيص شريط التمرير */
.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.popup-container.position-fullscreen .popup-content {
    width: 90% !important;
    height: 90% !important;
    max-width: 1200px;
    max-height: 800px;
}

/* ===== زر الإغلاق ===== */
.popup-close {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--popup-close-bg);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--popup-transition);
    z-index: 100001;
    padding: 0;
    line-height: 1;
}

.popup-close:hover {
    transform: scale(1.1);
    background: var(--popup-close-hover-bg);
}

.popup-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(226, 28, 42, 0.3);
}

.popup-close i {
    color: var(--popup-close-color);
    font-size: 14px;
}

/* أوضاع زر الإغلاق */
.popup-close.position-top-right {
    top: 10px;
    right: 10px;
}

.popup-close.position-top-left {
    top: 10px;
    left: 10px;
}

.popup-close.position-bottom-right {
    bottom: 10px;
    right: 10px;
}

.popup-close.position-bottom-left {
    bottom: 10px;
    left: 10px;
}

/* ===== أنماط المحتوى النصي ===== */
.popup-text-content {
    padding: 30px;
}

.popup-text-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
    color: inherit;
}

.popup-body {
    margin-bottom: 25px;
    line-height: 1.8;
    font-size: 16px;
}

/* ===== زر النافذة ===== */
.popup-button {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #123a6f, #e21c2a);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--popup-transition);
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
}

.popup-button:active {
    transform: translateY(0);
}

/* ===== رابط النافذة ===== */
.popup-link {
    display: block;
    padding: 20px;
    text-align: center;
    color: #123a6f;
    text-decoration: none;
    font-weight: 600;
    transition: var(--popup-transition);
}

.popup-link:hover {
    background: rgba(18, 58, 111, 0.05);
    text-decoration: none;
}

/* ===== حاوية الفيديو ===== */
.popup-video-container {
    position: relative;
    padding-bottom: 56.25%; /* نسبة 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
}

.popup-video-container iframe,
.popup-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== تأثيرات الظهور ===== */

/* Fade */
@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide */
@keyframes slide {
    from { 
        transform: translateY(50px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* Zoom */
@keyframes zoom {
    from { 
        transform: scale(0); 
        opacity: 0; 
    }
    to { 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* Bounce */
@keyframes bounce {
    0% { 
        transform: scale(0); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.1); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* Flip */
@keyframes flip {
    from { 
        transform: perspective(400px) rotateY(90deg); 
        opacity: 0; 
    }
    to { 
        transform: perspective(400px) rotateY(0); 
        opacity: 1; 
    }
}

/* ===== دعم اللغة العربية RTL ===== */
[dir="rtl"] .popup-container.position-top-left {
    left: auto;
    right: 20px;
}

[dir="rtl"] .popup-container.position-top-right {
    right: auto;
    left: 20px;
}

[dir="rtl"] .popup-container.position-bottom-left {
    left: auto;
    right: 20px;
}

[dir="rtl"] .popup-container.position-bottom-right {
    right: auto;
    left: 20px;
}

[dir="rtl"] .popup-close.position-top-right {
    right: auto;
    left: 10px;
}

[dir="rtl"] .popup-close.position-top-left {
    left: auto;
    right: 10px;
}

[dir="rtl"] .popup-close.position-bottom-right {
    right: auto;
    left: 10px;
}

[dir="rtl"] .popup-close.position-bottom-left {
    left: auto;
    right: 10px;
}

/* ===== التجاوب مع الشاشات الصغيرة ===== */
@media (max-width: 768px) {
    .popup-content {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 80vh;
    }
    
    .popup-container.position-fullscreen .popup-content {
        width: 100% !important;
        height: 100% !important;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .popup-text-content {
        padding: 20px;
    }
    
    .popup-text-content h2 {
        font-size: 20px;
    }
    
    .popup-body {
        font-size: 14px;
    }
    
    .popup-button {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .popup-close {
        width: 28px;
        height: 28px;
    }
    
    .popup-close i {
        font-size: 12px;
    }
}

/* ===== تحسينات إضافية ===== */
.popup-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.popup-content a {
    text-decoration: none;
}

/* منع التحديد أثناء العرض */
.popup-wrapper.showing {
    user-select: none;
}

/* تحسين ظهور النص في الوضع الداكن */
@media (prefers-color-scheme: dark) {
    .popup-content {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .popup-close {
        background: #333;
    }
    
    .popup-close i {
        color: #fff;
    }
    
    .popup-close:hover {
        background: #444;
    }
}