/* نظام إرشاد المستخدم - التصميم الاحترافي */

/* الطبقة الخلفية */
.user-guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    pointer-events: none;
}

.guide-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    pointer-events: all;
}

/* أدوات التحكم */
.guide-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 9999;
    pointer-events: all;
}

.guide-skip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 20px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.guide-skip:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* تمييز العناصر */
.guide-highlighted {
    position: relative;
    z-index: 9999 !important;
    border-radius: 8px;
    box-shadow: 
        0 0 0 4px var(--primary-gold),
        0 0 0 8px rgba(197, 164, 102, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.3);
    animation: guideHighlight 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

/* إضافة خلفية مناسبة للشعار عند تحديده لكي لا يظهر شفافاً */
.logo-container.guide-highlighted {
    background-color: #f4f1ea !important;
}

/* إضافة خلفية مناسبة للقائمة عند تحديدها */
.nav-links.guide-highlighted,
.nav-links a.guide-highlighted {
    background-color: #333 !important;
}

/* إضافة خلفية للعناوين والنصوص الشفافة عند تحديدها */
h1.guide-highlighted,
h2.guide-highlighted,
p.guide-highlighted {
    background-color: white !important;
    padding: 10px !important;
}

/* إصلاح سياق التكديس للآباء لضمان ظهور العنصر فوق الخلفية المظللة */
.guide-fix-parent {
    z-index: 9999 !important;
}

.guide-fix-parent-static {
    position: relative !important;
}

@keyframes guideHighlight {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            0 0 0 4px var(--primary-gold),
            0 0 0 8px rgba(197, 164, 102, 0.3),
            0 8px 32px rgba(0, 0, 0, 0.3);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 
            0 0 0 6px var(--primary-gold),
            0 0 0 12px rgba(197, 164, 102, 0.4),
            0 12px 40px rgba(0, 0, 0, 0.4);
    }
}

/* نافذة التوجيه */
.user-guide-tooltip {
    position: absolute;
    max-width: 380px;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 8px 20px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    overflow: hidden;
}

.user-guide-tooltip.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* سهم التوجيه */
.user-guide-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
}

.user-guide-tooltip[data-position="bottom"]::before {
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
}

.user-guide-tooltip[data-position="top"]::before {
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

.user-guide-tooltip[data-position="right"]::before {
    top: 50%;
    left: -24px;
    transform: translateY(-50%);
    border-right-color: white;
}

.user-guide-tooltip[data-position="left"]::before {
    top: 50%;
    right: -24px;
    transform: translateY(-50%);
    border-left-color: white;
}

/* رأس النافذة */
.tooltip-header {
    background: linear-gradient(135deg, var(--primary-gold), #daa520);
    color: white;
    padding: 20px 25px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    line-height: 1.3;
}

.step-counter {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* محتوى النافذة */
.tooltip-content {
    padding: 25px;
    font-family: 'Tajawal', sans-serif;
}

.tooltip-content p {
    margin: 0;
    font-size: 1.1em;
    line-height: 1.7;
    color: #444;
}

/* تذييل النافذة */
.tooltip-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #eee;
}

/* أزرار التحكم */
.btn-guide {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-prev {
    background: #f1f3f4;
    color: #666;
}

.btn-prev:hover {
    background: #e8eaed;
    transform: translateY(-1px);
}

.btn-next, .btn-action {
    background: var(--primary-gold);
    color: white;
    box-shadow: 0 4px 12px rgba(197, 164, 102, 0.3);
}

.btn-next:hover, .btn-action:hover {
    background: #b8941f;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(197, 164, 102, 0.4);
}

.btn-action {
    animation: pulseAction 2s ease-in-out infinite;
}

@keyframes pulseAction {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* رسالة الإكمال */
.guide-completion-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.completion-content {
    background: white;
    border-radius: 15px;
    padding: 40px 50px;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-content i {
    font-size: 3em;
    color: #4CAF50;
    margin-bottom: 20px;
    animation: checkmark 0.6s ease 0.3s both;
}

@keyframes checkmark {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.completion-content h3 {
    margin: 0 0 15px;
    color: #333;
    font-size: 1.8em;
}

.completion-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.completion-content button {
    background: var(--primary-gold);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.completion-content button:hover {
    background: #b8941f;
    transform: translateY(-2px);
}

/* نافذة التأكيد المخصصة */
.guide-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.3s ease;
}

.guide-confirm-dialog {
    background: white;
    border-radius: 15px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-confirm-icon {
    font-size: 3.5em;
    color: var(--primary-gold);
    margin-bottom: 15px;
}

.guide-confirm-dialog h3 {
    margin: 0 0 10px;
    color: #333;
    font-size: 1.5em;
}

.guide-confirm-dialog p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 1.1em;
}

.guide-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.guide-confirm-buttons button {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm-yes {
    background: #f44336;
    color: white;
}

.btn-confirm-yes:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.btn-confirm-no {
    background: #e0e0e0;
    color: #333;
}

.btn-confirm-no:hover {
    background: #bdbdbd;
    transform: translateY(-2px);
}

/* زر إعادة الإرشاد في القائمة */
.restart-guide-btn {
    position: relative;
    overflow: hidden;
}

.restart-guide-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.restart-guide-btn:hover::before {
    left: 100%;
}

/* تأثيرات الحركة */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .user-guide-tooltip {
        max-width: calc(100vw - 40px);
        min-width: 280px;
        margin: 0 20px;
    }

    .tooltip-header {
        padding: 15px 20px 12px;
    }

    .tooltip-header h3 {
        font-size: 1.1em;
    }

    .tooltip-content {
        padding: 20px;
    }

    .tooltip-content p {
        font-size: 1em;
    }

    .tooltip-footer {
        padding: 15px 20px;
        flex-direction: column;
    }

    .btn-guide {
        width: 100%;
        justify-content: center;
    }

    .completion-content {
        margin: 20px;
        padding: 30px 25px;
    }

    .completion-content h3 {
        font-size: 1.5em;
    }
}