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

:root {
    --yt-dark: #0f0f0f;
    --yt-light-dark: #212121;
    --yt-light: #ffffff;
    --yt-hover: #272727;
    --yt-text: #f1f1f1;
    --yt-text-secondary: #aaaaaa;
    --yt-red: #ff0000;
    --yt-red-hover: #cc0000;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--yt-dark);
    color: var(--yt-text);
    line-height: 1.5;
}

/* Navigation Bar */
.navbar {
    background: var(--yt-light-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    max-width: 100%;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 24px;
    user-select: none;
    transition: opacity 0.2s;
}

.nav-logo:hover {
    opacity: 0.8;
}

.logo-icon {
    color: var(--yt-red);
    font-size: 28px;
}

.logo-text {
    font-size: 22px;
    letter-spacing: 1px;
}

.nav-search {
    flex: 1;
    max-width: 500px;
    margin: 0 40px;
}

.search-input {
    width: 100%;
    background: var(--yt-hover);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--yt-text);
    padding: 10px 16px;
    border-radius: 2px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--yt-red);
}

.search-input::placeholder {
    color: var(--yt-text-secondary);
}

.nav-user {
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-user:hover {
    opacity: 1;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 56px);
    background: var(--yt-dark);
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--yt-light-dark);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    border-left: 4px solid transparent;
    font-size: 14px;
    color: var(--yt-text-secondary);
}

.menu-item:hover {
    background: var(--yt-hover);
    color: var(--yt-text);
}

.menu-item.active {
    border-left-color: var(--yt-red);
    color: var(--yt-text);
}

.menu-icon {
    font-size: 22px;
    width: 24px;
    text-align: center;
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Download Section */
.download-section {
    background: var(--yt-light-dark);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.download-inner h1 {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 600;
}

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

.url-input {
    flex: 1;
    background: var(--yt-hover);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--yt-text);
    padding: 12px 16px;
    border-radius: 2px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.url-input:focus {
    outline: none;
    border-color: var(--yt-red);
}

.url-input::placeholder {
    color: var(--yt-text-secondary);
}

.btn-download {
    background: var(--yt-red);
    color: var(--yt-light);
    border: none;
    padding: 10px 24px;
    border-radius: 2px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-download:hover {
    background: var(--yt-red-hover);
}

.btn-download:active {
    transform: scale(0.98);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 18px;
}

/* Status Messages */
.status-message {
    padding: 12px 16px;
    border-radius: 2px;
    font-size: 14px;
    margin-bottom: 12px;
    display: none;
    animation: slideDown 0.3s ease;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border-left: 3px solid #4caf50;
}

.status-message.error {
    background: rgba(244, 67, 54, 0.15);
    color: #ef5350;
    border-left: 3px solid #f44336;
}

.status-message.info {
    background: rgba(33, 150, 243, 0.15);
    color: #64b5f6;
    border-left: 3px solid #2196f3;
}

.status-message.warning {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border-left: 3px solid #ff9800;
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--yt-red);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

/* Gallery Section */
.gallery-section {
    background: var(--yt-light-dark);
    border-radius: 2px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.video-count {
    background: var(--yt-hover);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--yt-text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 40px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-title {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--yt-text);
}

.empty-desc {
    font-size: 14px;
    color: var(--yt-text-secondary);
}

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

.video-card {
    cursor: pointer;
    background: transparent;
    border-radius: 2px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: scale(1.02);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 2px;
    overflow: hidden;
}

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

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.9);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    backdrop-filter: blur(2px);
}

.video-thumbnail:hover .play-overlay {
    opacity: 1;
    background: rgba(255, 0, 0, 1);
}

.play-icon {
    margin-left: 2px;
}

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

/* Video Details */
.video-details {
    padding: 12px 0;
    background: transparent;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--yt-text);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    max-height: 2.6em;
}

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

.video-id-small {
    font-size: 11px;
    color: var(--yt-red);
    margin-bottom: 12px;
    font-weight: 500;
}

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

/* Small Buttons */
.btn-small {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--yt-text);
    border-radius: 2px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-play {
    border-color: var(--yt-red);
    color: var(--yt-red);
}

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

.btn-delete {
    border-color: var(--yt-red);
    color: var(--yt-red);
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

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

.modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    background: var(--yt-light-dark);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.player-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.player-info {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.player-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--yt-text);
}

.player-controls {
    display: flex;
    gap: 8px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 900px) {
    .sidebar {
        width: 72px;
        padding: 8px 0;
    }

    .menu-item {
        padding: 12px 8px;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    .menu-item span:not(.menu-icon) {
        font-size: 10px;
        text-align: center;
        white-space: nowrap;
    }

    .menu-icon {
        width: 100%;
    }

    .nav-search {
        max-width: 300px;
        margin: 0 20px;
    }

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

@media (max-width: 600px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        display: flex;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 8px;
        overflow-x: auto;
    }

    .sidebar-menu {
        flex-direction: row;
        gap: 8px;
    }

    .menu-item {
        padding: 8px 16px;
        flex-direction: row;
        gap: 8px;
        border-left: none;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
    }

    .menu-item.active {
        border-left: none;
        border-bottom-color: var(--yt-red);
    }

    .content {
        padding: 16px;
    }

    .download-section {
        padding: 16px;
    }

    .download-inner h1 {
        font-size: 20px;
    }

    .download-form {
        flex-direction: column;
    }

    .url-input,
    .btn-download {
        width: 100%;
    }

    .nav-search {
        max-width: none;
        margin: 0 20px;
    }

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

    .video-title {
        font-size: 12px;
    }

    .video-meta {
        font-size: 11px;
    }

    .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
}
