/* Smart Back Button Global Styles */
.smart-back-button {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    gap: 10px;
}

.smart-back-button.visible {
    opacity: 1;
    transform: translateX(0);
}

.back-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.back-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.back-btn:active {
    transform: translateY(0) scale(0.98);
}

.back-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.back-btn:hover i {
    transform: translateX(-3px);
}

.back-text {
    font-family: 'Vazirmatn', sans-serif;
    letter-spacing: 0.5px;
}

.chat-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.chat-btn:hover {
    background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

.chat-btn i {
    color: white;
}

/* Admin Back Button Styles */
.smart-back-button-admin {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smart-back-button-admin.visible {
    opacity: 1;
    transform: translateX(0);
}

.back-btn-admin {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.back-btn-admin:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
    background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%);
}

.back-btn-admin:active {
    transform: translateY(0) scale(0.98);
}

.back-btn-admin i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.back-btn-admin:hover i {
    transform: translateX(-3px);
}

.back-text-admin {
    font-family: 'Vazirmatn', sans-serif;
    letter-spacing: 0.5px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .smart-back-button,
    .smart-back-button-admin {
        top: 60px;
        right: 10px;
    }
    
    .back-btn,
    .back-btn-admin {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .back-btn i,
    .back-btn-admin i {
        font-size: 12px;
    }
}

/* Dark mode support */
.dark .back-btn {
    background: linear-gradient(135deg, #4c63d2 0%, #5a4fcf 100%);
    box-shadow: 0 4px 15px rgba(76, 99, 210, 0.4);
}

.dark .back-btn:hover {
    background: linear-gradient(135deg, #5a4fcf 0%, #4c63d2 100%);
    box-shadow: 0 8px 25px rgba(76, 99, 210, 0.6);
}

/* Animation for entrance */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.smart-back-button.visible,
.smart-back-button-admin.visible {
    animation: slideInFromRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse effect for attention */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
    100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
}

.back-btn:focus,
.back-btn-admin:focus {
    outline: none;
    animation: pulse 1s infinite;
}

/* Responsive text hiding */
@media (max-width: 480px) {
    .back-text,
    .back-text-admin {
        display: none;
    }
    
    .back-btn,
    .back-btn-admin {
        padding: 12px;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
}

/* Special styles for inline back buttons */
.inline-back-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 25px;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
    text-decoration: none;
}

.inline-back-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.5);
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    color: white;
}

.inline-back-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.inline-back-btn:hover i {
    transform: translateX(-2px);
}

/* Floating action button style */
.fab-back-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
}

.fab-back-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.fab-back-btn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility improvements */
.back-btn:focus-visible,
.back-btn-admin:focus-visible,
.inline-back-btn:focus-visible,
.fab-back-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .back-btn,
    .back-btn-admin,
    .inline-back-btn,
    .fab-back-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .smart-back-button,
    .smart-back-button-admin,
    .back-btn,
    .back-btn-admin,
    .inline-back-btn,
    .fab-back-btn {
        transition: none;
        animation: none;
    }
}