/* ===================================
   Image Tools - Use Karlo CSS
   Professional Image Processing Tools
   =================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header Styles
   =================================== */
.site-header {
    text-align: center;
    padding: 30px 0 15px;
    color: white;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
    display: inline-block;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.site-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.site-subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ===================================
   Main Content Styles
   =================================== */
.main-content {
    background: white;
    border-radius: 20px 20px 0 0;
    margin-top: 5px;
    padding: 30px 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
}

.tools-section {
    margin-bottom: 20px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.section-description {
    text-align: center;
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ===================================
   Tools Grid Styles
   =================================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 15px;
}

.tool-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.tool-link {
    display: block;
    padding: 30px 25px;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: all 0.3s ease;
}

.tool-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.tool-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1);
}

.tool-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-title {
    color: #667eea;
}

.tool-description {
    font-size: 0.95rem;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* ===================================
   Footer Styles
   =================================== */
.site-footer {
    background: #2c3e50;
    color: white;
    padding: 50px 0 30px;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-brand h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: white;
}

.footer-description {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    padding: 5px 10px;
    border-radius: 5px;
}

.footer-links a:hover {
    color: #3498db;
    background-color: rgba(255,255,255,0.1);
}

.footer-links a:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ===================================
   Tool Page Specific Styles
   =================================== */
.tool-page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
}

.tool-page-header .container {
    display: flex;
    align-items: center;
    gap: 30px;
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

.back-to-home:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
    color: white;
}

.back-to-home:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Mobile-only Back Button */
.back-to-home-mobile {
    display: none; /* Hidden by default */
    background: #f0f2ff;
    padding: 15px 20px;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    color: #667eea;
    border-bottom: 1px solid #e0e3f0;
}

.tool-header-content {
    flex: 1;
    text-align: center;
}

.tool-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tool-page-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.tool-content {
    background: white;
    min-height: 70vh;
    padding: 40px 0;
}

/* ===================================
   Tool-Specific Classes for Compatibility
   =================================== */
.tool-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.tool-page {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
    margin-bottom: 2rem;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: #666;
    font-size: 0.9rem;
}

.file-input {
    display: none;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.form-group input[type="range"]::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.preview-box {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.preview-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.preview-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block !important;
    margin: 0 auto;
}

.preview-img.hidden {
    display: none !important;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    white-space: pre-line;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Quick Action Buttons for Error Messages */
.error-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Mobile-only Back Button */
.back-to-home-mobile {
    display: none; /* Hidden by default */
    background: #f0f2ff;
    padding: 15px 20px;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    color: #667eea;
    border-bottom: 1px solid #e0e3f0;
}

/* ===================================
   Responsive Styles
   =================================== */
@media (max-width: 768px) {
    .back-to-home {
        display: none; /* Hide header back button on mobile */
    }

    .back-to-home-mobile {
        display: block; /* Show mobile back button */
    }

    .tool-page-header .container {
        justify-content: center;
    }

    .tool-header-content {
        text-align: center;
    }
}

/* ===================================
   Accessibility Styles
   =================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .logo {
        animation: none;
    }
    
    .tool-card {
        transition: none;
    }
    
    .tool-icon {
        transition: none;
    }
}

/* ===================================
   Enhanced Accessibility
   =================================== */
/* Better focus styles */
:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
}

/* Keyboard focus styles for interactive elements */
.btn:focus-visible,
.tool-card:focus-visible,
.back-to-home:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 4px;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
}

/* Skip link for keyboard navigation */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    background: #667eea;
    color: white;
    padding: 8px;
    text-align: center;
    transition: top 0.2s;
    z-index: 1000;
    text-decoration: none;
}

.skip-to-main:focus {
    top: 0;
}

/* ARIA live region styling */
[aria-live="polite"],
[aria-live="assertive"] {
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

[aria-live="polite"] {
    background-color: #f0f9ff;
    color: #0369a1;
}

[aria-live="assertive"] {
    background-color: #fef2f2;
    color: #dc2626;
}

/* Status message styling */
.status-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-message[role="alert"] {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status-message[role="status"] {
    background-color: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* Better contrast ratios */
.tool-description {
    color: #4b5563;
}

.text-muted {
    color: #6b7280;
}

/* Enhanced form controls */
input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* Large clickable areas for touch */
.tool-card,
.btn,
.resize-mode-btn,
.ratio-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced loading indicators */
.loading-indicator {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.loading-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4b5563;
}

/* Print styles */
@media print {
    .tool-page-header {
        background: none;
        color: #000;
        padding: 20px 0;
        text-align: left;
    }
    
    .tool-page-title {
        font-size: 24pt;
        text-shadow: none;
    }
    
    .tool-content {
        background: none;
    }
    
    .preview-container {
        break-inside: avoid;
    }
    
    .btn,
    .back-to-home,
    .footer-links,
    .resize-controls {
        display: none;
    }
}

/* Resize Tool Specific Styles */
.resize-controls {
    background: #f8fafc;
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.resize-mode-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 20px;
}

.resize-mode-btn {
    flex: 1;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
    position: relative;
    overflow: hidden;
}

.resize-mode-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #3b82f6;
    transition: width 0.2s ease;
}

.resize-mode-btn:hover {
    border-color: #94a3b8;
    color: #475569;
    background: #f8fafc;
}

.resize-mode-btn:hover::before {
    width: 100%;
}

.resize-mode-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.resize-mode-btn.active::before {
    display: none;
}

.resize-mode-btn .mode-icon {
    font-size: 1.2rem;
}

.dimension-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.dimension-input {
    position: relative;
}

.dimension-input label {
    display: block;
    font-size: 1rem;
    color: #475569;
    margin-bottom: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dimension-input input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1rem;
    color: #1e293b;
    background: white;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dimension-input input[type="number"]:hover {
    border-color: #94a3b8;
}

.dimension-input input[type="number"]:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.dimension-input .unit {
    position: absolute;
    right: 14px;
    top: 43px;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    pointer-events: none;
}

.aspect-ratio-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.aspect-ratio-toggle:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.aspect-ratio-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.aspect-ratio-toggle input[type="checkbox"]:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.aspect-ratio-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 1px;
    left: 3px;
}

.aspect-ratio-toggle label {
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.2s;
}

.aspect-ratio-toggle:hover label {
    color: #1e293b;
}

.preset-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    color: #1e293b;
    background: white;
    margin: 8px 0 24px;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 10l4-4H4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.preset-select:hover {
    border-color: #94a3b8;
}

.preset-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.percentage-slider {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin: 24px 0;
}

.percentage-slider label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: #475569;
    margin-bottom: 16px;
    font-weight: 500;
}

.percentage-slider label span {
    color: #3b82f6;
    font-weight: 600;
}

.percentage-slider input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    transition: background 0.2s;
    margin: 10px 0;
}

.percentage-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.percentage-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
}

.percentage-slider input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.percentage-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
}

/* Free-style Crop Styles */
.freestyle-crop {
    background: #f8fafc;
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.crop-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crop-area {
    position: relative;
    width: 100%;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    min-height: 400px;
}

.crop-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-preview-img {
    max-width: 100%;
    max-height: 600px;
    display: block;
    object-fit: contain;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: crosshair;
}

.crop-box {
    position: absolute;
    border: 2px solid #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    cursor: move;
}

.resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    z-index: 10;
    transition: transform 0.1s, background-color 0.1s;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.resize-handle:hover {
    background: #3b82f6;
    transform: scale(1.2);
}

.resize-handle.top-left {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.resize-handle.top-right {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.resize-handle.bottom-left {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.resize-handle.bottom-right {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

/* Add grip lines to make handles more recognizable */
.crop-box .resize-handle::before,
.crop-box .resize-handle::after {
    content: '';
    position: absolute;
    background: #3b82f6;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.crop-box .resize-handle::before {
    width: 6px;
    height: 2px;
}

.crop-box .resize-handle::after {
    width: 2px;
    height: 6px;
}

.crop-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.crop-dimensions {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crop-dimensions span {
    color: #3b82f6;
    font-weight: 600;
}

.crop-actions {
    display: flex;
    gap: 12px;
}

.crop-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
}

/* Interactive Grid Lines */
.crop-box::before {
    content: '';
    position: absolute;
    top: 33.33%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.crop-box::after {
    content: '';
    position: absolute;
    top: 66.66%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.crop-box .vertical-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.crop-box .vertical-line:nth-child(1) {
    left: 33.33%;
}

.crop-box .vertical-line:nth-child(2) {
    left: 66.66%;
}

/* Hover states and animations */
.crop-box {
    transition: background-color 0.2s;
}

.crop-box:hover {
    background: rgba(59, 130, 246, 0.15);
}

.resize-handle {
    transition: all 0.2s;
}

.crop-actions .btn {
    transition: all 0.2s;
}

.crop-actions .btn:hover {
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .crop-info {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .crop-actions {
        width: 100%;
        justify-content: center;
    }
    
    .resize-handle {
        width: 20px;
        height: 20px;
    }
}

/* Image Editor Styles */
.image-editor {
    margin: 2rem 0;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.editor-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.panel-title {
    font-size: 1.25rem;
    color: #1e293b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-box {
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    padding: 1rem;
}

.preview-box h4 {
    font-size: 1.1rem;
    color: #475569;
    margin-bottom: 1rem;
    text-align: center;
}

.image-container {
    position: relative;
    min-height: 300px;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img {
    max-width: 100%;
    max-height: 500px;
    display: block;
}

.dimensions-info {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Crop Instructions */
.crop-instructions {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
}

.crop-instructions h4 {
    color: #334155;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crop-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.crop-instructions li {
    color: #475569;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crop-instructions li::before {
    content: '•';
    color: #3b82f6;
    font-weight: bold;
}

/* Crop Controls */
.crop-controls {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.controls-title {
    font-size: 1.25rem;
    color: #1e293b;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===================================
   Crop Tool Specific Styles
   =================================== */

/* Crop Settings Section */
.settings-icon {
    font-size: 1.2em;
    margin-right: 5px;
}

/* Ratio Buttons */
.ratio-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.ratio-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ratio-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.ratio-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.ratio-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.ratio-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.ratio-value {
    font-size: 0.8rem;
    opacity: 0.8;
}

.reset-crop-btn {
    background: #fd7e14;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-top: 15px;
}

.reset-crop-btn:hover {
    background: #e8590c;
    transform: translateY(-1px);
}

/* Crop Inputs Grid */
.crop-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-icon {
    margin-right: 5px;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.crop-input {
    flex: 1;
    padding: 10px 40px 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.crop-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.unit {
    position: absolute;
    right: 12px;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Advanced Options */
.advanced-options {
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

.option-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.toggle-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.toggle-option:hover {
    background: #e9ecef;
}

.toggle-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.toggle-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.toggle-text {
    font-weight: 500;
    color: #495057;
}

/* Crop Action Button */
.crop-action-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.crop-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(40, 167, 69, 0.4);
}

.crop-action-btn:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Crop Overlay and Visual Elements */
.image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
    cursor: move;
    pointer-events: all;
    min-width: 20px;
    min-height: 20px;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
}

.resize-handle.top-left {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.top-right {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.bottom-left {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.crop-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
}

.grid-line.horizontal {
    height: 1px;
    left: 0;
    right: 0;
}

.grid-line.horizontal:nth-child(1) {
    top: 33.33%;
}

.grid-line.horizontal:nth-child(2) {
    top: 66.66%;
}

.grid-line.vertical {
    width: 1px;
    top: 0;
    bottom: 0;
}

.grid-line.vertical:nth-child(3) {
    left: 33.33%;
}

.grid-line.vertical:nth-child(4) {
    left: 66.66%;
}

/* Crop Info and Instructions */
.crop-info {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.instructions {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 8px;
    text-align: left;
    line-height: 1.5;
}

/* Cropped Result Container */
.cropped-container {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.cropped-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ratio-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .crop-inputs-grid {
        grid-template-columns: 1fr;
    }
    
    .option-toggles {
        gap: 8px;
    }
    
    .crop-action-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* ===================================
   Enhanced Download Button Styles
   =================================== */
.download-section {
    margin-top: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border-radius: 8px;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.download-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    margin-bottom: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: all 0.6s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(45deg, #059669, #047857);
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.download-btn:disabled {
    background: linear-gradient(45deg, #94a3b8, #64748b);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.download-status {
    font-size: 14px;
    color: #64748b;
    margin-top: 12px;
    padding: 5px 10px;
    background-color: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: inline-block;
    transition: all 0.3s ease;
}

.download-status.ready {
    color: #10b981;
    font-weight: 600;
    background-color: #ecfdf5;
    border-color: #6ee7b7;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

/* Visible download prompt when ready */
.download-section.ready-to-download {
    background: linear-gradient(to bottom, #ecfdf5, #d1fae5);
    border-color: #6ee7b7;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    animation: glow-green 2s infinite alternate;
}

@keyframes glow-green {
    from {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
}

/* Add a special download indicator */
.ready-to-download::after {
    content: "↓ Your file is ready to download ↓";
    display: block;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    white-space: nowrap;
    animation: bounce-in 0.5s ease-out;
}

@keyframes bounce-in {
    0% {
        transform: translate(-50%, -20px);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, 5px);
    }
    100% {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Improve the download button visibility */
.download-section.ready-to-download .download-btn {
    background: linear-gradient(45deg, #047857, #10b981);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5), 0 0 0 2px rgba(16, 185, 129, 0.3);
    transform: scale(1.05);
    font-size: 1.15rem;
}

/* Fallback download link */
.fallback-download-link {
    display: none;
}

/* Make the download button more noticeable */
#downloadBtn:not(:disabled) {
    animation: throb 2s infinite alternate;
    border: 3px solid #047857;
}

@keyframes throb {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    100% {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
    }
}

/* Special attention for download button */
.download-section::after {
    content: "Click the button above to download ⬆️";
    display: block;
    margin-top: 10px;
    font-weight: 500;
    color: #047857;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Make download button extra visible */
.download-btn:not(:disabled) {
    background: #047857;
    font-size: 18px;
    padding: 16px 24px;
    margin: 15px auto;
    position: relative;
    z-index: 10;
    cursor: pointer;
}

.download-btn:not(:disabled)::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px dashed #047857;
    border-radius: 10px;
    animation: rotate 4s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Download overlay */
.download-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(4, 120, 87, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 100;
    border-radius: 8px;
}

.converted-container {
    position: relative;
}

.converted-container:hover .download-overlay:not(.hidden) {
    opacity: 1;
}

.download-overlay-content {
    text-align: center;
    color: white;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.converted-container:hover .download-overlay-content {
    transform: scale(1);
}

.download-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

/* Alternative download buttons */
.download-action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    animation: fade-in 0.5s ease-out;
}

.download-action-buttons.hidden {
    display: none;
}

.alt-download-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    font-size: 0.95rem;
    font-weight: 600;
    background: #f0fdfa;
    color: #047857;
    border: 2px solid #047857;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.alt-download-btn:hover {
    background: #047857;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(4, 120, 87, 0.3);
}

.alt-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(4, 120, 87, 0.2);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Better visibility for download container */
.ready-to-download {
    position: relative;
    padding: 20px;
    margin-top: 30px;
    border: 2px solid #10b981;
    background: #ecfdf5;
}

/* ===================================
   AdSense Ad Containers
   =================================== */

.ad-container {
    text-align: center;
    margin: 20px 0;
    padding: 10px;
}

.ad-container-top {
    text-align: center;
    margin: 20px 0;
}

.ad-container-bottom {
    text-align: center;
    margin: 30px 0;
}

.ad-container-grid {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

/* AdSense responsive styling */
.adsbygoogle {
    display: block;
}

/* ===================================
   End AdSense Styles
   =================================== */

/* ===================================
   Simplified Resize Interface Styles
   =================================== */

/* Image Preview Section */
.image-preview-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    border: 2px dashed #dee2e6;
}

.current-image-info h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.preview-display {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.image-info {
    background: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Simplified Resize Controls */
.simple-resize-controls {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.control-title {
    color: #343a40;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.quick-options, .custom-size-section, .scale-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.quick-options:last-child, .custom-size-section:last-child, .scale-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.quick-options h4, .custom-size-section h4, .scale-section h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Preset Buttons */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.preset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.preset-btn:active {
    transform: translateY(0);
}

.preset-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.preset-size {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Custom Size Inputs */
.dimension-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.dimension-input {
    position: relative;
}

.dimension-input label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 500;
    font-size: 0.9rem;
}

.dimension-input input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.dimension-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dimension-input .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Aspect Ratio Toggle */
.aspect-ratio-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
}

.aspect-ratio-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.aspect-ratio-toggle label {
    color: #495057;
    font-size: 0.95rem;
    cursor: pointer;
    margin: 0;
}

/* Percentage Controls */
.percentage-controls {
    text-align: center;
}

.percentage-controls label {
    display: block;
    margin-bottom: 15px;
    color: #495057;
    font-weight: 500;
    font-size: 1.1rem;
}

#percentageValue {
    color: #667eea;
    font-weight: 700;
}

.percentage-controls input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    outline: none;
    margin-bottom: 10px;
    appearance: none;
}

.percentage-controls input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.percentage-controls input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.percentage-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dimension-inputs {
        grid-template-columns: 1fr;
    }
    
    .simple-resize-controls {
        padding: 20px 15px;
        margin: 15px 0;
    }
}

/* Main Resize Button */
.resize-main-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    margin: 20px auto;
    display: block;
    min-width: 250px;
}

.resize-main-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}

.resize-main-btn:active:not(:disabled) {
    transform: translateY(0);
}

.resize-main-btn:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Section Styling for Resize Tool */
.form-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.form-section h3 {
    color: #343a40;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.form-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.form-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-group > label {
    display: block;
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Update percentage controls styling */
.percentage-display {
    text-align: center;
    margin-bottom: 15px;
    color: #495057;
    font-weight: 500;
    font-size: 1.1rem;
}

.percentage-display #percentageValue {
    color: #667eea;
    font-weight: 700;
}

/* Update preset buttons for form-group layout */
.form-group .preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

/* Download section styling */
.download-section {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.4);
}

.download-btn:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-status {
    display: block;
    margin-top: 8px;
    color: #6c757d;
    font-size: 0.9rem;
}

.btn-icon {
    margin-right: 5px;
}

/* Converted container styling */
.converted-container {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.converted-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

/* Ensure preview images display properly */
.preview-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block !important;
    margin: 0 auto;
}

.preview-img.hidden {
    display: none !important;
}

/* Make sure download button shows */
.download-btn.hidden {
    display: none !important;
}

.download-btn:not(.hidden) {
    display: inline-block !important;
}

/* Converted container fixes */
.converted-container {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.converted-container .preview-img {
    position: relative;
    z-index: 2;
    background: white;
    padding: 5px;
    border-radius: 8px;
}

.converted-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* ===================================
   Improved Crop Settings Styles
   =================================== */

/* Ratio Buttons */
.ratio-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.ratio-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ratio-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.ratio-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.ratio-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.ratio-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.ratio-value {
    font-size: 0.8rem;
    opacity: 0.8;
}

.reset-crop-btn {
    background: #fd7e14;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-top: 15px;
}

.reset-crop-btn:hover {
    background: #e8590c;
    transform: translateY(-1px);
}

/* Crop Inputs Grid */
.crop-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-icon {
    margin-right: 5px;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.crop-input {
    flex: 1;
    padding: 10px 40px 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.crop-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.unit {
    position: absolute;
    right: 12px;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Advanced Options */
.advanced-options {
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

.option-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.toggle-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.toggle-option:hover {
    background: #e9ecef;
}

.toggle-option input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.toggle-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.toggle-text {
    font-weight: 500;
    color: #495057;
}

/* Crop Action Button */
.crop-action-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.crop-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(40, 167, 69, 0.4);
}

.crop-action-btn:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Crop Overlay and Visual Elements */
.image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
    cursor: move;
    pointer-events: all;
    min-width: 20px;
    min-height: 20px;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
}

.resize-handle.top-left {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.top-right {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.bottom-left {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.crop-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
}

.grid-line.horizontal {
    height: 1px;
    left: 0;
    right: 0;
}

.grid-line.horizontal:nth-child(1) {
    top: 33.33%;
}

.grid-line.horizontal:nth-child(2) {
    top: 66.66%;
}

.grid-line.vertical {
    width: 1px;
    top: 0;
    bottom: 0;
}

.grid-line.vertical:nth-child(3) {
    left: 33.33%;
}

.grid-line.vertical:nth-child(4) {
    left: 66.66%;
}

/* Crop Info and Instructions */
.crop-info {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.instructions {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 8px;
    text-align: left;
    line-height: 1.5;
}

/* Cropped Result Container */
.cropped-container {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.cropped-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ratio-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .crop-inputs-grid {
        grid-template-columns: 1fr;
    }
    
    .option-toggles {
        gap: 8px;
    }
    
    .crop-action-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }
}
