/* RA Toolz - Ultimate Thumbnail Tester (Complete CSS) */

.hidden { display: none !important; }
.ytt-main-icon { color: #ff0000; }
.ytt-flex-1 { flex: 1; min-width: 0; }
.w-100 { width: 100%; }
.w-50 { width: 50%; }
.text-success { color: #10b981; }
.text-muted { color: #64748b; font-size: 0.85rem; }
.text-primary { color: #3b82f6 !important; }

/* The Embedded App Container */
.ytt-embedded-app {
    display: flex; flex-direction: column; background: var(--bg-card); 
    border: 1px solid var(--border); border-radius: 20px; overflow: hidden; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.05); margin: 20px 0;
}

/* TOP CONTROLS SECTION */
.ytt-top-controls { padding: 25px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.ytt-controls-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ytt-control-box { background: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid var(--border); display: flex; flex-direction: column; }
.ytt-section-title { font-size: 1.05rem; font-weight: 800; color: var(--text-main); margin-bottom: 15px; }

/* Global Upload Box */
.ytt-clickable-zone { 
    cursor: pointer; transition: 0.3s; padding: 25px 15px; 
    text-align: center; border-radius: 12px; background: var(--bg-input); border: 2px dashed var(--border);
}
.ytt-clickable-zone:hover { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.ytt-clickable-zone h4 { margin: 10px 0 5px 0; font-size: 1rem; color: var(--text-main); font-weight: 700; }
.ytt-clickable-zone p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

/* User Thumbnail Tray (Smart Reorder) */
.ytt-tray { display: flex; flex-wrap: wrap; gap: 12px; }
.ytt-mini-thumb-wrapper { display: flex; flex-direction: column; gap: 5px; width: 85px; }
.ytt-mini-thumb {
    width: 85px; height: 48px; border-radius: 6px; position: relative;
    cursor: pointer; flex-shrink: 0; border: 2px solid transparent; overflow: hidden;
}
.ytt-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ytt-mini-thumb.active { border-color: var(--primary); box-shadow: 0 0 10px rgba(37,99,235,0.3); }

/* Reorder Actions */
.ytt-thumb-actions { display: flex; justify-content: space-between; background: var(--bg-input); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.ytt-thumb-actions button { background: transparent; border: none; color: var(--text-muted); font-size: 10px; padding: 4px 0; flex: 1; cursor: pointer; transition: 0.2s; }
.ytt-thumb-actions button:hover { background: var(--border); color: var(--text-main); }
.ytt-thumb-actions button.del-btn:hover { background: #ef4444; color: #fff; }

.ytt-add-more-btn {
    width: 85px; height: 48px; border: 2px dashed var(--border); border-radius: 6px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--text-muted); font-size: 1.2rem; transition: 0.2s;
}
.ytt-add-more-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Competitor Fixes */
.ytt-tray-vertical { display: flex; flex-direction: column; gap: 10px; max-height: 180px; overflow-y: auto; padding-right: 5px;}
.ytt-tray-vertical::-webkit-scrollbar { width: 4px; }
.ytt-tray-vertical::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.ytt-comp-item {
    display: flex; gap: 10px; background: var(--bg-input); border: 1px solid var(--border);
    padding: 8px; border-radius: 8px; align-items: flex-start; width: 100%; box-sizing: border-box;
}
.ytt-comp-item img { width: 70px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.ytt-comp-info { flex: 1; min-width: 0; }
.ytt-comp-title { 
    font-size: 0.85rem; font-weight: 700; margin: 0 0 2px 0; color: var(--text-main);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; 
    white-space: normal; line-height: 1.3;
}
.ytt-comp-meta { font-size: 0.75rem; color: var(--text-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Buttons & Inputs */
.ytt-input-group { display: flex; gap: 8px; }
.ytt-btn-primary { background: var(--primary); border: none; color: #fff; padding: 10px 15px; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.ytt-warning-text { color: #ef4444; font-size: 0.8rem; font-weight: 600; display: block; margin-top: 5px; }

/* BOTTOM STAGE */
.ytt-main-stage {
    display: flex; flex-direction: column; background: #f9f9f9;
    color: #0f0f0f; transition: background 0.3s; min-height: 600px;
    --yt-bg: #ffffff; --yt-meta: #606060; --yt-border: #e5e5e5;
}

.ytt-main-stage.dark-mode {
    background: #0f0f0f; color: #f1f1f1;
    --yt-bg: #0f0f0f; --yt-meta: #aaaaaa; --yt-border: #222222;
}

/* Fullscreen Mode Classes */
.ytt-main-stage:fullscreen { overflow-y: auto; }
.ytt-main-stage:-webkit-full-screen { overflow-y: auto; }
.ytt-main-stage:-ms-fullscreen { overflow-y: auto; }

/* Stage Toolbar */
.ytt-stage-toolbar {
    display: flex; justify-content: space-between; padding: 15px 25px; flex-wrap: wrap; gap: 10px;
    background: rgba(15,15,15,0.05); border-bottom: 1px solid rgba(128,128,128,0.1);
    position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px);
}
.ytt-main-stage.dark-mode .ytt-stage-toolbar { background: rgba(255,255,255,0.05); }

.ytt-tool-toggles, .ytt-view-toggles { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;}
.ytt-tool-btn, .ytt-view-btn {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main);
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: 0.2s;
}
.ytt-tool-btn.active, .ytt-view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Dynamic Rendering Classes */
.ytt-preview-container { padding: 40px 20px; display: flex; gap: 20px; align-items: center; justify-content: center;}

.yt-card { display: flex; flex-direction: column; gap: 12px; transition: 0.3s; width: 100%; border: none; padding: 0; background: transparent; }
.yt-thumb-wrapper { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #222; }
.yt-thumb-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.yt-duration { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.8); color: #fff; padding: 3px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; z-index: 5; }

.yt-details { display: flex; gap: 12px; }
.yt-avatar { width: 36px; height: 36px; border-radius: 50%; background: #555; flex-shrink: 0; }
.display-title { font-size: 1rem; font-weight: 600; margin: 0 0 4px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; color: inherit; word-wrap: break-word;}
.yt-meta { font-size: 0.85rem; color: var(--yt-meta); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Safe Zones & Squint */
.ytt-safe-zone {
    position: absolute; background: rgba(239, 68, 68, 0.7); border: 1px dashed #fff;
    color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: 0.3s; pointer-events: none; z-index: 4; font-weight: bold;
}
.show-safe-zones .sz-duration { bottom: 8px; right: 8px; width: 45px; height: 20px; border-radius: 4px; opacity: 1; }
.show-safe-zones .user-duration { opacity: 0; }
.show-safe-zones .sz-watch-later { top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 4px; opacity: 1; }
.show-safe-zones .sz-subtitles { top: 8px; right: 45px; width: 30px; height: 30px; border-radius: 4px; opacity: 1; }
.show-squint .target-image { filter: grayscale(100%) blur(4px); }

/* View Modes */
.view-mobile { flex-direction: column; width: 100%; max-width: 400px; margin: 0 auto; }
.view-mobile .yt-card { border-bottom: 1px solid var(--yt-border); padding-bottom: 15px; border-radius: 0; }
.view-mobile .yt-thumb-wrapper { border-radius: 0; }

.view-abtest { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.view-abtest .yt-card { width: 320px; background: var(--yt-bg); padding: 15px; border-radius: 16px; border: 1px solid var(--yt-border); }
.ytt-ab-badge { background: var(--primary); color:#fff; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-bottom: 10px; display: inline-block;}

.view-desktop { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: 1200px;}
.view-desktop .yt-card { width: 320px; }

.view-search { flex-direction: column; max-width: 800px; margin: 0 auto; }
.view-search .yt-card { flex-direction: row; gap: 16px; border-bottom: 1px solid var(--yt-border); padding-bottom: 15px;}
.view-search .yt-thumb-wrapper { width: 360px; flex-shrink: 0; }
.view-search .yt-details { min-width: 0; }
.view-search .yt-avatar { width: 24px; height: 24px; }
.view-search .display-title { font-size: 1.1rem; }

/* 🔴 REALISTIC WATCH PAGE (RELATED TAB) 🔴 */
.view-sidebar { display: flex; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; box-sizing: border-box; }
.yt-watch-layout { display: flex; gap: 24px; width: 100%; align-items: flex-start; }

.yt-player-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.yt-fake-player { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: rgba(255,255,255,0.2); }
.yt-watch-title { font-size: 1.25rem; font-weight: 700; margin: 10px 0 5px 0; color: inherit; line-height: 1.4; }
.yt-watch-actions { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--yt-border); flex-wrap: wrap; gap: 10px; }
.yt-watch-channel-box { display: flex; align-items: center; gap: 12px; }
.yt-watch-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-input); }
.yt-watch-sub-btn { background: var(--text-main); color: var(--bg-card); padding: 8px 16px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; cursor: pointer; border: none; }
.yt-watch-meta-btns { display: flex; gap: 8px; }
.yt-watch-pill { background: var(--bg-input); padding: 8px 15px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }

.yt-watch-description { background: var(--bg-input); padding: 12px; border-radius: 12px; font-size: 0.85rem; line-height: 1.5; color: inherit; margin-top: 10px; }
.yt-watch-comments { margin-top: 20px; display: flex; flex-direction: column; gap: 15px; text-align: left; }
.yt-comment-fake { display: flex; gap: 12px; }
.yt-comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-input); flex-shrink: 0; }
.yt-comment-text-box { display: flex; flex-direction: column; gap: 4px; }
.yt-comment-user { font-size: 0.8rem; font-weight: 700; }
.yt-comment-msg { font-size: 0.85rem; opacity: 0.9; }

/* Sidebar List Fix for Watch Page */
.yt-sidebar-list { width: 380px; display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.yt-sidebar-list .yt-card { flex-direction: row; gap: 8px; width: 100%; border: none; padding: 0; }
.yt-sidebar-list .yt-thumb-wrapper { width: 168px; border-radius: 8px; flex-shrink: 0; }
.yt-sidebar-list .yt-details { padding: 0; min-width: 0; }
.yt-sidebar-list .yt-avatar { display: none; }
.yt-sidebar-list .display-title { font-size: 0.9rem; -webkit-line-clamp: 2; margin-bottom: 2px; font-weight: 600; }
.yt-sidebar-list .yt-meta { font-size: 0.75rem; white-space: normal; }

/* Scroll Animation */
.view-scroll { flex-direction: column; max-width: 360px; margin: 0 auto; border: 10px solid #222; border-radius: 30px; height: 600px; overflow: hidden; padding: 0; background: var(--yt-bg); position: relative; }
.scroll-feed-inner { width: 100%; }
.view-scroll .yt-card { margin-bottom: 20px; border-radius: 0; }
.scroll-animating { animation: scrollFeedAnim 10s linear forwards; }

@keyframes scrollFeedAnim {
    0% { transform: translateY(0); }
    15% { transform: translateY(-300px); }
    30% { transform: translateY(-300px); }
    50% { transform: translateY(-700px); }
    70% { transform: translateY(-700px); }
    100% { transform: translateY(-1500px); }
}

@media (max-width: 992px) {
    .ytt-controls-grid { grid-template-columns: 1fr; }
    .view-search .yt-card { flex-direction: column; }
    .view-search .yt-thumb-wrapper { width: 100%; }
    .yt-watch-layout { flex-direction: column; }
    .yt-sidebar-list { width: 100%; }
}
