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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f0f;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

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

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
}

.header h1 span {
    color: #ff0033;
}

.header p {
    color: #aaa;
    margin-top: 6px;
    font-size: 0.95rem;
}

.search-box {
    display: flex;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.search-box:focus-within {
    border-color: #ff0033;
}

.search-box input {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder {
    color: #666;
}

.search-box button {
    padding: 16px 20px;
    background: #ff0033;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #cc0029;
}

.search-box button:disabled {
    background: #555;
    cursor: not-allowed;
}

.error-msg {
    background: #2a1a1a;
    border: 1px solid #ff3333;
    color: #ff6666;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.video-info {
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

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

.video-preview {
    display: flex;
    gap: 16px;
    background: #1a1a1a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.video-preview img {
    width: 200px;
    height: 112px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.video-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-details h2 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-details p {
    color: #aaa;
    font-size: 0.85rem;
    margin-top: 8px;
}

.format-section {
    margin-bottom: 16px;
}

.format-section h3 {
    font-size: 0.85rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.formats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.format-btn {
    padding: 10px 20px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.format-btn:hover {
    border-color: #ff0033;
    background: #2a1a1a;
}

.format-btn .quality {
    font-weight: 600;
}

.format-btn .size {
    color: #aaa;
    font-size: 0.8rem;
    margin-left: 6px;
}

.progress-section {
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #1a1a1a;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #ff0033;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text,
#progress-text {
    color: #aaa;
    font-size: 0.85rem;
    margin-top: 8px;
    text-align: center;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* Playlist */
.playlist-info {
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.playlist-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.batch-btn {
    padding: 8px 16px;
    background: #ff0033;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.batch-btn:hover {
    background: #cc0029;
}

.batch-btn-audio {
    background: #1a1a1a;
    border: 1px solid #333;
}

.batch-btn-audio:hover {
    background: #2a1a1a;
    border-color: #ff0033;
}

.playlist-videos {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.playlist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 10px 14px;
    transition: background 0.2s;
}

.playlist-row:hover {
    background: #222;
}

.playlist-row-num {
    color: #666;
    font-size: 0.85rem;
    min-width: 24px;
    text-align: center;
}

.playlist-row-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.playlist-row-info {
    flex: 1;
    min-width: 0;
}

.playlist-row-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-row-duration {
    color: #888;
    font-size: 0.8rem;
    margin-top: 2px;
}

.playlist-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dl-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    background: transparent;
}

.dl-btn:hover {
    border-color: #ff0033;
    background: rgba(255, 0, 51, 0.1);
}

.dl-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dl-btn-video {
    color: #ff4466;
}

.dl-btn-audio {
    color: #44aaff;
}

.playlist-row-status {
    min-width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ff0033;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.status-progress {
    color: #ff0033;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-done {
    color: #44cc88;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-error {
    color: #ff4444;
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .video-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .video-preview img {
        width: 100%;
        height: auto;
        max-width: 300px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .playlist-row {
        flex-wrap: wrap;
    }

    .playlist-row-thumb {
        width: 60px;
        height: 34px;
    }

    .playlist-row-actions {
        width: 100%;
        justify-content: flex-end;
        padding-left: 36px;
    }
}
