/* TikTok-Style Video Player - مشغل فيديو مثل تيك توك */

/* Video Modal Container */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
}

/* Main Video Container */
.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

/* Video Element */
.video-modal-player {
    width: 100%;
    max-height: 90vh;
    background: #000;
    border-radius: 0;
    object-fit: contain;
    cursor: pointer;
    outline: none;
}

.video-modal-player::-webkit-media-controls {
    display: none !important;
}

.video-modal-player::-webkit-media-controls-enclosure {
    display: none !important;
}

/* Close Button - مثل TikTok */
.video-modal-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 46px;
    height: 46px;
    background: rgba(50, 50, 50, 0.8);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-modal-close:hover {
    background: rgba(80, 80, 80, 0.9);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.video-modal-close:active {
    transform: scale(0.95);
}

/* Right Side Actions Bar - مثل TikTok */
.video-actions-sidebar {
    position: absolute;
    left: 12px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 100001;
}

.video-action-btn {
    width: 50px;
    height: 50px;
    background: rgba(50, 50, 50, 0.8);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-action-btn:hover {
    background: rgba(80, 80, 80, 0.9);
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.video-action-btn:active {
    transform: scale(0.95);
}

.video-action-btn.liked {
    background: rgba(255, 59, 92, 0.2);
    border-color: rgba(255, 59, 92, 0.5);
}

.video-action-btn.liked:hover {
    background: rgba(255, 59, 92, 0.3);
}

.video-action-btn.saved {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

.video-action-btn.saved:hover {
    background: rgba(255, 215, 0, 0.3);
}

.video-action-count {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Profile Avatar Button */
.video-profile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid white;
    cursor: pointer;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s;
    position: relative;
}

.video-profile-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-profile-btn:hover {
    transform: scale(1.15);
}

/* Follow Button on Profile */
.video-profile-follow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: #4A90E2;
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* Bottom Info Section */
.video-info-bottom {
    position: absolute;
    bottom: 0;
    left: 70px;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 100001;
}

.video-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.video-username {
    color: white;
    font-weight: 600;
    font-size: 15px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.video-follow-btn-inline {
    background: transparent;
    border: 1px solid white;
    color: white;
    padding: 4px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.video-follow-btn-inline:hover {
    background: white;
    color: #000;
}

.video-follow-btn-inline.following {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.video-caption {
    color: white;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    max-width: 90%;
}

.video-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.video-hashtag {
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.video-sound-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
}

.video-sound-icon {
    width: 16px;
    height: 16px;
}

/* Progress Bar */
.video-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 100001;
}

.video-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.1s linear;
}

/* Play/Pause Animation */
.video-play-pause-anim {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100003;
    opacity: 0;
}

.video-play-pause-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: all 0.3s ease-out;
}

.video-play-pause-anim.show .video-play-pause-icon {
    animation: playPauseScale 0.5s ease-out;
}

@keyframes playPauseScale {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Like Heart Animation */
.video-like-anim {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100003;
    opacity: 0;
}

.video-like-anim.show {
    animation: likeHeartBounce 0.8s ease-out;
}

@keyframes likeHeartBounce {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* Share Modal */
.share-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    z-index: 100004;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.share-modal.show {
    transform: translateY(0);
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.share-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.share-option:hover {
    transform: scale(1.1);
}

.share-option-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.share-option-label {
    font-size: 12px;
    color: #333;
}

/* Comments Modal */
.comments-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    background: white;
    border-radius: 16px 16px 0 0;
    z-index: 100004;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.comments-modal.show {
    transform: translateY(0);
}

.comments-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.comments-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

.comments-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ddd;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-username {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.comment-text {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

.comment-input-container {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    align-items: center;
}

.comment-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}

.comment-send-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.comment-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Dark Theme for Modals */
[data-theme="dark"] .share-modal,
[data-theme="dark"] .comments-modal {
    background: var(--bg-dark);
    color: var(--text-primary);
}

[data-theme="dark"] .share-modal-title,
[data-theme="dark"] .comments-modal-title,
[data-theme="dark"] .comment-username {
    color: var(--text-primary);
}

[data-theme="dark"] .share-option-icon {
    background: var(--bg-grey);
}

[data-theme="dark"] .share-option-label,
[data-theme="dark"] .comment-text {
    color: var(--text-secondary);
}

[data-theme="dark"] .comment-input {
    background: var(--bg-grey);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Navigation Arrows */
.video-nav-arrows {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 100001;
}

.video-nav-arrow {
    width: 46px;
    height: 46px;
    background: rgba(50, 50, 50, 0.8);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-nav-arrow:hover:not(.disabled) {
    background: rgba(80, 80, 80, 0.9);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.video-nav-arrow:active:not(.disabled) {
    transform: scale(0.95);
}

.video-nav-arrow.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.video-nav-arrow svg {
    pointer-events: none;
}

/* Video Counter - مخفي */
.video-counter {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(50, 50, 50, 0.9);
    backdrop-filter: blur(15px);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100001;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .video-modal-content {
        max-width: 100%;
    }
    
    .video-modal-player {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .video-actions-sidebar {
        left: 8px;
        bottom: 80px;
    }
    
    .video-info-bottom {
        left: 70px;
        right: auto;
        padding: 16px;
    }
    
    .share-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .video-nav-arrows {
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .video-counter {
        top: 10px;
        right: 10px;
        left: auto;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Loading Spinner */
.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    gap: 20px;
}

.video-loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #FF3B5C;
    border-right-color: #00D9FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.video-loading::after {
    content: 'جاري التحميل...';
    color: white;
    font-size: 16px;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Muted Indicator */
.video-muted-indicator {
    position: absolute;
    bottom: 120px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 100001;
}

/* Volume Control - أعلى اليمين بدل العداد */
.video-volume-control {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(50, 50, 50, 0.9);
    backdrop-filter: blur(15px);
    padding: 8px;
    border-radius: 30px;
    z-index: 100001;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    max-width: 50px;
    overflow: hidden;
}

.video-volume-control:hover {
    background: rgba(60, 60, 60, 0.95);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    max-width: 200px;
}

.video-volume-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.video-volume-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.video-volume-slider {
    width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
}

.video-volume-control:hover .video-volume-slider {
    width: 80px;
    opacity: 1;
    margin-left: 8px;
}

.video-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.video-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}


/* ========================================
   🎨 Enhanced Profile Avatar Styles
   ======================================== */

/* Profile Avatar Image */
.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Profile Avatar Letter (fallback) */
.profile-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4A90E2 0%, #5B9BD5 100%);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Enhanced Profile Button */
.video-profile-btn {
    width: 56px;
    height: 56px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.video-profile-btn:hover {
    transform: scale(1.05);
}

/* Follow Button (+) - Only show when needed */
.video-profile-follow {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: #4A90E2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border: 3px solid #000;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.5);
    transition: all 0.3s ease;
}

.video-profile-follow:hover {
    background: #2E5F8F;
    transform: translateX(-50%) scale(1.1);
}

/* Username Display */
.video-username {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
}

/* Follow Button Inline */
.video-follow-btn-inline {
    margin-left: 12px;
    padding: 6px 16px;
    background: #4A90E2;
    border: 2px solid #fff;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.4);
}

.video-follow-btn-inline:hover {
    background: #2E5F8F;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.6);
}

.video-follow-btn-inline.following {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.8);
}

.video-follow-btn-inline.following:hover {
    background: rgba(255, 59, 92, 0.2);
    border-color: #FF3B5C;
    color: #fff;
}

/* User Info Container */
.video-user-info {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    animation: slideInLeft 0.5s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-profile-btn {
        width: 48px;
        height: 48px;
    }
    
    .profile-avatar-letter {
        font-size: 18px;
    }
    
    .video-profile-follow {
        width: 20px;
        height: 20px;
        font-size: 16px;
        border-width: 2px;
    }
    
    .video-username {
        font-size: 14px;
    }
    
    .video-follow-btn-inline {
        padding: 4px 12px;
        font-size: 12px;
    }
}
