/* YouTube Clone - Main Stylesheet */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff0000;
    --secondary-color: #282828;
    --text-primary: #030303;
    --text-secondary: #606060;
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --bg-tertiary: #f1f1f1;
    --border-color: #e5e5e5;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --font-primary: 'Roboto', Arial, sans-serif;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background-color: var(--bg-tertiary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.logo i {
    color: var(--primary-color);
    font-size: 24px;
}

.header-center {
    flex: 1;
    max-width: 640px;
    margin: 0 40px;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 0;
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px 0 0 20px;
    font-size: 16px;
    outline: none;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-btn {
    height: 40px;
    padding: 0 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-btn:hover {
    background-color: #e8e8e8;
}

.voice-btn {
    height: 40px;
    width: 40px;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    margin-left: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.voice-btn:hover {
    background-color: #e8e8e8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
    position: relative;
}

.header-btn:hover {
    background-color: var(--bg-tertiary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--primary-color);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.user-menu {
    position: relative;
}

.user-avatar {
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.user-avatar:hover {
    opacity: 0.8;
}

.user-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow-light);
    min-width: 300px;
    display: none;
    z-index: 1001;
}

.user-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.dropdown-items {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

.upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.upload-btn:hover {
    background-color: #e60000;
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: fixed;
    left: 0;
    top: 56px;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-item:hover {
    background-color: var(--bg-tertiary);
}

.sidebar-item.active {
    background-color: var(--bg-tertiary);
    font-weight: 500;
}

.sidebar-item i {
    width: 24px;
    text-align: center;
    font-size: 20px;
}

/* Content Area */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    background-color: var(--bg-secondary);
}

.sidebar.collapsed + .content {
    margin-left: 0;
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 16px 0;
    margin-bottom: 24px;
    scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.category-pill {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 16px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    transition: all 0.2s;
}

.category-pill:hover {
    background-color: #e8e8e8;
}

.category-pill.active {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.video-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow-light);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background-color: #000;
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    padding: 12px;
}

.video-channel {
    display: flex;
    gap: 12px;
}

.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    flex-shrink: 0;
}

.video-details {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.channel-name {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.channel-name:hover {
    color: var(--text-primary);
}

.video-views {
    margin-bottom: 4px;
}

.video-time {
    color: var(--text-secondary);
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 32px 0;
}

.load-more-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background-color: #e8e8e8;
}

/* Footer */
.footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    margin-bottom: 24px;
}

.footer-section h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: var(--text-primary);
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    width: 36px;
    height: 36px;
    background-color: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* Dark Mode */
body.dark-mode {
    --text-primary: #f1f1f1;
    --text-secondary: #aaa;
    --bg-primary: #181818;
    --bg-secondary: #0f0f0f;
    --bg-tertiary: #272727;
    --border-color: #303030;
    --shadow-light: rgba(0, 0, 0, 0.3);
}

body.dark-mode .header {
    background-color: var(--bg-primary);
    border-bottom-color: var(--border-color);
}

body.dark-mode .sidebar {
    background-color: var(--bg-primary);
    border-right-color: var(--border-color);
}

body.dark-mode .video-card {
    background-color: var(--bg-primary);
}

body.dark-mode .footer {
    background-color: var(--bg-primary);
    border-top-color: var(--border-color);
}

body.dark-mode .footer-section h4 {
    color: var(--text-primary);
}

body.dark-mode .social-links a {
    background-color: var(--bg-tertiary);
}

body.dark-mode .footer-bottom {
    border-top-color: var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: fadeIn 0.5s ease-out;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
