:root {
    --primary-color: #6366f1;
    --secondary-color: #a855f7;
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 20%, #6366f140 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, #a855f740 0%, transparent 40%);
    z-index: -1;
}

.container {
    width: 90%;
    max-width: 800px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-box {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
}

input[type="text"] {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 12px;
    padding: 0 30px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: block;
    margin: 20px auto;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

.result-area {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result {
    flex: 0 0 220px;
    /* Sabit genişlik (görsel için) */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.download-options {
    flex: 1;
    /* Kalan alanı kapla */
}

/* Eski .video-info yerine .result kullanıyoruz ama class ismi HTML'de result */
.result img {
    max-width: 100%;
    width: 100%;
    /* Kapsayıcısına (220px) sığsın */
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.result h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    word-break: break-word;
    /* Uzun başlıkları kır */
}

.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    /* Biraz daha küçük kutular */
    gap: 10px;
    margin-top: 15px;
}

.format-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 10px;
    /* Padding küçüldü */
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.format-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.format-card .res {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.format-card .ext {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

.error-area {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-top: 20px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        width: 100%;
        border-radius: 0;
        min-height: 100vh;
        border: none;
    }

    .search-box {
        flex-direction: column;
    }

    header h1 {
        font-size: 2rem;
    }

    /* Mobilde tekrar alt alta olsun */
    .result-area {
        flex-direction: column;
        align-items: center;
    }

    .result {
        flex: 1;
        width: 100%;
        max-width: 300px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: #1e293b;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.progress-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

#closeModalBtn {
    margin-top: 10px;
    background: #ef4444;
}

#closeModalBtn:hover {
    background: #dc2626;
}