/* ===========================================
   REELS UI - YouTube Shorts Style with Scroll
   9:16 Portrait Aspect Ratio - FULL SCREEN
   =========================================== */

/* Reels Mini Popup (Bottom Left Corner) */
.reels-mini-popup {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 100px;
    height: 178px;
    /* 9:16 ratio */
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: reelsSlideIn 0.5s ease-out;
    display: none;
}

.reels-mini-popup:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 82, 82, 0.5);
}

@keyframes reelsSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.reels-mini-popup .mini-video-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.reels-mini-popup video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reels-mini-popup .mini-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
}

.reels-mini-popup .mini-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.reels-mini-popup .reels-badge {
    background: linear-gradient(135deg, #ff5252, #ff1744);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 3px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reels-mini-popup .close-btn {
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.reels-mini-popup .close-btn:hover {
    background: rgba(255, 82, 82, 0.8);
}

.reels-mini-popup .mini-footer {
    text-align: center;
}

.reels-mini-popup .watch-text {
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.reels-mini-popup .tap-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 8px;
    margin-top: 2px;
}

.reels-mini-popup .tap-indicator i {
    animation: pulse 1.5s infinite;
}

/* Full Screen Reels Player */
.reels-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: none;
    animation: fadeIn 0.3s ease;
}

.reels-fullscreen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Main Reels Container - MAXIMIZED 9:16 Portrait */
.reels-container {
    position: relative;
    /* Calculate max width based on viewport height for 9:16 */
    width: calc(100vh * 9 / 16);
    max-width: 100vw;
    height: 100vh;
    margin: 0 auto;
    background: #000;
}

/* Mobile - full width */
@media (max-width: 480px) {
    .reels-container {
        width: 100vw;
        max-width: 100vw;
    }
}

/* Scroll Container */
.reels-scroll-container {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.reels-scroll-container::-webkit-scrollbar {
    display: none;
}

.reel-scroll-item {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    flex-shrink: 0;
    background: #000;
}

.reel-scroll-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Reel Overlay */
.reel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.2) 0%,
            transparent 12%,
            transparent 75%,
            rgba(0, 0, 0, 0.4) 100%);
}

/* Header Controls */
.reels-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
}

.reels-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reels-title h2 {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.reels-logo {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #ff5252, #ff1744);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reels-logo i {
    color: white;
    font-size: 12px;
}

.reels-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.reels-close-btn:hover {
    background: rgba(255, 82, 82, 0.8);
    transform: scale(1.1);
}

/* Volume Control */
.volume-btn {
    position: absolute;
    top: 60px;
    right: 16px;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
}

.volume-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Side Actions */
.reel-actions {
    position: absolute;
    right: 10px;
    bottom: 140px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: auto;
    z-index: 50;
}

.reel-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
}

.reel-action-btn:hover {
    transform: scale(1.15);
}

.reel-action-btn .action-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.reel-action-btn:hover .action-icon {
    background: rgba(255, 255, 255, 0.25);
}

.reel-action-btn.liked .action-icon {
    background: #ff5252;
    color: white;
}

.reel-action-btn.liked .action-icon i {
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.reel-action-btn .action-count {
    font-size: 11px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Reel Info */
.reel-info {
    position: absolute;
    left: 12px;
    right: 65px;
    bottom: 50px;
    pointer-events: auto;
    z-index: 50;
}

.reel-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.author-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #ff5252, #ff1744);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 700;
    border: 2px solid white;
    flex-shrink: 0;
}

.author-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    flex-shrink: 0;
}

.author-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.author-name {
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.author-fullname {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.reel-description {
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin: 0 0 5px 0;
}

.reel-title {
    color: #00d4ff;
    font-size: 11px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Play/Pause Indicator */
.play-pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    pointer-events: none;
    z-index: 60;
}

.play-pause-indicator.show {
    transform: translate(-50%, -50%) scale(1);
    animation: fadeOutScale 0.8s ease forwards;
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.play-pause-indicator i {
    color: white;
    font-size: 26px;
}

/* Loading Spinner */
.reel-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ff5252;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Comments Panel (Right Side) - HIDDEN BY DEFAULT
   ========================================== */

.comments-panel {
    position: fixed;
    top: 0;
    right: -420px;
    /* Start off-screen */
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
}

.comments-panel.active {
    right: 0;
}

.comments-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.comments-header h3 {
    color: white;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-count-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.close-comments-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-comments-btn:hover {
    background: rgba(255, 82, 82, 0.8);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.comments-list::-webkit-scrollbar {
    width: 4px;
}

.comments-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-avatar-placeholder {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.comment-username {
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.comment-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
}

.comment-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    word-wrap: break-word;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.no-comments i {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.no-comments p {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: white;
}

.no-comments span {
    font-size: 12px;
}

.comments-loading {
    display: flex;
    justify-content: center;
    padding: 30px;
}

/* Comment Input Area */
.comment-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.comment-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-input-wrapper input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 10px 16px;
    color: white;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.comment-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.comment-input-wrapper input:focus {
    border-color: #ff5252;
    background: rgba(255, 255, 255, 0.15);
}

.comment-submit-btn {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #ff5252, #ff1744);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.comment-submit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.4);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   Share Modal
   ========================================== */

.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10002;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.share-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.share-modal-content {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.share-modal.active .share-modal-content {
    transform: translateY(0);
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.share-modal-header h3 {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.close-share-modal {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-share-modal:hover {
    background: rgba(255, 82, 82, 0.8);
}

.share-options {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    flex-wrap: wrap;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 12px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.share-option:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.share-option i {
    font-size: 22px;
}

.share-option span {
    font-size: 10px;
    font-weight: 500;
}

.share-option.whatsapp i {
    color: #25D366;
}

.share-option.facebook i {
    color: #1877F2;
}

.share-option.twitter i {
    color: #1DA1F2;
}

.share-option.telegram i {
    color: #0088CC;
}

.share-option.copy-link i {
    color: #ff5252;
}

/* ==========================================
   Order Waiting Popup
   ========================================== */

.order-reels-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    z-index: 10001;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.order-reels-popup.active {
    display: flex;
}

.order-reels-header {
    padding: 14px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.order-reels-header h3 {
    color: white;
    font-size: 15px;
    margin: 0 0 5px 0;
}

.order-reels-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin: 0;
}

.order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.order-status-badge i {
    animation: spin 2s linear infinite;
}

.skip-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 11;
}

.skip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.order-reels-scroll {
    width: calc(100vh * 9 / 16);
    max-width: 100vw;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.order-reels-scroll::-webkit-scrollbar {
    display: none;
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .reels-mini-popup {
        width: 80px;
        height: 142px;
        bottom: 15px;
        left: 15px;
    }

    .reels-container {
        width: 100vw;
    }

    .comments-panel {
        max-width: 100%;
        right: -100%;
    }

    .reel-actions {
        right: 8px;
        bottom: 120px;
        gap: 12px;
    }

    .reel-action-btn .action-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .reel-info {
        left: 10px;
        right: 55px;
        bottom: 40px;
    }

    .author-avatar,
    .author-avatar-img {
        width: 34px;
        height: 34px;
    }

    .reel-description {
        font-size: 11px;
    }
}