/* VVStreamer Main Stylesheet */

:root {
    --primary: #ff0000;
    --primary-dark: #cc0000;
    --bg: #f9f9f9;
    --bg-dark: #181818;
    --text: #030303;
    --text-secondary: #606060;
    --border: #e5e5e5;
    --white: #ffffff;
    --success: #2e7d32;
    --error: #c62828;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.navbar-center {
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 2px 0 0 2px;
    font-size: 14px;
}

.search-form button {
    padding: 8px 16px;
    background: #f8f8f8;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 2px 2px 0;
    cursor: pointer;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 2px;
}

.nav-link:hover {
    background: #f0f0f0;
}

.upload-btn {
    background: var(--primary);
    color: var(--white);
    border-radius: 2px;
}

.upload-btn:hover {
    background: var(--primary-dark);
}

.signup-btn {
    background: var(--primary);
    color: var(--white);
    border-radius: 2px;
}

.signup-btn:hover {
    background: var(--primary-dark);
}

.user-menu {
    position: relative;
}

.user-menu .dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 200;
}

.user-menu:hover .dropdown {
    display: block;
}

.user-menu .dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.user-menu .dropdown a:hover {
    background: #f0f0f0;
}

.lang-switcher {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.lang-switcher a {
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    padding: 2px 6px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.lang-switcher a:hover {
    background: var(--primary);
    color: var(--white);
}

.lang-switcher a.active {
    background: var(--primary);
    color: var(--white);
}

/* Main container */
.container {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

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

.video-card {
    background: var(--white);
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.video-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-thumbnail {
    position: relative;
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

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

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

.video-info {
    padding: 10px 12px;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

.video-channel {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

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

/* Watch page */
.watch-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.video-player video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 4px;
}

.watch-title {
    font-size: 20px;
    font-weight: 500;
    margin: 12px 0;
}

.watch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.watch-uploader {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.channel-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.subscriber-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.subscribe-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.subscribe-btn.subscribed {
    background: #f0f0f0;
    color: var(--text);
}

.like-dislike {
    display: flex;
    gap: 4px;
}

.like-btn, .dislike-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.like-btn.active, .dislike-btn.active {
    background: var(--primary);
    color: var(--white);
}

.video-description {
    background: #f0f0f0;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 20px;
}

.video-stats {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    gap: 6px;
}

.video-description p {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Comments */
.comments-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.comment-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-form textarea {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}

.comment-submit {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    cursor: pointer;
    align-self: flex-end;
}

.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.comment.reply {
    margin-left: 40px;
    margin-top: 12px;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.comment-user {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.comment-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 6px;
}

.comment-actions {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.comment-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.comment-actions button:hover {
    color: var(--text);
}

.reply-form {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.reply-form textarea {
    flex: 1;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
}

.reply-submit {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
}

.login-to-comment, .no-comments {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Sidebar */
.watch-sidebar h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.suggestion-item {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.suggestion-thumb {
    position: relative;
    width: 168px;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 4px;
    flex-shrink: 0;
}

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

.suggestion-info {
    flex: 1;
}

.suggestion-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

.suggestion-channel {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    margin-bottom: 2px;
}

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

/* Profile */
.profile-header {
    background: var(--white);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.profile-cover {
    height: 200px;
    background-size: cover;
    background-position: center;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
}

.profile-details {
    flex: 1;
}

.profile-details h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.profile-stats {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
}

.profile-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.about-section {
    background: var(--white);
    border-radius: 4px;
    padding: 20px;
}

.about-section h3 {
    margin-bottom: 12px;
}

.about-section p {
    margin-bottom: 8px;
    font-size: 14px;
}

/* Auth forms */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
    background: var(--white);
    border-radius: 4px;
    padding: 30px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.auth-container h1 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.auth-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 14px;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
}

/* Upload */
.upload-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 4px;
    padding: 30px;
}

.upload-container h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

.upload-form .form-group {
    margin-bottom: 16px;
}

.upload-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.upload-form input[type="text"],
.upload-form input[type="file"],
.upload-form textarea,
.upload-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 14px;
    font-family: inherit;
}

/* Settings */
.settings-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 4px;
    padding: 30px;
}

.settings-container h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

.settings-form .form-group {
    margin-bottom: 16px;
}

.settings-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.settings-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 14px;
}

.settings-links {
    margin-top: 20px;
}

/* Thumbnail selection */
.thumbnail-select-container {
    max-width: 800px;
    margin: 0 auto;
}

.thumbnail-select-container h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.thumbnail-select-container > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.thumbnail-option {
    background: var(--white);
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
}

.thumbnail-option.selected {
    border-color: var(--primary);
}

.thumbnail-option img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.thumbnail-option .btn-primary {
    display: block;
    text-align: center;
    margin: 8px;
}

/* Search */
.search-container h1 {
    font-size: 20px;
    margin-bottom: 16px;
}

.search-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border-radius: 4px;
    padding: 12px;
}

.channel-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text);
    border: none;
    padding: 10px 20px;
    border-radius: 2px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #e8f5e9;
    color: var(--success);
    border: 1px solid #a5d6a7;
}

.alert-error {
    background: #fbe9e7;
    color: var(--error);
    border: 1px solid #ef9a9a;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-size: 16px;
}

/* Page header */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Settings Form */
.settings-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
}

.settings-form {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,0,0,0.2);
}

.settings-links {
    margin-top: 30px;
    text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
    .watch-container {
        grid-template-columns: 1fr;
    }

    .navbar-center {
        display: none;
    }

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

@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

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

    .navbar:not(.menu-open) .navbar-right .nav-link span {
        display: none;
    }
}

/* ===== Touch-friendly targeting (mobile) ===== */
a,
button {
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    margin-left: 10px;
    border-radius: 4px;
}

.nav-toggle:active {
    background: #f0f0f0;
}

/* The mobile search lives inside the collapsible menu. */
.mobile-search {
    display: none;
}

/* Below 767px: mobile hamburger menu with stacked layout. */
@media (max-width: 767px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .navbar-right {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 8px;
    }

    .navbar.menu-open .navbar-right {
        display: flex;
    }

    .mobile-search {
        margin: 8px 4px 4px;
    }

    .navbar.menu-open .mobile-search {
        display: block;
    }

    .mobile-search .search-form input {
        font-size: 16px;
        min-height: 48px;
    }

    .navbar.menu-open .nav-link {
        width: 100%;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }

    /* Let the profile dropdown flow inline instead of floating over content. */
    .navbar.menu-open .user-menu .dropdown-menu {
        position: static;
        box-shadow: none;
        border-top: 1px solid var(--border);
    }

    .navbar.menu-open .lang-switcher {
        width: 100%;
        margin: 8px 4px 0;
    }

    .navbar.menu-open .lang-switcher a {
        min-width: 48px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
    }

    /* Prevent iOS auto-zoom when focusing inputs (<16px triggers it). */
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
    }
}
/* ===== Custom thumbnail upload + recommended badge ===== */
.thumbnail-option {
    position: relative;
}

.recommended-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--primary);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    z-index: 2;
}

.custom-thumbnail-upload {
    margin-top: 24px;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: var(--white);
}

.custom-thumbnail-upload h2 {
    font-size: 16px;
    margin-bottom: 4px;
}

.custom-thumbnail-upload input[type="file"] {
    max-width: 360px;
}

/* Defensive: the hamburger can never appear on tablets or desktops. */
@media (min-width: 768px) {
    .nav-toggle {
        display: none !important;
    }
}