/* ========== RESET & GLOBAL ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    color: #1a202c;
    line-height: 1.5;
}

.compressor-container, .ocr-container, .tool-container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ========== BUTTONS & COMMON COMPONENTS ========== */
.btn {
    display: inline-block;
    background: #4299e1;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    font-size: 1rem;
}
.btn:hover { background: #3182ce; }
.btn-primary { background: #4299e1; }
.btn-primary:hover { background: #3182ce; }
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; background: #4299e1; }
.btn-sm:hover { background: #3182ce; }

/* Modern button effect (ripple) */
.modern-button {
    position: relative;
    overflow: hidden;
}
.modern-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.modern-button:hover::before {
    width: 300px;
    height: 300px;
}

/* ========== BREADCRUMB & PAGE HEADER ========== */
.breadcrumb {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #718096;
}
.breadcrumb a { color: #4299e1; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.page-header { text-align: center; margin-bottom: 0.1rem; }
.page-title { font-size: 2rem; color: #2d3748; margin-bottom: 0.5rem; }
.page-subtitle { font-size: 1.1rem; color: #4a5568; max-width: 800px; margin: 0 auto; }

/* ========== TRUST BOX & SECURITY ALERTS ========== */
.trust-box {
    max-width: 800px;
    margin: 0 auto 1.5rem;
    padding: 1rem;
    background-color: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 0.5rem;
    text-align: center;
}
.trust-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
    font-weight: 600;
    color: #166534;
}
.trust-bullets li { margin: 6px 0; }

.security-alert {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #e6fffa;
    border: 1px solid #4fd1c5;
    border-radius: 0.5rem;
    font-weight: 600;
    color: #38a169;
}

/* ========== UNIFIED BOX (DRAG & DROP) ========== */
.unified-box {
    border: 3px dashed #d1d9e6;
    border-radius: 12px;
    background: white;
    transition: border-color 0.3s, background-color 0.3s;
    margin: 2rem auto;
    max-width: 900px;
    padding: 0 1rem;
}
.unified-box.dragover {
    border-color: #4a7bff;
    background-color: #f0f5ff;
}
.unified-content {
    padding: 3rem 2rem;
    text-align: center;
}
.unified-icon { font-size: 48px; margin-bottom: 15px; color: #6c757d; }
.unified-title { font-size: 22px; font-weight: 600; margin-bottom: 10px; color: #212529; }
.unified-subtitle {
    color: #6c757d;
    margin-bottom: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.unified-helper { font-size: 13px; color: #718096; margin-top: 8px; }
.preview-grid-container { padding: 1.5rem; display: none; }
.compatibility-note {
    background: #f0f9ff;
    border: 1px solid #7dd3fc;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    font-size: 14px;
    color: #0369a1;
}

/* Alternate unified card (for merge/resize) */
.unified-upload-area { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.upload-preview-card {
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    border: 2px dashed #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
.upload-preview-card.drag-over {
    border-color: #4299e1;
    background-color: #f0f9ff;
    border-style: solid;
}
.upload-preview-card.has-files {
    border-style: solid;
    border-color: #e2e8f0;
    justify-content: flex-start;
}
.upload-instructions { padding: 2rem; }
.upload-icon { font-size: 3rem; margin-bottom: 1rem; color: #4299e1; }
.upload-btn { margin-top: 1.5rem; }

/* ========== DROP ZONE (BULK / MERGE) ========== */
.drop-zone {
    position: relative;
    border: 2px dashed #4299e1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background-color: #f8fafc;
    transition: all 0.3s ease;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.drop-zone.drag-over {
    background-color: #ebf8ff;
    border-color: #2b6cb0;
    transform: scale(1.01);
}
#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}
.file-icon { font-size: 50px; margin-bottom: 10px; }

/* ========== BULK FILE LIST ========== */
.file-list {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1rem;
}
.file-list-header, .file-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr 1fr 1.2fr;
    padding: 0.75rem 1rem;
    align-items: center;
    font-size: 0.9rem;
    gap: 0.5rem;
}
.file-list-header {
    background-color: #f7fafc;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 1px solid #e2e8f0;
}
.file-row { border-bottom: 1px solid #edf2f7; transition: background 0.2s; }
.file-row:hover { background: #f9f9ff; }
.file-status { font-size: 0.85rem; color: #4a5568; }
.file-actions .btn-sm { padding: 0.2rem 0.75rem; font-size: 0.8rem; }
.progress-inline { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-inline-fill { height: 100%; background: #4299e1; width: 0%; transition: width 0.2s; }
.compressed-stats { font-size: 0.8rem; color: #2c7a7b; background: #e6fffa; padding: 2px 6px; border-radius: 12px; white-space: nowrap; }

/* ========== GIF SPECIFIC STYLES ========== */
.gif-preview-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.gif-frame-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
}
.gif-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.gif-play-btn {
    padding: 6px 16px;
    background: linear-gradient(135deg, #4299e1, #2b6cb0);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.gif-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}
.frame-counter {
    font-size: 0.85rem;
    color: #4a5568;
    background: #f7fafc;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}
.frame-extraction-options {
    background: #f0fff4;
    border: 2px solid #c6f6d5;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.frame-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.frame-thumb {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}
.frame-thumb:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.frame-thumb.selected {
    border-color: #38a169;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.2);
    transform: scale(1.05);
}
.frame-thumb img {
    width: 100%;
    height: 60px;
    object-fit: contain;
    background: #f8fafc;
}
.frame-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    font-size: 0.65rem;
    padding: 3px;
    font-weight: 600;
}
.frame-delay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    font-size: 0.6rem;
    padding: 2px;
}
.frame-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
}
.frame-range { flex: 1; }
.frame-range input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}
.frame-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.frame-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #ebf8ff;
    border-radius: 8px;
    border: 1px solid #bee3f8;
}
.frame-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.frame-stat-value { font-size: 1.2rem; font-weight: 700; color: #2b6cb0; }
.frame-stat-label { font-size: 0.75rem; color: #718096; margin-top: 0.25rem; }

/* ========== RESIZE TOOL / EDITOR LAYOUT ========== */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    margin-top: 1rem;
}
.editor-preview.drag-drop {
    cursor: pointer;
    border: 2px dashed #cbd5e0;
    transition: border-color 0.2s, background-color 0.2s;
    position: relative;
    min-height: 400px;
    overflow: hidden;
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}
.editor-preview.drag-drop:hover {
    border-color: #4299e1;
    background-color: #f7fafc;
}
.editor-preview.drag-drop.dragover {
    border-color: #4299e1;
    background-color: #ebf8ff;
    border-style: solid;
}
.editor-preview.drag-drop.has-image {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
}
#imagePreview {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
}
.dimension-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.dimension-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dimension-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.aspect-ratio-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}
.ratio-btn {
    padding: 0.4rem;
    font-size: 0.8rem;
    background-color: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    cursor: pointer;
}
.ratio-btn:hover { background-color: #e2e8f0; }
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ========== PDF / OCR SPECIFIC ========== */
.pdf-ocr-wrap { max-width: 900px; margin: 2rem auto; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); padding: 2rem; }
.ocr-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 1.5rem;
}
.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.control-group label { font-size: 0.9rem; font-weight: 600; color: #4a5568; }
select, input[type="text"], input[type="number"] {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.btn-run {
    background: #4299e1;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.btn-run:hover { background: #3182ce; }
.btn-run:disabled { background: #a0aec0; cursor: not-allowed; }
textarea#outText, #outText {
    width: 100%;
    min-height: 250px;
    margin-top: 1rem;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f1f5f9;
    font-family: inherit;
    font-size: 1rem;
}
.progress-container { margin: 1rem 0; display: none; }
.progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #4299e1; width: 0%; transition: width 0.3s; }
.progress-text { font-size: 0.9rem; color: #4a5568; margin-top: 0.5rem; text-align: center; }

/* ========== CONVERSION MODE SELECTOR (GIF/PNG) ========== */
.conversion-mode-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.mode-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: #4a5568;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    flex: 1;
    text-align: center;
}
.mode-btn.active {
    background: linear-gradient(135deg, #4299e1, #2b6cb0);
    color: white;
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.2);
}
.mode-description {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}
.animation-settings {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 2px solid #e2e8f0;
    display: none;
}
.setting-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.setting-label { font-weight: 600; color: #2d3748; min-width: 150px; }
.setting-control { flex: 1; }
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}
.slider-value { min-width: 40px; text-align: center; font-weight: 600; color: #4299e1; }
input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, #4299e1, #2b6cb0);
    border-radius: 4px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #4299e1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.size-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.size-preset-btn {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.2s;
}
.size-preset-btn:hover { border-color: #4299e1; background: #ebf8ff; }
.size-preset-btn.active {
    border-color: #4299e1;
    background: #4299e1;
    color: white;
    font-weight: 600;
}
.size-preset-btn .size-desc { font-size: 0.7rem; color: #718096; margin-top: 0.25rem; }
.size-preset-btn.active .size-desc { color: rgba(255, 255, 255, 0.9); }
.custom-size-inputs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    align-items: center;
}
.custom-size-inputs input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
}
.transparency-settings {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 2px solid #bae6fd;
}
.transparency-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #ebf8ff;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #2b6cb0;
    font-weight: 500;
}
.transparency-indicator::before {
    content: '';
    width: 12px;
    height: 12px;
    background: linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%),
                linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    border-radius: 50%;
}
.bg-color-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    background: linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%),
                linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    position: relative;
    overflow: hidden;
}
.color-preview-fill {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.transparency-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #92400e;
    font-size: 0.9rem;
}
.transparency-note strong { color: #b45309; }

/* ========== CONTENT SECTIONS (SEO, FAQ, FEATURES) ========== */
.content-section {
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}
.content-section h2 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}
.content-section h3 {
    color: #4a5568;
    font-size: 1.3rem;
    margin: 2rem 0 1rem 0;
}
.content-section p { line-height: 1.7; margin-bottom: 1.2rem; color: #4a5568; }
.content-section ul, .content-section ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.content-section li { margin-bottom: 0.8rem; line-height: 1.6; color: #4a5568; }
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.feature-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #4a7bff;
}
.feature-item {
    padding: 1.5rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}
.info-box {
    background: #f0fff4;
    border-left: 4px solid #38a169;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.warning-box {
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.tip-box {
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.professional-box {
    background: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.archival-box {
    background: #faf5ff;
    border-left: 4px solid #8b5cf6;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
}
.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.comparison-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #2d3748;
}
.comparison-table tr:hover { background: #f8fafc; }
.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.faq-question {
    padding: 1rem;
    background: #edf2f7;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-answer {
    padding: 1rem;
    background: white;
    display: none;
}
.faq-item.active .faq-answer { display: block; }

/* ========== HOMEPAGE / TOOLS GRID ========== */
.tools {
    padding: 4rem 0;
    background: #f8f9fa;
}
.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
    color: #2d3748;
    position: relative;
}
.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: #667eea;
    margin: 1rem auto;
    border-radius: 2px;
}
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    margin: 3rem 0;
}
.tool-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}
.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}
.tool-icon-fa {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.tool-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2d3748;
}
.tool-description {
    font-size: 0.95rem;
    color: #718096;
    line-height: 1.5;
    margin-bottom: 0;
}
.tool-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #38a169;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.tool-badge.new { background: #38a169; }
.tool-badge.popular { background: #4299e1; }
.tool-preview-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
    border: 1px solid #e2e8f0;
}
.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}
.preview-image {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}
.preview-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}
.preview-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(66, 153, 225, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.preview-label.after {
    background: rgba(56, 161, 105, 0.9);
    left: auto;
    right: 10px;
}
.preview-arrow {
    text-align: center;
    font-size: 2rem;
    color: #4299e1;
    font-weight: bold;
}
.feature-highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
    color: white;
    text-align: center;
}
.feature-highlight h2 { color: white; margin-bottom: 1rem; }
.feature-highlight p { opacity: 0.9; max-width: 600px; margin: 0 auto 2rem; }
.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}
.process-step {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.step-number {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: #4299e1;
    color: white;
    border-radius: 50%;
    line-height: 36px;
    font-weight: bold;
    margin-bottom: 1rem;
}
.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0.25rem;
}
.badge-jpg { background: #fed7d7; color: #c53030; }
.badge-png { background: #c6f6d5; color: #276749; }
.badge-webp { background: #bee3f8; color: #2c5282; }
.badge-gif { background: #e9d8fd; color: #553c9a; }
.badge-bmp { background: #fbd38d; color: #9c4221; }
.badge-tiff { background: #b2f5ea; color: #285e61; }
.badge-svg { background: #fed7e2; color: #97266d; }

/* ========== RELATED TOOLS SECTION ========== */
.related-tools-section {
    margin: 3rem 0;
    padding: 2rem;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}
.related-tools-section h3 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    justify-items: center;
}
.related-tool-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #4299e1, #2b6cb0);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
    text-decoration: none;
    width: 100%;
    max-width: 250px;
    text-align: center;
}
.related-tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.5);
}

/* ========== LANDING PAGE CTA & FEATURE LIST ========== */
.landing-cta { text-align: center; margin: 2rem 0; }
.feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin: 2rem 0;
}
.feature-item {
    background: #f7fafc;
    border-radius: 8px;
    padding: 1.5rem;
    flex: 1 1 200px;
    text-align: center;
}
.email-tips {
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0.5rem;
}

/* ========== CONTACT PAGE ========== */
.contact-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.contact-intro {
    text-align: center;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 2rem;
    font-size: 1rem;
}
.contact-ways h2 {
    font-size: 1.5rem;
    color: #2d3748;
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 600;
}
.contact-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.contact-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.contact-card h3 {
    color: #2d3748;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4299e1;
}
.contact-detail {
    margin-bottom: 0.8rem;
    color: #4a5568;
}
.contact-detail strong {
    color: #2d3748;
    display: block;
    margin-bottom: 0.2rem;
}
.helpful-tip {
    background: #ebf8ff;
    padding: 0.8rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #2c5282;
    border-left: 3px solid #4299e1;
}
.contact-form-section {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 600;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* ========== SPINNER & LOADING ========== */
.spinner {
    border: 3px solid rgba(66, 153, 225, 0.2);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: #4299e1;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.loading .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
}
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.processing-indicator {
    text-align: center;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
}
.frame-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== ERROR & FALLBACK MESSAGES ========== */
.error-message {
    background: #fee;
    border: 2px solid #f99;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    color: #c00;
    text-align: center;
    display: none;
}
.fallback-message {
    background: #fffaeb;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    color: #92400e;
}
.no-js-message {
    padding: 1.5rem;
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 8px;
    color: #856404;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ========== CROPPER OVERRIDES (for resize) ========== */
.cropper-container { background: transparent !important; }
.cropper-view-box { outline-color: rgba(66, 153, 225, 0.8) !important; }
.cropper-face { background-color: transparent !important; }
.cropper-line { background-color: #4299e1 !important; }
.cropper-point {
    background-color: #4299e1 !important;
    border: 1px solid #ffffff;
}
.cropper-bg { background: transparent !important; }
.cropper-crop-box { background: transparent !important; }

/* ========== RESPONSIVE MEDIA QUERIES (MERGED) ========== */
@media (max-width: 900px) {
    .tool-wrapper { grid-template-columns: 1fr; gap: 1rem; }
    .editor-layout { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .controls-panel { order: 2; margin-top: 1rem; }
    .editor-main { order: 1; }
    .editor-preview.drag-drop { height: 300px !important; min-height: 300px !important; }
}

@media (max-width: 768px) {
    .unified-content { padding: 2rem 1rem; }
    .unified-box { margin: 1rem auto; }
    .setting-row { flex-direction: column; align-items: flex-start; }
    .setting-label { min-width: auto; }
    .conversion-mode-selector { flex-direction: column; }
    .size-presets { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
    .preview-container { grid-template-columns: 1fr; gap: 1rem; }
    .preview-arrow { display: none; }
    .content-section, .related-tools-section {
        margin-left: 1rem;
        margin-right: 1rem;
        width: calc(100% - 2rem);
    }
    .content-section { padding: 1.5rem; }
    .related-tools-section { padding: 1.5rem; }
    .related-tools-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
    .related-tool-btn { max-width: 100%; }
    .tools-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
    .tool-card { padding: 1.25rem; }
    .page-header h1 { font-size: 2rem; }
    .contact-methods { grid-template-columns: 1fr; }
    .contact-form-section, .faq-section { padding: 1.5rem; }
    .tool-links { flex-direction: column; align-items: center; }
    .tool-link { width: 200px; text-align: center; }
    .button-grid { grid-template-columns: 1fr; gap: 0.25rem; }
    .button-grid .btn { font-size: 0.8rem; padding: 0.4rem 0.5rem; }
    .image-area { height: 40vh; }
    .file-list-header, .file-row {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.2fr;
        font-size: 0.8rem;
        gap: 0.3rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .tools-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 1.75rem; }
    .comparison-table { font-size: 0.9rem; }
    .comparison-table th, .comparison-table td { padding: 0.75rem 0.5rem; }
    .content-section, .related-tools-section {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        width: calc(100% - 1rem);
        padding: 1rem;
    }
    .feature-grid { grid-template-columns: 1fr; }
}

/* ========== MISC UTILITIES ========== */
.control-group { margin: 2rem auto; max-width: 400px; }
.custom-select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    color: #4a5568;
    margin-top: 0.5rem;
}
.download-all-area {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0fff4;
    border: 2px solid #c6f6d5;
    border-radius: 0.5rem;
    text-align: center;
    display: none;
}
.compatibility-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #22c55e;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}
.compatibility-badge.warning { background: #f59e0b; }
.compatibility-badge.info { background: #0ea5e9; }
.professional-use-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: 0.5rem;
}
.size-saving-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #dcfce7;
    color: #166534;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: 0.5rem;
}