/* ============================================
   GELITUBE - Stylesheet Principal
   ============================================ */

/* === Variables / Tema === */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #717171;
    --accent: #ff4444;
    --accent-hover: #ff6666;
    --accent-gradient: linear-gradient(135deg, #ff4444, #ff8800);
    --border: #333333;
    --sidebar-width: 240px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f9f9f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #e8e8e8;
    --text-primary: #0f0f0f;
    --text-secondary: #606060;
    --text-muted: #909090;
    --border: #e0e0e0;
    --shadow: 0 4px 24px rgba(0,0,0,0.1);
}

/* === Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

ul {
    list-style: none;
}

input, select {
    font-family: inherit;
}

.hidden {
    display: none !important;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    height: var(--topbar-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.logo i {
    font-size: 28px;
    color: var(--accent);
}

.logo span {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-btn {
    font-size: 18px;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.sidebar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.theme-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-btn i {
    width: 20px;
    text-align: center;
}

/* ============================================
   MAIN WRAPPER
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 90;
}

.mobile-menu-btn {
    display: none;
    font-size: 20px;
    padding: 8px;
    color: var(--text-secondary);
}

.search-bar {
    display: flex;
    flex-grow: 1;
    max-width: 640px;
    margin: 0 auto;
    height: 40px;
}

.search-bar input {
    flex-grow: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--accent);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.voice-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: none;
    border-right: none;
    padding: 0 12px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.voice-btn:hover {
    color: var(--accent);
}

.search-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 0 20px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--bg-hover);
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.gemini-btn {
    background: var(--accent-gradient);
    color: white !important;
}

.gemini-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* ============================================
   CONTENT
   ============================================ */
.content {
    padding: 24px;
}

/* === Welcome Hero === */
.status-section {
    display: flex;
    justify-content: center;
}

.welcome-hero {
    text-align: center;
    padding: 60px 20px;
    max-width: 700px;
}

.hero-icon {
    font-size: 80px;
    color: var(--accent);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.welcome-hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-hero p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chip {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.chip:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* === Results === */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

/* === Video Grid === */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.card-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.video-card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.card-info {
    padding: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.card-author {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Load More */
.load-more {
    text-align: center;
    padding: 24px;
}

.load-more-btn {
    padding: 12px 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.load-more-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ============================================
   PLAYER SECTION
   ============================================ */
.player-wrapper {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.video-container {
    position: relative;
    padding-top: 56.25%;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-info {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.video-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.video-meta {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.video-actions {
    display: flex;
    gap: 8px;
}

.vid-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.vid-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.vid-action-btn.favorited {
    color: var(--accent);
}

.vid-action-btn.favorited i {
    font-weight: 900;
}

.related-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ============================================
   GEMINI PANEL
   ============================================ */
.gemini-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.gemini-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--accent-gradient);
    color: white;
}

.gemini-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
}

.gemini-close {
    font-size: 18px;
    color: white;
    opacity: 0.8;
    transition: var(--transition);
}

.gemini-close:hover {
    opacity: 1;
}

.gemini-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gemini-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
}

.gemini-msg.bot {
    align-self: flex-start;
}

.gemini-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.gemini-msg.bot .msg-avatar {
    background: var(--accent-gradient);
    color: white;
}

.gemini-msg.user .msg-avatar {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

.gemini-msg.bot .msg-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.gemini-msg.user .msg-bubble {
    background: var(--accent);
    color: white;
}

.msg-bubble ul {
    padding-left: 16px;
    margin-top: 6px;
}

.msg-bubble li {
    margin-bottom: 4px;
    list-style: disc;
}

.gemini-input-bar {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    gap: 8px;
}

.gemini-input-bar input {
    flex-grow: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.gemini-input-bar input:focus {
    border-color: var(--accent);
}

.gemini-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.gemini-send:hover {
    transform: scale(1.1);
}

/* ============================================
   OVERLAY
   ============================================ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 95;
    backdrop-filter: blur(2px);
}

/* ============================================
   SETTINGS MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    font-size: 18px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-item label {
    font-size: 14px;
    font-weight: 600;
}

.setting-item small {
    font-size: 12px;
    color: var(--text-muted);
}

.setting-item small a {
    color: var(--accent);
    text-decoration: underline;
}

.setting-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.setting-input:focus {
    border-color: var(--accent);
}

.save-btn {
    padding: 12px;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
}

.save-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { border-left: 4px solid #4caf50; }
.toast.error { border-left: 4px solid #f44336; }
.toast.info { border-left: 4px solid #2196f3; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(10px); }
}

/* === Loading Spinner === */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .topbar {
        padding: 0 12px;
    }

    .content {
        padding: 16px;
    }

    .welcome-hero h1 {
        font-size: 24px;
    }

    .hero-icon {
        font-size: 50px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .gemini-panel {
        width: 100%;
    }

    .video-info {
        flex-direction: column;
    }

    .video-actions {
        flex-wrap: wrap;
    }

    .vid-action-btn span {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   AUTH PAGES (login.html)
   ============================================ */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo i {
    font-size: 48px;
    color: var(--accent);
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 3px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 8px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-primary);
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--accent);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    z-index: 1;
}

.input-group input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px 12px 40px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
}

.toggle-pass {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    font-size: 14px;
    z-index: 1;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
    width: 100%;
}

.auth-btn.primary {
    background: var(--accent-gradient);
    color: white;
}

.auth-btn.primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.auth-btn.google {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    margin-top: 4px;
}

.auth-btn.google:hover {
    background: var(--bg-hover);
}

.auth-btn.guest {
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}

.auth-btn.guest:hover {
    color: var(--text-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-link {
    text-align: center;
    font-size: 13px;
    color: var(--accent);
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-error {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-error.error {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.auth-error.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--text-secondary);
}

.auth-footer-text {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ============================================
   USER PROFILE (topbar)
   ============================================ */
.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.avatar-letter {
    font-size: 16px;
    font-weight: 800;
    color: white;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    color: var(--text-muted);
    font-size: 14px;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

@media (max-width: 768px) {
    .user-name {
        display: none;
    }
}

/* ============================================
   ORANGETUBE - Login + Avatar + Descargas
   ============================================ */

/* Botón Login Google */
.btn-login {
    background: #ffffff;
    color: #333;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.btn-login:hover {
    background: #f1f1f1;
    transform: translateY(-1px);
}

.btn-login i {
    color: #ea4335;
}

/* Avatar del usuario logueado */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ff6b00;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.user-avatar:hover {
    transform: scale(1.08);
}

/* Utilidad hidden */
.hidden {
    display: none !important;
}

/* ============================================
   Modal de Descarga
   ============================================ */

.download-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

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

.download-content {
    background: var(--bg-secondary, #1a1a1a);
    color: var(--text-primary, #fff);
    border-radius: 16px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 107, 0, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.download-content h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--text-primary, #fff);
}

.download-subtitle {
    color: var(--text-muted, #999);
    margin: 0 0 18px;
    font-size: 0.88rem;
}

.download-section {
    margin: 16px 0;
}

.download-section h4 {
    margin: 0 0 10px;
    color: #ff6b00;
    font-size: 0.95rem;
}

.download-option {
    display: block;
    width: 100%;
    padding: 12px 14px;
    margin: 6px 0;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid #333;
    color: var(--text-primary, #fff);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.download-option:hover {
    background: #ff6b00;
    border-color: #ff6b00;
    color: #fff;
    transform: translateX(4px);
}

.download-cancel {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: transparent;
    color: var(--text-muted, #999);
    border: 1px solid #444;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.download-cancel:hover {
    border-color: #666;
    color: #fff;
}

/* Responsive: botones del player en móvil */
@media (max-width: 600px) {
    .video-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .vid-action-btn span {
        display: none; /* Solo iconos en móvil */
    }
    
    .btn-login span {
        display: none;
    }
    
    .btn-login {
        padding: 8px 10px;
    }
}

/* Indicador modo offline */
body.is-offline .topbar::after {
  content: "📴 Sin conexión";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ff6b00;
  color: #fff;
  text-align: center;
  padding: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 999;
}

/* borra esto si hay bub */

/* ============================================
   ORANGETUBE - NUEVOS TEMAS Y MENÚS FULLSCREEN
   ============================================ */

/* Menú de Ajustes Fullscreen */
.modal.full-modal {
    align-items: flex-start;
    padding: 0;
}
.modal.full-modal .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
}
.modal.full-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}
@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; gap: 20px; }
    .modal.full-modal .modal-body { padding: 20px; }
}

/* Modal de Temas */
.modal-content.large {
    max-width: 700px;
}
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.theme-card {
    background: #222;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}
.theme-card:hover {
    transform: scale(1.05);
    background: #2a2a2a;
}
.theme-card.active {
    border-color: #ff6b00;
}
.theme-preview {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #444;
}
.theme-card span {
    font-size: 0.85rem;
    color: #ccc;
    font-weight: 600;
}
.custom-bg-input {
    background: #222;
    padding: 16px;
    border-radius: 12px;
}

/* ============================================
   ESTILOS DE TEMAS DINÁMICOS
   ============================================ */

/* Tema Naranja Puro */
body[data-theme='orange'] {
    --bg-primary: #170900;
    --bg-secondary: #240e00;
    --text-primary: #ffffff;
    --text-muted: #ffb880;
}
body[data-theme='orange'] .topbar,
body[data-theme='orange'] .sidebar {
    background: #140700;
    border-color: #3d1700;
}

/* Fondos Animados Generales */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Tema Animado: Olas (Marrón/Naranja/Negro) */
body[data-theme='anim-waves'] {
    background: linear-gradient(-45deg, #0f0f0f, #2a1100, #000000, #3d1800);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    --bg-primary: transparent;
    --bg-secondary: rgba(20, 20, 20, 0.6);
}
body[data-theme='anim-waves'] .topbar,
body[data-theme='anim-waves'] .sidebar {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

/* Tema Animado: Nebulosa Purpura */
body[data-theme='anim-purple'] {
    background: linear-gradient(-45deg, #0a001a, #200033, #0f0f0f, #15001f);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    --bg-primary: transparent;
    --bg-secondary: rgba(20, 20, 20, 0.6);
}
body[data-theme='anim-purple'] .topbar,
body[data-theme='anim-purple'] .sidebar {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

/* Tema Imagen Personalizada */
body[data-theme='custom'] {
    background-image: var(--custom-bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    --bg-primary: transparent;
    --bg-secondary: rgba(0, 0, 0, 0.65);
}
body[data-theme='custom'] .topbar,
body[data-theme='custom'] .sidebar {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
}

/* --- SECCIONES DE CATEGORÍAS EN INICIO --- */
.category-section {
  margin-bottom: 35px;
  padding: 0 20px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.category-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-see-more {
  background: transparent;
  border: 1px solid #ff6b00; /* Naranja OrangeTube */
  color: #ff6b00;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-see-more:hover {
  background: #ff6b00;
  color: #ffffff;
}

/* --- CONTENEDOR DE SCROLL HORIZONTAL (FINITO) --- */
.category-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 10px;
  /* Ocultar barra de scroll dura */
  scrollbar-width: thin;
  scrollbar-color: #ff6b00 #1e1e1e;
}

/* Tarjeta de Video Personalizada */
.video-card {
  min-width: 260px;
  max-width: 260px;
  flex-shrink: 0;
  background-color: #181818;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(255, 107, 0, 0.2);
}

.video-thumbnail {
  width: 100%;
  height: 146px;
  object-fit: cover;
}

.video-info {
  padding: 12px;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-meta {
  font-size: 0.8rem;
  color: #aaa;
}

/* --- CONTENEDOR DE LA FILA --- */
.category-row {
  display: flex;
  gap: 16px; /* Espacio entre tarjetas */
  overflow-x: auto; /* Activa el scroll horizontal */
  padding-bottom: 15px;
  
  /* IMPORTANTE: Esto hace que en móvil se sienta como una app nativa */
  scroll-snap-type: x mandatory; 
  scroll-behavior: smooth;
  
  /* Diseño de la barra de scroll */
  scrollbar-width: thin;
  scrollbar-color: #ff6b00 #1e1e1e;
}

/* --- TARJETAS DE VIDEO NORMALES (16:9) --- */
.video-card {
  min-width: 280px; /* Ancho fijo mínimo */
  max-width: 280px; /* Ancho fijo máximo */
  flex-shrink: 0; /* IMPORTANTE: Esto evita que se aprieten o aplasten */
  scroll-snap-align: start; /* Para que al scrollear se frene justo en la tarjeta */
  
  background-color: #181818;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: 1px solid #333; /* Borde sutil */
}

/* --- NUEVO: TARJETAS DE SHORTS (9:16 Verticales) --- */
.short-card {
  min-width: 180px; /* Más delgadas */
  max-width: 180px;
  flex-shrink: 0; /* Evita que se aplasten */
  scroll-snap-align: start;
  
  background-color: #181818;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease;
  cursor: pointer;
  border: 1px solid #333;
}

/* Ajuste de las miniaturas */
.video-card .video-thumbnail {
  width: 100%;
  height: 157px; /* Proporción 16:9 para 280px */
  object-fit: cover;
}

.short-card .video-thumbnail {
  width: 100%;
  height: 320px; /* Proporción 9:16 (Vertical) */
  object-fit: cover;
}
