:root {
    --primary-color: #1d9bf0;
    --primary-hover: #1a8cd8;
    --bg-dark: #000000;
    --card-bg: rgba(21, 24, 28, 0.8);
    --text-main: #e7e9ea;
    --text-dim: #71767b;
    --input-bg: #202327;
    --error-color: #f4212e;
    --success-color: #00ba7c;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

/* Background blobs for a modern look */
.background-blob {
    position: fixed;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.15;
    border-radius: 50%;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 40%;
    height: 40%;
    background: var(--primary-color);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 35%;
    height: 35%;
    background: #7856ff;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 20%;
    height: 20%;
    background: #ff7a00;
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

header {
    margin-bottom: 32px;
}

.logo-container {
    font-size: 48px;
    color: white;
    margin-bottom: 16px;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1.5;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-dim);
    font-size: 18px;
}

input[type="text"] {
    width: 100%;
    padding: 18px 80px 18px 48px;
    border: 2px solid transparent;
    border-radius: 12px;
    background-color: var(--input-bg);
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.input-actions {
    position: absolute;
    right: 12px;
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-dim);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.history-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
    text-align: left;
}

.history-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.history-info {
    flex: 1;
    overflow: hidden;
}

.history-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    background-color: #000000;
    box-shadow: 0 0 0 4px rgba(29, 155, 240, 0.15);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #1a4d6e;
    color: #71767b;
    cursor: not-allowed;
    transform: none;
}

.hidden {
    display: none;
}

#loader {
    margin: 30px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#result {
    margin-top: 32px;
    animation: fadeIn 0.5s ease-out;
}

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

.video-preview {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #000;
    border: 1px solid var(--glass-border);
}

#preview-image {
    width: 100%;
    max-height: 350px;
    display: block;
    object-fit: cover;
}

.quality-wrap {
    text-align: left;
    margin-bottom: 16px;
}

.quality-wrap label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-dim);
}

#quality-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

#quality-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.15);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #ffffff;
    color: #000000;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    width: 100%;
    transition: all 0.2s;
}

.btn-download:hover {
    background-color: #d7dbdc;
}

.error-msg {
    color: var(--error-color);
    background-color: rgba(244, 33, 46, 0.15);
    padding: 16px 20px;
    border-radius: 12px;
    margin-top: 24px;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid rgba(244, 33, 46, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.error-msg i {
    font-size: 18px;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

footer {
    margin-top: 40px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
    font-size: 13px;
    color: var(--text-dim);
}
