/* --- WP ReelStream: High Fidelity UI --- */

/* 1. Variables & Reset */
:root {
    --rs-primary: #ba938d;
    --rs-primary-dark: #a07a75;
    --rs-white: #ffffff;
    --rs-black: #000000;
    --rs-glass: rgba(255, 255, 255, 0.15);
    --rs-overlay-gradient: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0.85) 100%);
    --rs-font: 'Inter', system-ui, -apple-system, sans-serif;
    --rs-radius: 12px;
    --rs-z-modal: 999999;
}

.reelstream-directory-grid,
.reelstream-upload-container,
.reelstream-modal {
    box-sizing: border-box;
    font-family: var(--rs-font);
}

.reelstream-directory-grid *,
.reelstream-modal * {
    box-sizing: border-box;
}

/* 2. Upload Form (Clean & Minimal) */
.reelstream-upload-container {
    max-width: 480px;
    margin: 40px auto;
    padding: 30px;
    background: var(--rs-white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.reelstream-form-group {
    margin-bottom: 20px;
}

.reelstream-form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.reelstream-form-group input,
.reelstream-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fafafa;
    font-size: 14px;
}

.reelstream-form-group input:focus {
    border-color: var(--rs-primary);
    background: #fff;
    outline: none;
}

.reelstream-btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--rs-primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.reelstream-btn-primary:hover {
    opacity: 0.9;
}

/* 3. Feed / Preview Grid */
.reelstream-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.reelstream-grid-item {
    position: relative;
    aspect-ratio: 9 / 16;
    background: #111;
    border-radius: var(--rs-radius);
    overflow: hidden;
    cursor: pointer;
    transform: translateZ(0);
    /* Fix flickering */
}

/* Image Fills 100% - No Gaps */
.reelstream-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.reelstream-grid-item:hover img {
    transform: scale(1.05);
}

/* Play Icon - Absolute Centered */
.reelstream-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reelstream-play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent white;
    margin-left: 3px;
}

/* Overlay Info - Bottom Aligned */
.reelstream-grid-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: var(--rs-overlay-gradient);
    color: white;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.rs-preview-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.rs-preview-meta {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    gap: 10px;
}

/* 4. Full Screen Modal Viewer (The "App" Experience) */
/* 4. Full Screen Modal Viewer (The "App" Experience) */
.reelstream-modal {
    display: flex;
    /* Always flex for centering */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: var(--rs-z-modal);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.reelstream-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Close Button (Global) */
.reelstream-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
}

/* The "Phone" Container */
.rs-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Desktop sizing to simulate phone */
@media (min-width: 768px) {
    .rs-viewer-container {
        width: 400px;
        /* Standard mobile width */
        height: 85vh;
        max-height: 850px;
        border-radius: 20px;
    }
}

.rs-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Video Fills Container */
.rs-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Crucial for TikTok feel */
}

/* UI Overlay Layer */
.rs-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 60px;
    /* Space for side buttons */
    padding: 20px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    z-index: 20;
    pointer-events: none;
}

.rs-author {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px black;
}

.rs-caption {
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.9;
    text-shadow: 0 1px 3px black;
}

/* Right Side Actions */
.rs-actions {
    position: absolute;
    bottom: 40px;
    right: 10px;
    width: 50px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 30;
    align-items: center;
}

.rs-action-btn {
    color: white;
    text-align: center;
    cursor: pointer;
}

.rs-action-btn:active {
    transform: scale(0.9);
}

.rs-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rs-icon.active {
    color: var(--rs-primary);
    background: rgba(255, 255, 255, 0.9);
}

.rs-count {
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px black;
    display: block;
}

/* Nav Controls (Outside Container on Desktop) */
.rs-nav-controls {
    z-index: 10000;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rs-nav-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.rs-nav-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Comments Drawer */
.rs-comments-drawer {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: white;
    border-radius: 16px 16px 0 0;
    z-index: 100;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.rs-comments-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rs-comments-list {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    color: #333;
}

.rs-comment-item {
    margin-bottom: 15px;
    font-size: 13px;
}

.rs-comment-item strong {
    display: block;
    color: #777;
    font-size: 11px;
    margin-bottom: 2px;
}

.rs-comment-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.rs-comment-input-area input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #f5f5f5;
}

.rs-comment-input-area button {
    background: var(--rs-primary);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
}