/* ============================================
   GIF Loop Changer - Enhanced Stylesheet
   Matching ConvertICO design system
   ============================================ */

/* CSS Variables */
:root {
    --primary: #3B82F6;
    --primary-light: #BFDBFE;
    --primary-dark: #1D4ED8;
    --accent: #10B981;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    
    --once: #EF4444;
    --custom: #3B82F6;
    --infinite: #8B5CF6;
    
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #f1f5f9 100%);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-icon-wrapper {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.2);
    flex-shrink: 0;
}

.tool-icon-wrapper svg,
.tool-icon-wrapper i {
    width: 28px;
    height: 28px;
}

.tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tool-description {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Main Tool Area */
.tool-main {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Upload Section */
.upload-section {
    padding: 3rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(29, 78, 216, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area:hover::before,
.upload-area.dragover::before {
    opacity: 1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 1rem;
}

.upload-hint {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

/* URL Import Section */
.url-import-section {
    margin-top: 1.5rem;
}

.url-import-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.url-import-divider::before,
.url-import-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.url-import-divider span {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

.url-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.url-input-wrapper i {
    color: var(--text-muted);
    flex-shrink: 0;
}

.url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    min-width: 0;
}

.url-input::placeholder {
    color: var(--text-muted);
}

/* Editor Section */
.editor-section {
    padding: 0;
}

/* File Info Bar */
.file-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-info-item svg,
.file-info-item i {
    color: var(--primary);
    flex-shrink: 0;
}

.current-loop-item {
    margin-left: auto;
}

.loop-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--infinite), #7C3AED);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

/* Panels */
.preview-panel,
.controls-panel {
    padding: 2rem;
}

.preview-panel {
    background: #fafafa;
    border-right: 1px solid var(--border);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.panel-header h3 svg,
.panel-header h3 i {
    color: var(--primary);
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

/* Icon Buttons */
.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-preview-loop {
    background: linear-gradient(135deg, var(--success-light), #A7F3D0);
    border-color: var(--success);
    color: var(--success);
}

.btn-preview-loop:hover {
    background: var(--success);
    color: white;
}

/* Preview Container */
.preview-container {
    position: relative;
}

.preview-wrapper {
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    border: 1px solid var(--border);
}

.preview-wrapper img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

/* Loop Preview Overlay */
.loop-preview-overlay {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    min-width: 180px;
}

.loop-preview-info {
    text-align: center;
}

.loop-counter {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.loop-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loop-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Frame Timeline */
.frame-timeline {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.timeline-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.timeline-label i {
    color: var(--primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-text:hover {
    background: var(--primary-light);
}

.timeline-slider-container {
    padding: 0 0.5rem;
}

.timeline-track {
    position: relative;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin: 1rem 0;
}

.timeline-range {
    position: absolute;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    left: 0%;
    right: 0%;
}

.timeline-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: var(--bg-elevated);
    border: 3px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 2;
}

.timeline-thumb:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.timeline-thumb:active {
    cursor: grabbing;
}

.timeline-thumb.start {
    left: 0%;
}

.timeline-thumb.end {
    left: 100%;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Loop Mode Grid */
.loop-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.loop-mode-card {
    position: relative;
    cursor: pointer;
}

.loop-mode-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    transition: all 0.2s ease;
}

.loop-mode-card:hover .mode-card-inner {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.loop-mode-card input:checked + .mode-card-inner {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.mode-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease;
}

.loop-mode-card:hover .mode-icon {
    transform: scale(1.1);
}

.mode-icon.once {
    background: linear-gradient(135deg, var(--danger-light), #FECACA);
    color: var(--danger);
}

.mode-icon.custom {
    background: linear-gradient(135deg, var(--primary-light), #93C5FD);
    color: var(--primary);
}

.mode-icon.infinite {
    background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
    color: var(--infinite);
}

.mode-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Custom Loop Controls */
.custom-controls {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.control-label i {
    color: var(--primary);
}

/* Loop Input Group - Enhanced Styling */
.loop-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.loop-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.loop-btn {
    width: 52px;
    height: 52px;
    border: none;
    background: linear-gradient(135deg, var(--bg) 0%, #f1f5f9 100%);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.loop-btn:hover {
    background: linear-gradient(135deg, var(--primary-light), #93C5FD);
    color: var(--primary-dark);
}

.loop-btn:active {
    transform: scale(0.95);
}

.loop-btn.minus {
    border-right: 1px solid var(--border);
}

.loop-btn.plus {
    border-left: 1px solid var(--border);
}

.loop-input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    outline: none;
}

.loop-input::-webkit-outer-spin-button,
.loop-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.loop-input[type=number] {
    -moz-appearance: textfield;
}

/* Preset Buttons */
.preset-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.preset-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

/* Speed Controls */
.speed-controls {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-radius: var(--radius-md);
    border: 1px solid #FDE68A;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.speed-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
}

.speed-slider-wrapper {
    margin-bottom: 0.75rem;
}

.slider-input {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #10B981, #F59E0B, #EF4444);
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.slider-input:hover {
    opacity: 1;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 3px solid var(--warning);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 3px solid var(--warning);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.speed-presets {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.speed-preset {
    padding: 0.4rem 0.85rem;
    border: 2px solid #FDE68A;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-preset:hover {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.speed-preset.active {
    border-color: var(--warning);
    background: var(--warning);
    color: white;
}

/* Output Preview */
.output-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-light), #DBEAFE);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
}

.output-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.output-preview span {
    font-size: 0.95rem;
    color: var(--text);
}

.output-preview strong {
    color: var(--primary-dark);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 2px solid transparent;
}

.btn svg,
.btn i {
    flex-shrink: 0;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Section - Enhanced */
.progress-section {
    padding: 2rem;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-top: 1px solid var(--primary-light);
}

.progress-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
    padding: 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.progress-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-light), #93C5FD);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-text {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.progress-track {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

/* Spin Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Batch Section */
.batch-section {
    padding: 2rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.batch-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.batch-header h3 i {
    color: var(--primary);
}

.batch-count {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

.batch-files {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.batch-file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.batch-file-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 8px 8px;
}

.batch-file-info {
    flex: 1;
    min-width: 0;
}

.batch-file-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.batch-file-remove {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.batch-file-remove:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.batch-settings {
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.batch-setting-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.batch-setting-row label {
    font-weight: 600;
    color: var(--text);
}

.batch-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.batch-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    text-align: center;
}

.batch-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.batch-progress {
    margin-top: 1.5rem;
    text-align: center;
}

.batch-progress .progress-track {
    margin-bottom: 0.75rem;
}

.batch-progress .progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    padding: 3rem 2rem;
    text-align: center;
}

.results-header {
    margin-bottom: 2rem;
}

.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--success-light), #A7F3D0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin: 0 auto 1rem;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.results-header h2 {
    font-size: 1.75rem;
    color: var(--text);
    margin: 0;
}

/* Results Comparison */
.results-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.comparison-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.comparison-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-preview {
    width: 180px;
    height: 135px;
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 16px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    overflow: hidden;
}

.comparison-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.comparison-badge {
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, var(--infinite), #7C3AED);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.comparison-badge.modified {
    background: linear-gradient(135deg, var(--success), #059669);
}

.comparison-arrow {
    color: var(--text-muted);
}

/* Results Info */
.results-info {
    max-width: 300px;
    margin: 0 auto 2rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.info-row span:first-child {
    color: var(--text-secondary);
}

.info-row span:last-child {
    font-weight: 600;
    color: var(--text);
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Related Tools */
.related-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.related-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.related-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.related-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Info Sections */
.info-sections {
    display: grid;
    gap: 2rem;
    margin-top: 3rem;
}

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    color: var(--text);
    margin: 0 0 1.5rem;
}

.info-card h2 svg,
.info-card h2 i {
    color: var(--primary);
    flex-shrink: 0;
}

/* Steps List */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding-left: 3.5rem;
    padding-bottom: 1.25rem;
    counter-increment: step;
    color: var(--text-secondary);
    line-height: 1.6;
}

.steps-list li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--primary-light);
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 1;
}

.steps-list a {
    color: var(--primary);
    text-decoration: none;
}

.steps-list a:hover {
    text-decoration: underline;
}

/* Sample GIFs Card */
.samples-card .samples-intro {
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
}

.sample-gifs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.sample-gif-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-gif-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.sample-gif-btn img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.sample-gif-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.view-all-samples {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.view-all-samples:hover {
    text-decoration: underline;
}

/* Mode Explanations */
.mode-explanations {
    display: grid;
    gap: 1rem;
}

.mode-explain {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.mode-tag {
    flex-shrink: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.mode-tag.once {
    background: linear-gradient(135deg, var(--danger), #DC2626);
}

.mode-tag.custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.mode-tag.infinite {
    background: linear-gradient(135deg, var(--infinite), #7C3AED);
}

.mode-explain p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* FAQ */
.faq-list {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: var(--bg-elevated);
}

.faq-question svg,
.faq-question i {
    color: var(--primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-question svg,
.faq-item.open .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1rem;
    background: var(--bg-elevated);
}

.faq-item.open .faq-answer {
    display: block;
}

.faq-answer p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 900px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .file-info-bar {
        justify-content: center;
    }
    
    .current-loop-item {
        margin-left: 0;
    }
    
    .results-comparison {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .comparison-arrow {
        transform: rotate(90deg);
    }
    
    .sample-gifs {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .tool-title-row {
        flex-direction: row;
        gap: 0.75rem;
    }
    
    .tool-icon-wrapper {
        width: 48px;
        height: 48px;
    }
    
    .tool-icon-wrapper svg,
    .tool-icon-wrapper i {
        width: 24px;
        height: 24px;
    }
    
    .upload-section {
        padding: 2rem 1.5rem;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .preview-panel,
    .controls-panel {
        padding: 1.5rem;
    }
    
    .loop-mode-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mode-card-inner {
        flex-direction: row;
        text-align: left;
        gap: 1rem;
        padding: 1rem;
    }
    
    .mode-icon {
        margin-bottom: 0;
    }
    
    .action-bar {
        flex-direction: column;
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
    }
    
    .related-tools {
        flex-direction: column;
        text-align: center;
    }
    
    .related-links {
        justify-content: center;
    }
    
    .mode-explain {
        flex-direction: column;
    }
    
    .batch-setting-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .url-input-wrapper {
        flex-wrap: wrap;
    }
    
    .url-input {
        flex: 1 1 100%;
        order: 1;
    }
    
    .url-input-wrapper .btn {
        width: auto;
        flex: none;
    }
}

@media (max-width: 480px) {
    .tool-title {
        font-size: 1.5rem;
    }
    
    .file-info-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .comparison-preview {
        width: 140px;
        height: 105px;
    }
    
    .steps-list li {
        padding-left: 3rem;
    }
    
    .sample-gifs {
        grid-template-columns: 1fr 1fr;
    }
    
    .sample-gif-btn img {
        width: 48px;
        height: 48px;
    }
    
    .preset-buttons {
        flex-wrap: wrap;
    }
    
    .speed-presets {
        flex-wrap: wrap;
    }
}

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

.editor-section,
.results-section,
.batch-section {
    animation: fadeIn 0.4s ease;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    
    .spin {
        animation: none;
    }
}
