/* --- Page header --- */

.video-reels-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 24px;
}

.video-reels-page-subtitle {
    color: #71717a;
    font-size: 15px;
}

/* --- Card --- */

.video-reel-card {
    cursor: pointer;
}

.video-reel-card-preview {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: #111;
    aspect-ratio: 9 / 14;
}

.video-reel-card-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(22px) brightness(.5);
    transform: scale(1.18);
}

.video-reel-card-preview > img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.video-reel-card:hover .video-reel-card-preview > img {
    transform: scale(1.08);
}

.video-reel-card-play {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 42%;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 22px;
}

.video-reel-card-stats {
    position: absolute;
    z-index: 3;
    right: 10px;
    top: 42%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.video-reel-card-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.7);
}

.video-reel-card-stat-item i {
    font-size: 20px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.8));
}

.video-reel-card-stat-item span {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.video-reel-card-flag {
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 10px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .65));
}

.video-reel-card-flag .flag-icon {
    width: 24px;
    height: 17px;
    border-radius: 3px;
}

/* Gradient overlay at bottom of card - name + verified + stats */

.video-reel-card-overlay {
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,.82) 0%, transparent 100%);
    border-radius: 0 0 20px 20px;
}

.video-reel-card-overlay-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.reel-card-avatar {
    display: inline-flex;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.78);
    position: relative;
}

.reel-card-overlay-text {
    min-width: 0;
    flex: 1;
}

.video-reel-card-overlay-name {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reel-card-verified {
    color: #3b8de3;
    font-size: 12px;
    margin-left: 3px;
    vertical-align: middle;
}

.video-reel-card-overlay-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, .88);
    font-size: 12px;
    font-weight: 700;
}

.reel-card-sep {
    opacity: .55;
}

.video-reel-card-body {
    padding: 7px 2px 0;
}

.video-reel-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #71717a;
    font-size: 13px;
}

.video-reel-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- My Reels list card --- */

.video-reel-my-card-thumb {
    position: relative;
    cursor: pointer;
}

.video-reel-my-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-reel-my-card-duration {
    position: absolute;
    bottom: 5px;
    right: 6px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    z-index: 2;
}

.video-reel-my-card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.3);
    color: #fff;
    font-size: 20px;
    opacity: 0;
    transition: opacity .2s;
    z-index: 2;
}

.video-reel-my-card-thumb:hover .video-reel-my-card-play {
    opacity: 1;
}

/* --- Empty state --- */

.video-reels-empty {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    color: #71717a;
}

.video-reels-empty i {
    font-size: 38px;
}

/* --- Modal --- */

#reels-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1030;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

#reels-modal.is-open {
    display: flex;
}

#reels-slide-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reels-player {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    cursor: pointer;
}

/* --- Progress bar --- */

#reels-progress {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 12;
    height: 3px;
    width: 0%;
    background: linear-gradient(to right, #6bbef9, #fff);
    transition: width 100ms linear;
}

/* --- Slide animations --- */

.reel-anim {
    will-change: transform, opacity;
}

.slide-up-in {
    animation: slideUpIn 320ms ease both;
}

.slide-down-in {
    animation: slideDownIn 320ms ease both;
}

@keyframes slideUpIn {
    from { transform: translateY(18%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDownIn {
    from { transform: translateY(-18%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Side controls --- */

#reels-controls,
#reels-main-controls {
    position: absolute;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: #fff;
    user-select: none;
}

#reels-controls {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

#reels-like .btn-label,
#reels-views .btn-label,
#reels-reply .btn-label {
    display: none;
}

#reels-main-controls {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 0;
    outline: 0;
    background: none;
    color: #fff;
    cursor: pointer;
    will-change: transform;
    transform: translateZ(0);
    transition: transform .2s ease, opacity .2s ease;
}

.control-btn:hover {
    opacity: .72;
    transform: scale(1.05) translateZ(0);
}

.control-btn i {
    font-size: 20px;
    line-height: 1;
}

.control-btn .btn-label,
.control-btn .like-count,
.control-btn .views-count,
.control-btn .reply-count {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, .9));
}

.btn-label {
    font-size: 8px;
    line-height: 8px;
    letter-spacing: .6px;
    opacity: .86;
    font-weight: 900;
    text-transform: uppercase;
}

#reels-like i.liked {
    color: #ff4d6a;
}

#reels-like-count,
#reels-views-count,
#reels-reply-count {
    font-size: 11px;
    margin-top: -2px;
    opacity: .9;
    font-weight: 900;
}

#reels-main-controls .badge {
    display: inline-block;
    margin-top: -2px;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    min-width: 40px;
    text-align: center;
}

#reels-main-controls .badge.on {
    background: rgba(0, 200, 0, .25);
}

#reels-main-controls .badge.off {
    background: rgba(200, 0, 0, .25);
}

/* --- Close button --- */

#reels-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 22;
    border: 0;
    outline: 0;
    background: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    transition: transform .2s ease, opacity .2s ease;
}

#reels-close:hover {
    opacity: .65;
    transform: scale(1.1);
}

/* --- Overlay play button --- */

#reel-overlay-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 14;
    display: none;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    color: #fff;
    font-size: 70px;
    cursor: pointer;
    transform: translate(-50%, -50%);
    animation: reelsPulse 2s infinite;
}

@keyframes reelsPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: .62; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#autoplay-count-display {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 21;
    color: #fff;
    font-size: 12px;
    opacity: .72;
}

/* --- Author box (modal info panel) --- */

.reel-author-box {
    position: absolute;
    left: 50%;
    bottom: 20px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 120px));
    padding: 10px 13px;
    border-radius: 14px;
    background: rgba(30, 28, 28, .15);
    color: #fff;
    transform: translateX(-50%);
}

.reel-author-avatar {
    width: 66px;
    height: 104px;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 8px;
    background: #111;
}

.reel-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reel-author-content {
    flex: 1;
    min-width: 0;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .85), 0 0 12px rgba(0, 0, 0, .6);
}

/* Name row: nickname + verified badge */

.reel-author-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.reel-author-name {
    display: inline-block;
    margin-bottom: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: .06em;
    line-height: 1.15;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reel-author-name:hover {
    color: #6bbef9;
}

.reel-verified-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: #3b8de3;
    font-size: 15px;
}

/* Meta row: flag + age / price / rating */

.reel-author-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, .9);
    font-size: 13px;
    font-weight: 700;
}

.reel-flag-wrapper {
    display: inline-flex;
    align-items: center;
    margin-right: 2px;
}

.reel-flag-wrapper .flag-icon {
    width: 22px;
    height: 15px;
    border-radius: 3px;
}

.meta-separator {
    opacity: .45;
    font-weight: 400;
}

/* Location + distance row */

.reel-author-location {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
    font-weight: 600;
}

.reel-distance-meta:not(:empty)::before {
    content: "\00B7";
    margin-right: 5px;
    opacity: .5;
}

/* Caption / description */

.reel-caption {
    margin-bottom: 3px;
    color: rgba(255, 255, 255, .92);
    font-size: 13px;
    font-weight: 700;
}

.reel-description {
    max-height: 38px;
    overflow: hidden;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, .65);
    font-size: 12px;
}

/* Hide empty elements + orphan separators */

.reel-caption:empty,
.reel-description:empty,
.reel-author-meta .meta-item:empty,
.reel-author-location .meta-item:empty,
.meta-item:empty + .meta-separator,
.meta-separator:has(+ .meta-item:empty) {
    display: none;
}

/* Open ad button */

.reel-ad-outline-btn {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all .2s ease;
}

.reel-ad-outline-btn:hover {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255,255,255,.85);
    color: #fff;
}

/* --- Body states --- */

body.reels-open {
    overflow: hidden !important;
}

body.reels-ui-hidden #reels-controls,
body.reels-ui-hidden .reel-author-box,
body.reels-ui-hidden #autoplay-count-display {
    display: none !important;
}

body.reels-ui-hidden #reels-main-controls .control-btn:not(#reels-toggle-ui) {
    visibility: hidden !important;
}

/* --- Loading spinner --- */

#reels-modal.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 30;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid rgba(255, 255, 255, .18);
    border-top-color: #fff;
    border-radius: 50%;
    animation: reelsLoader .7s linear infinite;
}

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

/* --- Responsive --- */

@media (max-width: 600px) {
    #reels-controls {
        right: 2px;
    }

    #reels-main-controls {
        left: 2px;
    }

    .reel-author-box {
        left: 10px;
        right: 48px;
        bottom: 14px;
        width: auto;
        transform: none;
        padding: 8px 10px;
        gap: 9px;
    }

    .reel-author-avatar {
        width: 46px;
        height: 72px;
    }

    .reel-author-name {
        font-size: 14px;
    }

    .reel-description {
        display: none;
    }
}

/* --- First-load instant preview --- */

#reels-first-load-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#reels-modal.reel-prefetch #reels-first-load-cover {
    opacity: 1;
}

#reels-modal.reel-prefetch #reels-controls,
#reels-modal.reel-prefetch .reel-author-box,
#reels-modal.reel-prefetch #reels-progress {
    visibility: hidden;
}

#reels-first-load-blur {
    position: absolute;
    inset: -8%;
    background-size: cover;
    background-position: center;
    filter: blur(22px) brightness(0.38);
}

#reels-first-load-spinner {
    position: relative;
    z-index: 1;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.82);
    border-radius: 50%;
    animation: reel-first-spin 0.72s linear infinite;
}

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

/* --- Like burst animation --- */

#reel-like-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 30;
    font-size: 96px;
    color: #ff2d55;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    filter: drop-shadow(0 0 24px rgba(255, 45, 85, .75));
}

#reel-like-burst.burst-active {
    animation: reelHeartBurst 1.1s cubic-bezier(0.17, 0.67, 0.35, 1.2) forwards;
}

@keyframes reelHeartBurst {
    0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.2); }
    30%  { opacity: 1;   transform: translate(-50%, -50%) scale(1.35); }
    55%  { opacity: 1;   transform: translate(-50%, -50%) scale(1.0); }
    100% { opacity: 0;   transform: translate(-50%, -72%) scale(0.85); }
}

/* --- Pagination / swiper (video reels specific) --- */

.video-reels-pagination .pagination {
    justify-content: center;
}

.video-reels-swiper .swiper-pagination {
    position: static;
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

/* --- Promo card --- */

.video-reel-card-promo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1b40 0%, var(--primary) 100%);
    color: #fff;
    gap: 12px;
    padding: 24px;
    text-align: center;
}

.video-reel-card-promo-icon {
    font-size: 40px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
    transition: transform 0.25s ease;
}

.video-reel-card-promo-text {
    font-size: 15px;
    font-weight: 600;
    position: relative;
    z-index: 2;
    transition: transform 0.25s ease;
}

.video-reel-card-promo:hover .video-reel-card-promo-icon,
.video-reel-card-promo:hover .video-reel-card-promo-text {
    transform: scale(1.15);
}
