/* GIF URL Downloader - tool-specific styles
   Pairs with /css/tool-shared.css */

@keyframes loader-spin { to { transform: rotate(360deg); } }
.loader-spin { animation: loader-spin 0.9s linear infinite; }

/* URL input row */
.url-input-wrap {
    display: flex;
    gap: 10px;
    max-width: 640px;
    margin: 14px auto 8px;
    width: 100%;
}
.url-input {
    flex: 1;
    min-width: 0;
    padding: 13px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-family: var(--font-body, inherit);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 79, 70, 229), 0.15);
}
.url-input::placeholder {
    color: var(--text-light, #aaa);
}
.url-input__btn {
    flex-shrink: 0;
}

/* Inline "paste a batch list" link button inside the hint */
.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.link-btn:hover {
    color: var(--primary-dark, var(--primary));
}

/* Batch textarea panel */
.batch-input-wrap {
    margin: 18px auto 4px;
    max-width: 640px;
    width: 100%;
    text-align: left;
}
.batch-input__label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.batch-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-family: var(--font-mono, monospace);
    font-size: 0.88rem;
    line-height: 1.55;
    resize: vertical;
    min-height: 130px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}
.batch-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 79, 70, 229), 0.15);
}
.batch-input-wrap .btn {
    margin-top: 12px;
    width: 100%;
}

/* Source URL line on each result card */
.result-card__source {
    font-size: 0.82rem;
    color: var(--text-muted, var(--text-secondary));
    font-family: var(--font-mono, monospace);
    margin: 4px 0 8px;
    word-break: break-all;
}

/* Failed-URL list inside results */
.results__errors {
    margin-top: 18px;
}
.results__errors-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.results__errors-list li {
    padding: 8px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.88rem;
}
.results__errors-list li:first-child {
    border-top: none;
}
.results__errors-url {
    display: block;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
    font-size: 0.82rem;
    word-break: break-all;
    margin-bottom: 2px;
}
.results__errors-msg {
    color: var(--text-primary);
}

/* Results footer */
.results__footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 22px;
    flex-wrap: wrap;
}

/* ── Upload area sizing fix ─────────────────────────────────────────────────
   This is a URL-paste tool, not a file-drop tool. Shrink the shared
   .upload-area so it doesn't span the full viewport with dead space.
   Using the ID selector to beat any class-based rule in tool-shared.css. */
#uploadArea {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 40px 28px;
    min-height: 0;
}

#uploadArea .upload-area__icon {
    margin-bottom: 14px;
}

#uploadArea .upload-area__title {
    margin-bottom: 6px;
}

/* The URL input + button row should fill the constrained box neatly */
#uploadArea .url-input-wrap {
    margin: 18px auto 10px;
    max-width: 640px;
}

/* ── Results layout fix ─────────────────────────────────────────────────────
   Override the shared grid so a single card centers instead of pinning
   to the leftmost column. Works for 1-many cards via flex-wrap. */
.results .results__items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 18px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0;
}

.results .results__items .result-card {
    flex: 0 1 280px;
    width: 280px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Failed-URL panel should span full row when present */
.results .results__items .results__errors {
    flex: 1 1 100%;
    max-width: 720px;
}

/* Center the results header (title + subtitle) */
.results__header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 22px;
}

/* Ensure footer stays centered with the cards */
.results__footer {
    justify-content: center;
}

/* Responsive */
@media (max-width: 640px) {
    .results .results__items .result-card {
        flex: 0 1 100%;
        width: 100%;
        max-width: 360px;
    }
}

@media (max-width: 560px) {
    .url-input-wrap {
        flex-direction: column;
    }
    .url-input__btn {
        width: 100%;
    }
}
