:root {
    --primary: #ff0050;
    --secondary: #00f2ea;
    --bg-dark: #0f0f13;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    background: var(--primary);
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: var(--secondary);
    width: 300px;
    height: 300px;
    bottom: -50px;
    right: -50px;
    animation-delay: 2s;
}

.blob-3 {
    background: #7b00ff;
    width: 250px;
    height: 250px;
    top: 40%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 20px);
    }
}

/* Container */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Input Section */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

input[type="text"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(0, 242, 234, 0.2);
}

button {
    padding: 12px 25px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: 0.3s;
}

@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
    }

    .input-group button,
    .input-group input[type="text"] {
        width: 100%;
    }
}

#fetchBtn {
    background: var(--primary);
    color: white;
}

#fetchBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 80, 0.4);
}

.error-msg {
    color: #ff4757;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Video Info */
.content-section {
    margin-top: 30px;
    text-align: left;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-info {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.video-info img {
    width: 120px;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

.details h2 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.details p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Controls */
.controls-section h3 {
    margin-bottom: 15px;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.time-box {
    display: flex;
    flex-direction: column;
    width: 45%;
}

.time-box label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.time-box input {
    width: 100%;
    /* remove width: 100% and let flex handle it, or use flex-grow */
    flex: 1;
    min-width: 0;
    /* important for flex items */
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 8px;
    border-radius: 5px 0 0 5px;
}

.input-wrapper {
    display: flex;
    align-items: stretch;
    /* Ensure same height */
    width: 100%;
}

.input-wrapper button {
    padding: 0 15px;
    /* Adjust padding */
    border-radius: 0 5px 5px 0;
    background: var(--secondary);
    color: var(--bg-dark);
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Prevent button from shrinking */
}

.input-wrapper button:hover {
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}



.duration-display {
    text-align: center;
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.actions .btn {
    flex: 1;
    padding: 15px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), #ff4757);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 80, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn:hover {
    transform: translateY(-2px);
}

/* Loader */
.loader {
    display: none;
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1a1a20;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 300px;
    border: 1px solid var(--glass-border);
}

/* Video Player */
.video-player-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 20px;
    background: #000;
}

.video-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s;
    background: #FF0000;
}

/* Quality Modal Styles */
.quality-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.btn-quality {
    width: 100%;
    padding: 12px;
    background: #2a2a30;
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-quality:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateX(5px);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    margin-top: 10px;
    font-size: 0.9rem;
}