/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-blue: #3498db;
    --primary-green: #2ecc71;
    --primary-purple: #9b59b6;
    --primary-orange: #f39c12;
    --primary-red: #e74c3c;
    --dark-blue: #2980b9;
    --dark-green: #27ae60;
    --text-primary: #2c3e50;
    --text-secondary: #64748b;
    --text-muted: #7f8c8d;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-light: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.3s ease;
}

/* Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: #fafbfc;
}

/* Page structure */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styling */
.text-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 700;
    text-align: left;
    line-height: 1.2;
}

.text-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: left;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto 40px;
    display: block;
}

/* Alert messages */
.message {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

.message.error {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-bottom: 2px solid var(--primary-red);
    color: #c62828;
}

.message.error::before {
    content: '❌';
    font-size: 18px;
}

.alert {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
    position: relative;
}

.alert-error {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-bottom: 2px solid var(--primary-red);
    color: #c62828;
}

.alert-icon {
    font-size: 18px;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: 24px;
    color: currentColor;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Success container */
.success-container {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    border: 2px solid var(--primary-green);
    border-radius: var(--radius-xl);
    padding: 40px;
    margin: 30px 0 !important;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.success-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-green);
    margin: 0;
}

.result-image-container {
    margin: 20px 0 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    max-width: 100%;
}

.result-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-lg);
    display: block;
}

/* File stats */
.file-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin: 30px 0;
    width: 100%;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-white), #f8fafc);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    position: relative;
    transition: var(--transition);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-green));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-dark);
}

.stat-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stat-value {
    display: block;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin: 4px 0;
    line-height: 1.3;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.download-button, .process-another-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
    justify-content: center;
}

.download-button {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.process-another-button {
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.process-another-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.button-icon {
    font-size: 18px;
}

/* Form section */
.form-section {
    margin: 30px 0;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--primary-blue);
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.1), transparent);
    transition: left 0.6s ease;
}

.upload-area:hover::before {
    left: 100%;
}

.upload-area:hover {
    border-color: var(--dark-blue);
    background: linear-gradient(135deg, #e3f2fd, var(--bg-white));
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.upload-area.active {
    border-color: var(--primary-green);
    background: linear-gradient(135deg, #e8f5e8, var(--bg-white));
    transform: scale(1.05);
}

.upload-icon {
    font-size: 64px;
    color: var(--primary-blue);
    margin-bottom: 20px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

.upload-text h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-text p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* GIF-specific styles */
.gif-canvas {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: var(--shadow-md);
}

.preview-gif {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.text-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.text-overlay {
    position: absolute;
    cursor: grab;
    user-select: none;
    pointer-events: all;
    white-space: nowrap;
    font-weight: bold;
    text-align: center;
    transition: all 0.2s ease;
    z-index: 10;
    transform-origin: center;
}

.text-overlay:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(0,0,0,0.3));
}

.text-overlay.active {
    outline: 2px dashed var(--primary-blue);
    outline-offset: 4px;
    background: rgba(52, 152, 219, 0.1);
    transform: scale(1.02);
}

.text-overlay:active {
    cursor: grabbing;
}

/* Preview container */
.preview-container {
    background: linear-gradient(135deg, var(--bg-white), var(--bg-light));
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 20px 0;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.preview-container.hidden {
    display: none;
}

.preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.file-details {
    padding: 16px;
    background: #fdeeee;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-secondary);
    width: 100%;
    text-align: center;
}

/* Text Controls */
.text-controls {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin: 30px 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.text-controls.hidden {
    display: none;
}

.control-group {
    margin-bottom: 32px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.label-icon {
    font-size: 18px;
}

.text-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.control-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.color-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-white);
}

.color-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Slider styling */
.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-orange), var(--primary-red));
    outline: none;
    opacity: 0.9;
    transition: var(--transition);
}

.slider:hover {
    opacity: 1;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    border: none;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* Style Buttons */
.style-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.style-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.style-btn.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Effects Section */
.effects-section {
    margin: 32px 0;
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.effects-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.effects-section h3::before {
    content: '✨';
    font-size: 20px;
}

/* Text Layers */
.text-layers {
    margin: 32px 0;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.text-layers h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-layers h3::before {
    content: '📝';
    font-size: 20px;
}

.layer-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.add-text-btn, .delete-text-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.add-text-btn {
    background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
    color: white;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25);
}

.add-text-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 204, 113, 0.35);
}

.delete-text-btn {
    background: linear-gradient(135deg, var(--primary-red), #c0392b);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.25);
}

.delete-text-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.35);
}

.delete-text-btn:disabled {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.layers-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
}

.layer-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-item:hover {
    background: var(--bg-light);
}

.layer-item.active {
    background: var(--primary-blue);
    color: white;
}

.layer-preview {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Generate Button */
.generate-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 280px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.generate-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.generate-button:hover::before {
    left: 100%;
}

.generate-button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.5);
}

/* Cancel button */
.cancel-button {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.25);
}

.cancel-button:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(127, 140, 141, 0.3);
}

.cancel-button.hidden {
    display: none;
}

/* Progress container */
.progress-container {
    background: linear-gradient(135deg, var(--bg-white), var(--bg-light));
    border-radius: var(--radius-lg);
    padding: 30px;
    margin: 25px 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    text-align: center;
}

.progress-container.hidden {
    display: none;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.progress-icon {
    font-size: 24px;
    animation: spin 2s linear infinite;
}

.progress-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    height: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-green));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 8px;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

.progress-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Recommendations */
.conversion-recommendations {
    background: linear-gradient(135deg, var(--bg-white), var(--bg-light));
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 30px 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.recommendations-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.recommendations-icon {
    font-size: 20px;
}

.recommendations-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.tool-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.tool-link.compress {
    background: #81DCA1;
    color: #2d5a3d;
}

.tool-link.compress:hover {
    background: #6bc788;
}

.tool-link.webp {
    background: #ff9800;
    color: #5d3600;
}

.tool-link.webp:hover {
    background: #e68900;
}

.tool-link.avif {
    background: #B8DFFF;
    color: #1a4480;
}

.tool-link.avif:hover {
    background: #9fd1ff;
}

/* Content rows */
.content-row-1, .content-row-2 {
    padding: 40px 0;
    width: 100%;
}

.content-row-2 {
    background: linear-gradient(135deg, #f7f9fc, #eef2f7);
}

/* Info sections */
.info-sections-wrapper {
    display: grid;
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.info-section {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.info-icon {
    font-size: 24px;
}

.info-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.info-content {
    line-height: 1.7;
    color: var(--text-secondary);
}

.info-content h3 {
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 16px;
}

/* Accent bars */
.accent-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.blue-gradient {
    background: linear-gradient(90deg, var(--primary-blue), var(--dark-blue));
}

.green-gradient {
    background: linear-gradient(90deg, var(--primary-green), var(--dark-green));
}

.purple-gradient {
    background: linear-gradient(90deg, var(--primary-purple), #8e44ad);
}

.orange-gradient {
    background: linear-gradient(90deg, var(--primary-orange), #e67e22);
}

.rainbow-gradient {
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-green), var(--primary-orange), var(--primary-red));
}

/* Instruction list */
.instruction-list {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.instruction-list li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 60px;
    margin-bottom: 20px;
    font-size: 16px;
}

.instruction-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.feature-item {
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.feature-item h4 {
    color: var(--text-primary);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.feature-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* FAQ section */
.faq-section {
    margin-top: 20px;
}

.faq-item {
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-sm);
}

.faq-question {
    padding: 20px;
    background: var(--bg-light);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    color: var(--text-primary);
}

.faq-question:hover {
    background: #eef2f7;
}

.faq-item.active .faq-question {
    background: var(--primary-blue);
    color: white;
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    background: var(--bg-white);
    transition: all 0.3s ease;
    color: var(--text-secondary);
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    padding: 20px;
    max-height: 500px;
}

.faq-toggle {
    font-size: 20px;
    font-weight: bold;
    transition: transform 0.3s ease;
    color: var(--primary-blue);
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
    color: white;
}

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

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

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .text-title {
        font-size: 2rem;
    }
    
    .text-description {
        font-size: 1rem;
    }
    
    .text-controls {
        padding: 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 48px;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .layer-controls {
        flex-direction: column;
    }
    
    .add-text-btn, .delete-text-btn {
        width: 100%;
        justify-content: center;
    }
    
    .generate-button {
        width: 100%;
        min-width: auto;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .gif-canvas {
        width: 100%;
    }
    
    .text-overlay {
        font-size: 16px !important;
        min-font-size: 12px;
    }
    
    .style-buttons {
        justify-content: center;
    }
    
    .file-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 16px;
    }
    
    .download-button, .process-another-button {
        width: 100%;
        min-width: auto;
    }
    
    .info-section {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .text-title {
        font-size: 1.6rem;
    }
    
    .upload-area {
        padding: 30px 16px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .upload-text h3 {
        font-size: 16px;
    }
    
    .success-container {
        padding: 24px;
    }
    
    .success-title {
        font-size: 20px;
    }
    
    .text-controls {
        padding: 16px;
        margin: 20px 0;
    }
    
    .effects-section, .text-layers {
        padding: 16px;
        margin: 20px 0;
    }
    
    .text-input {
        min-height: 60px;
        font-size: 14px;
    }
    
    .generate-button {
        padding: 16px 24px;
        font-size: 14px;
    }
    
    .layer-item {
        padding: 10px 12px;
    }
    
    .layers-list {
        max-height: 150px;
    }
    
    .info-section {
        padding: 20px;
    }
    
    .instruction-list li {
        padding-left: 50px;
        font-size: 14px;
    }
    
    .instruction-list li::before {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .text-controls,
    .action-buttons,
    .layer-controls {
        display: none !important;
    }
    
    .gif-canvas {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .gif-canvas {
        background: #2a2a2a;
        border-color: var(--border-dark);
    }
    
    .text-overlay.active {
        outline-color: #64b5f6;
        background: rgba(100, 181, 246, 0.1);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .text-overlay {
        outline: 2px solid #000;
        background: rgba(255, 255, 255, 0.9);
    }
    
    .text-overlay.active {
        outline: 3px solid #0066cc;
        background: rgba(0, 102, 204, 0.2);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-light: #000;
        --border-dark: #000;
    }
    
    .upload-area {
        border-width: 2px;
    }
    
    .generate-button, .download-button, .process-another-button {
        border: 2px solid #000;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}