/* GIF/WebP Optimizer - Light theme aligned with /text2img page */

.gif-hero {
    padding: 3rem 0 4rem;
    /* background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%); */
    position: relative;
    overflow: hidden;
}

.gif-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(42, 219, 92, 0.08) 0%, transparent 55%);
    pointer-events: none;
}

.gif-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.gif-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(42, 219, 92, 0.1);
    border: 1px solid rgba(42, 219, 92, 0.3);
    color: var(--color-primary);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.gif-hero__badge svg {
    width: 16px;
    height: 16px;
}

.gif-hero__title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.gif-hero__subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0 auto 2.5rem;
    max-width: 760px;
}

.gif-hero__stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.gif-hero__stat {
    text-align: center;
}

.gif-hero__stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.gif-hero__stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gif-tool {
    /* padding: 4rem 0; */
    background: var(--color-bg);
    /* padding-top: 0; */
}

.gif-tool__layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* .gif-upload {
    background: var(--color-bg-subtle);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    box-shadow: 0 12px 30px rgba(15, 25, 20, 0.08);
} */

.gif-upload__dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    /* background: #ffffff; */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.gif-upload__dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(42, 219, 92, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gif-upload__dropzone:hover,
.gif-upload__dropzone.dragover {
    border-color: rgba(42, 219, 92, 0.5);
    box-shadow: 0 10px 30px rgba(42, 219, 92, 0.12);
    transform: translateY(-2px);
}

.gif-upload__dropzone:hover::before,
.gif-upload__dropzone.dragover::before {
    opacity: 1;
}

.gif-upload__icon {
        margin: 0 auto 1.5rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(42, 219, 92, 0.1);
    
    border: 2px solid rgba(42, 219, 92, 0.3);
    border-radius: 50%;
}

.gif-upload__icon svg {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
}

.gif-upload__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.gif-upload__hint {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.gif-upload__badges {
    display: flex;
    /* flex-direction: column; */
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.gif-upload__badge {
    padding: 0.6rem 1.1rem;
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.gif-config {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#gif-loop-count {
        outline: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.3rem;
    width: 40px;
}

.gif-panel {
    background: var(--color-bg-subtle);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    /* box-shadow: 0 12px 30px rgba(15, 25, 20, 0.08); */
    margin-bottom: 2.5rem;
}

.gif-panel:last-of-type {
    margin-bottom: 0;
}

.gif-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.gif-panel__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.gif-panel__title svg {
    width: 28px;
    height: 28px;
    color: var(--color-primary);
}

.gif-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #2adb5c 0%, #32e569 100%);
    color: #fff;
    transition: all 0.25s ease;
}

.gif-button:hover {
    box-shadow: 0 12px 24px rgba(42, 219, 92, 0.25);
    transform: translateY(-2px);
}

.gif-button--secondary {
    background: rgba(42, 219, 92, 0.12);
    color: var(--color-primary);
    border: 1px solid rgba(42, 219, 92, 0.35);
}

.gif-button--ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.gif-meta {
    display: grid;
    gap: 1.25rem;
}

.gif-meta__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.9rem;
}

.gif-meta__item:last-child {
    border-bottom: none;
}

.gif-meta__value {
    font-weight: 600;
    color: var(--color-text);
}

.gif-format {
    display: grid;
    gap: 1.25rem;
}

.gif-format__option input {
    display: none;
}

.gif-format__card {
    padding: 1.2rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: var(--color-bg-subtle);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gif-format__option input:checked + .gif-format__card {
    border-color: rgba(42, 219, 92, 0.6);
    box-shadow: 0 12px 26px rgba(42, 219, 92, 0.12);
}

.gif-format__title {
    font-weight: 700;
    color: var(--color-text);
}

.gif-format__desc {
    margin-top: 0.35rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
}

.gif-settings {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.gif-setting__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.gif-setting__hint {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.gif-radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.gif-radio-grid label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    line-height: 1.45;
}

.gif-radio-grid input[type="radio"] {
    accent-color: var(--color-primary);
    margin-right: 0.35rem;
}

.gif-radio-grid label:has(input[type="radio"]:checked) {
    border-color: rgba(42, 219, 92, 0.55);
    box-shadow: 0 10px 22px rgba(42, 219, 92, 0.12);
    color: var(--color-text);
}

.gif-radio-grid label:hover {
    border-color: rgba(42, 219, 92, 0.35);
}

.gif-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    color: var(--color-text-secondary);
}

.gif-checkbox-grid input[type="checkbox"] {
    accent-color: var(--color-primary);
    margin-right: 0.4rem;
}

.gif-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: var(--color-bg-subtle);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.gif-checkbox-grid label:has(input[type="checkbox"]:checked) {
    border-color: rgba(42, 219, 92, 0.55);
    box-shadow: 0 10px 22px rgba(42, 219, 92, 0.12);
    color: var(--color-text);
}

.gif-checkbox-grid label:hover {
    border-color: rgba(42, 219, 92, 0.35);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
}

.gif-time-range {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.gif-time-range label {
    background: var(--color-bg-subtle);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-text-secondary);
    transition: border-color 0.2s ease;
}

.gif-time-range input {
    width: 90px;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: var(--color-bg-subtle);
    color: var(--color-text);
}

.gif-time-range label:focus-within {
    border-color: rgba(42, 219, 92, 0.45);
}

.gif-ai {
    background: var(--color-bg-muted);
    padding: 1.5rem;
    color: var(--color-text-secondary);
}

.gif-ai__summary {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.gif-ai__list {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.5rem;
}

.gif-estimate {
    display: grid;
    gap: 1rem;
}

.gif-estimate__item {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-secondary);
}

.gif-estimate__value {
    font-weight: 600;
    color: var(--color-text);
}

.gif-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.gif-result {
    padding: 0 2rem 4rem;
}

.gif-result__panel {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--color-bg-subtle);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    box-shadow: 0 12px 30px rgba(15, 25, 20, 0.08);
}

.gif-result__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.gif-result__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.gif-progress__bar {
    width: 100%;
    height: 0.65rem;
    background: var(--color-bg-muted);
    margin-bottom: 0.75rem;
}

.gif-progress__value {
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #2adb5c 0%, #32e569 100%);
}

.gif-progress__info {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.gif-preview {
    display: flex;
    gap: 1.75rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pointerNone {
    pointer-events: none;
    opacity: 0.5;
}

#gif-refresh-preview, #gif-open-task {
    display: none;
}

.gif-preview__media {
    flex: 0 0 320px;
    background: var(--color-bg-subtle);
    border: 2px solid rgba(255, 255, 255, 0.08);
    padding: 1.2rem;
    display: none;
}

.gif-preview__media img {
    width: 100%;
    display: block;
}

.gif-preview__details {
    flex: 1;
    min-width: 220px;
    color: var(--color-text-secondary);
    display: grid;
    gap: 0.9rem;
}

.gif-result__actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.gif-features {
    padding: 4rem 0;
    background: var(--color-bg);
}

.gif-features__header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.gif-features__header p {
    color: var(--color-text-secondary);
    margin-top: 0.75rem;
}

.gif-features__grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.gif-feature {
    background: var(--color-bg-subtle);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.6rem;
    /* box-shadow: 0 10px 26px rgba(15, 25, 20, 0.08); */
}

.gif-feature h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.gif-feature p {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.hidden {
    display: none !important;
}

@media (max-width: 1200px) {
    .gif-tool__layout {
        grid-template-columns: 1fr;
    }

    .gif-upload {
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .gif-hero__stats {
        gap: 1rem;
    }
    .gif-hero__title {
        font-size: 2.6rem;
    }

    .gif-upload__badges {
        flex-direction: column;
    }

    .gif-actions {
        justify-content: flex-start;
    }
}
