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

:root {
    --primary-color: #ff0000;
    --primary-hover: #cc0000;
    --bg-color: #0f0f0f;
    --surface-color: #1f1f1f;
    --surface-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

/* Initial Loading Overlay */
.initial-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.initial-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.container {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Header */
.header {
    background: var(--surface-color);
    padding: 1.25rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #ff4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Auth Section */
.auth-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.auth-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.user-info {
    display: flex;
    align-items: center;
}

/* User Menu Container */
.user-menu-container {
    position: relative;
}

.user-menu-trigger {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.user-menu-trigger:hover {
    transform: scale(1.05);
}

.user-menu-trigger .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    transition: border-color 0.2s;
}

.user-menu-trigger:hover .user-avatar {
    border-color: var(--primary-hover);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 220px;
    z-index: 1000;
    animation: dropdownSlideIn 0.2s ease;
    overflow: hidden;
}

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

.dropdown-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 0, 0, 0.05);
}

.dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.dropdown-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--surface-hover);
}

.dropdown-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dropdown-item:hover svg {
    color: var(--primary-color);
}

.dropdown-item-danger {
    color: var(--primary-color);
}

.dropdown-item-danger svg {
    color: var(--primary-color);
}

.dropdown-item-danger:hover {
    background: rgba(255, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    padding: 2rem 1rem;
    min-height: calc(100vh - 100px);
}

/* Reduce side padding on larger screens for better space utilization */
@media (min-width: 1200px) {
    .main-content {
        padding: 2rem 1rem;
    }
}

@media (min-width: 1600px) {
    .main-content {
        padding: 2rem 1rem;
    }
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

.welcome-content {
    text-align: center;
    max-width: 1200px;
    width: 100%;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    color: var(--primary-color);
    margin: 0 auto 2rem;
}

.welcome-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.welcome-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    text-align: left;
}

.feature-card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.feature-privacy-link {
    margin-top: 1rem !important;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.feature-privacy-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.feature-privacy-link a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Data Usage Info */
.data-usage-info {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    text-align: left;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.data-usage-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.data-usage-info > p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.data-usage-info ul {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.data-usage-info ul li {
    padding: 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-usage-info ul li:last-child {
    border-bottom: none;
}

.data-usage-info ul li strong {
    color: var(--text-primary);
}

.data-privacy-note {
    background: rgba(255, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.data-privacy-note svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
}

.data-privacy-note strong {
    color: var(--text-primary);
}

.data-privacy-note a {
    color: var(--primary-color);
    text-decoration: underline;
}

.privacy-link {
    text-align: center;
    font-size: 0.95rem;
    margin-top: 1.5rem;
}

.privacy-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.privacy-link a:hover {
    text-decoration: underline;
}

.cta-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.cta-button svg {
    width: 20px;
    height: 20px;
}

.cta-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Toggle Selection */
.toggle-container {
    display: flex;
    gap: 1rem;
    margin: 0 auto 2rem;
    background: var(--surface-color);
    padding: 0.5rem;
    border-radius: 12px;
    width: fit-content;
}

.toggle-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-button svg {
    width: 20px;
    height: 20px;
}

.toggle-button:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.toggle-button.active {
    background: var(--primary-color);
    color: white;
}

/* Playlist Selector */
.playlist-selector {
    margin-bottom: 2rem;
    overflow-x: auto;
    overflow-y: hidden;
}

.playlist-buttons {
    display: flex;
    gap: 1rem;
    background: var(--surface-color);
    padding: 0.5rem;
    border-radius: 12px;
    width: fit-content;
    min-width: 100%;
}

.playlist-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.playlist-button:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.playlist-button.active {
    background: #555555;
    color: white;
}

/* Scrollbar styling for playlist selector */
.playlist-selector::-webkit-scrollbar {
    height: 8px;
}

.playlist-selector::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.playlist-selector::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.playlist-selector::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

/* View Content */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

.category-title-input {
    font-size: 2rem;
    font-weight: 700;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    min-width: 300px;
}

.category-title-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat-badge {
    background: var(--surface-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Responsive grid for smaller screens */
@media (max-width: 1400px) {
    .content-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Channel Card */
.channel-card .card-link {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    gap: 1rem;
}

.channel-avatar-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.channel-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
}

.channel-avatar-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #ff4444);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    border: 2px solid var(--border-color);
}

.channel-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.channel-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Containers with Categories */
.subscriptions-container,
.liked-videos-container,
.uploads-container,
.playlists-container {
    display: flex;
    gap: 2rem;
}

/* Category action buttons on page title */
.category-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.category-action-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
    transition: stroke 0.2s;
}

.category-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.category-action-btn:hover svg {
    stroke: var(--text-primary);
}

.category-delete-btn:hover {
    background-color: rgba(220, 38, 38, 0.2);
}

.category-delete-btn:hover svg {
    stroke: #dc2626;
}

/* Category Sidebar */
.category-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

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

.category-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.add-category-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-category-btn svg {
    width: 18px;
    height: 18px;
}

.add-category-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

/* Inline Add Category Input */
.add-category-input {
    margin-bottom: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 0.75rem;
    border: 2px solid var(--primary-color);
}

.category-name-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    outline: none;
}

.category-name-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.category-input-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.save-category-btn,
.cancel-category-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-category-btn svg,
.cancel-category-btn svg {
    width: 18px;
    height: 18px;
}

.save-category-btn {
    color: #00ff00;
}

.save-category-btn:hover {
    background: rgba(0, 255, 0, 0.1);
}

.cancel-category-btn {
    color: var(--text-secondary);
}

.cancel-category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
    min-height: 50px; /* Ensure enough height for stacked buttons */
}

.category-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-color);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-item.drag-over {
    border-color: var(--primary-color);
    background: rgba(255, 0, 0, 0.1);
}

.category-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.category-item.drag-placeholder {
    margin-bottom: calc(0.5rem + 60px); /* Create space for the dragged item */
}

.category-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drag-handle {
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: grab;
    user-select: none;
    line-height: 1;
}

.category-item.dragging .drag-handle {
    cursor: grabbing;
}

.category-item:hover .drag-handle {
    opacity: 0.8;
}

.category-actions {
    display: flex;
    align-items: center;
    position: relative;
    min-width: 30px;
    justify-content: flex-end;
}

.category-count {
    font-size: 0.85rem;
    opacity: 0.7;
    position: relative;
    min-width: 20px;
    text-align: right;
}

.category-edit,
.category-delete {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    margin: 0;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 4px;
    width: 18px;
    height: 18px;
}

.category-edit {
    top: -6px; /* Position edit button at the very top */
}

.category-delete {
    top: 16px; /* Position delete button below edit (18px button + 2px gap) */
}

.category-item:hover .category-edit,
.category-item:hover .category-delete {
    opacity: 1;
    transform: translateX(0);
}

.category-edit:hover {
    color: #4a9eff; /* Blue color for edit */
}

.category-delete:hover {
    color: var(--primary-color);
}

/* When category is active (selected), make buttons visible in black on hover */
.category-item.active:hover .category-edit:hover {
    color: #000;
}

.category-item.active:hover .category-delete:hover {
    color: #000;
}

.category-edit svg,
.category-delete svg {
    width: 14px;
    height: 14px;
}

/* Edit input styling */
.category-name-edit {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    width: 100%;
    max-width: 150px;
}

.category-name-edit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

/* Videos Section */
.videos-section {
    flex: 1;
    min-width: 0;
}

/* Video Card */
.video-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.video-card.drag-over {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.2);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: var(--bg-color);
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.new-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    z-index: 10;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(255, 0, 0, 0.5);
    }
}

.video-card .card-content {
    padding: 1rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-channel {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.video-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Confirmation Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header svg {
    width: 48px;
    height: 48px;
    color: #ff9800;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    margin-bottom: 2rem;
}

.modal-body p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn-cancel {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-btn-cancel:hover {
    background: var(--surface-hover);
    border-color: var(--text-secondary);
}

.modal-btn-confirm {
    background: var(--primary-color);
    color: white;
}

.modal-btn-confirm:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
    min-height: 300px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--surface-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error State */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 1rem;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--primary-color);
    margin: 2rem 0;
}

.error-message svg {
    width: 50px;
    height: 50px;
    color: var(--primary-color);
}

.error-message p {
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo {
        flex-direction: column;
    }

    .main-content {
        padding: 1rem;
    }

    .welcome-content h2 {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .data-usage-info {
        padding: 1.5rem;
    }

    .data-usage-info h3 {
        font-size: 1.25rem;
    }

    .data-privacy-note {
        flex-direction: column;
        gap: 0.75rem;
    }

    .content-grid {
        grid-template-columns: 1fr !important;
    }

    .toggle-container {
        width: 100%;
        justify-content: center;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .channel-card .card-link {
        flex-direction: column;
        text-align: center;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Video Player Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: var(--surface-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.video-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.video-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.video-close-btn:hover {
    background: rgba(220, 38, 38, 0.9);
    transform: rotate(90deg);
}

.video-player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: black;
}

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

.video-modal-footer {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    background: var(--background-color);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.open-youtube-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 2rem;
    background: #FF0000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.open-youtube-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.open-youtube-btn:hover {
    background: #CC0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}

.open-youtube-btn:active {
    transform: translateY(0);
}

/* Selection color */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Loading Indicators */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading p {
    margin-top: 1rem;
    font-size: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.loading-more p {
    font-size: 0.95rem;
}

.spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Page Footer */
.page-footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.footer-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-separator {
    color: var(--border-color);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .page-footer {
        padding: 1.5rem 1rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-separator {
        display: none;
    }
}

/* Onboarding Modal */
.onboarding-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.onboarding-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.onboarding-content {
    position: relative;
    background: var(--surface-color);
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.4s ease;
}

.onboarding-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
}

.onboarding-close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.onboarding-close-btn svg {
    width: 24px;
    height: 24px;
}

.onboarding-header {
    text-align: center;
    padding: 3rem 2rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.onboarding-icon {
    width: 60px;
    height: 60px;
    color: var(--primary-color);
    margin: 0 auto 1.5rem;
    animation: pulse 2s infinite;
}

.onboarding-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.onboarding-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

.onboarding-steps {
    padding: 2rem;
    display: grid;
    gap: 2rem;
}

.onboarding-step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.step-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.step-content strong {
    color: var(--text-primary);
}

.step-visual {
    margin-top: 1rem;
    padding: 0;
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.step-visual video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.onboarding-footer {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dont-show-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.dont-show-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.dont-show-checkbox span {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.start-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@media (max-width: 768px) {
    .onboarding-content {
        width: 95%;
        max-height: 95vh;
    }

    .onboarding-header {
        padding: 2.5rem 1.5rem 1.5rem;
    }

    .onboarding-header h2 {
        font-size: 1.5rem;
    }

    .onboarding-header p {
        font-size: 1rem;
    }

    .onboarding-steps {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .onboarding-step {
        flex-direction: column;
        gap: 1rem;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .step-content h3 {
        font-size: 1.1rem;
    }

    .step-content p {
        font-size: 0.95rem;
    }

    .onboarding-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
    }

    .start-btn {
        width: 100%;
    }
}
