@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: #0f0f13;
    color: #e4e4e7;
    -webkit-text-size-adjust: 100%;
}

textarea:focus, input:focus { outline: none; }

/* Header */
.site-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 1rem 0;
}

.site-header .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

nav a {
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
    margin-left: 1.5rem;
}

nav a:hover { color: #fff; }

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 1.5rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fcb045, #fd1d1d, #833ab4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.hero p {
    color: #a1a1aa;
    font-size: 1.1rem;
    max-width: 550px;
    margin: 0 auto;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Card */
.card {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* Input Group */
.input-group {
    margin-bottom: 0.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    color: #e4e4e7;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.url-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.url-input-wrapper input {
    flex: 1;
    background: #0f0f13;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    min-height: 48px;
}

.url-input-wrapper input:focus {
    border-color: #fd1d1d;
    box-shadow: 0 0 0 3px rgba(253,29,29,0.15);
}

.url-input-wrapper input::placeholder { color: #52525b; }

.btn-icon {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: #a1a1aa;
    border-radius: 0.75rem;
    padding: 0 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: #e4e4e7;
}

/* Supported Formats */
.supported-formats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #71717a;
}

.format-tag {
    background: rgba(131,58,180,0.15);
    color: #d8a3f0;
    padding: 0.2rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Buttons */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    color: #fff;
    border: none;
    padding: 0.85rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(253,29,29,0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #a1a1aa;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: 'Inter', sans-serif;
    min-height: 44px;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #e4e4e7;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    justify-content: center;
    color: #a1a1aa;
    font-size: 0.9rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #fd1d1d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error */
.error-msg {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 0.75rem;
    color: #f87171;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Results */
.results {
    margin-top: 1.5rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.result-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.75rem;
    overflow: hidden;
}

.result-item .media-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #0f0f13;
}

.result-item video.media-preview {
    aspect-ratio: 9/16;
    max-height: 400px;
}

.result-item .result-info {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.result-item .media-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: #d8a3f0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-save {
    background: linear-gradient(135deg, #833ab4, #fd1d1d);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 36px;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253,29,29,0.3);
}

/* Single result (no grid) */
.result-single {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.result-single .media-preview {
    max-width: 100%;
    max-height: 500px;
    border-radius: 0.75rem;
    object-fit: contain;
}

/* Steps */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.step {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    margin: 0 auto 0.75rem;
}

.step h3 {
    font-weight: 700;
    color: #e4e4e7;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.step p {
    font-size: 0.85rem;
    color: #a1a1aa;
    line-height: 1.5;
}

/* Ad Slot */
.ad-slot {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: 0.75rem;
    color: #3f3f46;
    font-size: 0.75rem;
    margin: 1.5rem 0;
}
.ad-slot:empty::after { content: "Ad Space"; }

/* Content Section */
.content-section {
    margin-top: 2rem;
}

.content-section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #e4e4e7;
    margin-bottom: 1rem;
}

.content-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #c4c4cc;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.content-section p,
.content-section li {
    color: #a1a1aa;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.content-section ul {
    padding-left: 1.5rem;
}

.content-section details {
    margin-bottom: 0.5rem;
}

.content-section summary {
    cursor: pointer;
    font-weight: 600;
    color: #c4c4cc;
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.content-section details p {
    margin-left: 1rem;
    margin-top: 0.25rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 2rem 0;
    margin-top: 3rem;
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-footer p {
    color: #52525b;
    font-size: 0.8rem;
}

.site-footer nav a {
    color: #52525b;
    font-size: 0.8rem;
    margin-left: 1.25rem;
}

.site-footer nav a:hover { color: #a1a1aa; }

/* Preview Card */
.preview-card {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(131,58,180,0.08);
    border: 1px solid rgba(131,58,180,0.2);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
}

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

.preview-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.preview-type {
    font-weight: 700;
    font-size: 0.95rem;
    color: #e4e4e7;
}

.preview-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #71717a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4ade80;
}

.hidden { display: none !important; }

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
    .container { max-width: 100%; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 1rem; }
    .card { padding: 1.25rem; }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    nav { display: none; }

    .site-footer .container {
        flex-direction: column;
        text-align: center;
    }

    .site-footer nav a {
        margin-left: 0;
        margin-right: 1rem;
    }
}

@media (max-width: 480px) {
    .hero { padding: 2rem 1rem 0.75rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }

    .card { padding: 1rem; }

    .url-input-wrapper {
        flex-direction: column;
    }

    .url-input-wrapper input {
        width: 100%;
        font-size: 0.85rem;
    }

    .btn-icon {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .result-item .result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .btn-save {
        width: 100%;
        justify-content: center;
    }

    .preview-card {
        flex-direction: column;
        text-align: center;
    }

    .preview-url {
        white-space: normal;
        word-break: break-all;
    }

    .container { padding: 0 1rem; }
}
