/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --shadow-light: rgba(0,0,0,0.08);
    --shadow-hover: rgba(74, 144, 184, 0.15);
    --upload-bg: #f7fafc;
    --upload-border: #cbd5e0;
    --canvas-bg: #f8f9fa;
    --primary-color: #4a90b8;
    --primary-gradient: linear-gradient(135deg, #4a90b8 0%, #5ba3d4 30%, #6db6ef 60%, #7bc8ff 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --mobile-touch-size: 44px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e2e8f0;
    --border-color: #2d3748;
    --card-bg: #2d3748;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-hover: rgba(74, 144, 184, 0.3);
    --upload-bg: #2d3748;
    --upload-border: #4a5568;
    --canvas-bg: #2d3748;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
    background: var(--primary-gradient);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.9;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    opacity: 0.9;
    white-space: nowrap;
}

.header-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
    transform: translateY(-1px);
}

.theme-toggle {
    display: flex;
    align-items: center;
}

.theme-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.language-switcher select {
    padding: 0.5rem;
    border: none;
    border-radius: 5px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.9rem;
}

.language-switcher select option {
    background: #333;
    color: white;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
}

/* Tools Grid Section */
.tools-grid-section {
    margin: 3rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 3rem;
}

.tools-grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tool-box {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow-light);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
}

.tool-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px var(--shadow-hover);
    border-color: var(--primary-color);
}

.tool-icon {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem;
    text-align: center;
}

.tool-icon i {
    font-size: 3rem;
    display: block;
    opacity: 0.9;
}

.tool-info {
    padding: 1.5rem;
    text-align: center;
}

.tool-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.tool-info p {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.info-modal {
    max-width: 600px;
    padding: 2rem;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.2);
}

/* Tool Modal Content */
.tool-modal-header {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.tool-modal-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tool-modal-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.tool-modal-body {
    padding: 2rem;
}

/* Upload Area */
.tool-upload {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-area {
    border: 3px dashed var(--upload-border);
    border-radius: 12px;
    padding: 3rem 2rem;
    background: var(--upload-bg);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 184, 0.05);
}

.upload-content i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.upload-content p {
    color: var(--text-color);
    opacity: 0.7;
}

.upload-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(74, 144, 184, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(74, 144, 184, 0.4);
}

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

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 184, 0.05);
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
    justify-content: center;
}

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

.btn-sm {
    padding: 0.5rem;
    font-size: 0.8rem;
    min-height: 36px;
}

/* Image Preview */
.image-preview {
    display: none;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.image-preview.active {
    display: block;
}

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

.image-details {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.preview-canvas-container {
    text-align: center;
    margin: 1rem 0;
}

.preview-canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow-light);
    background: var(--canvas-bg);
}

/* Tool Controls */
.tool-controls {
    background: var(--upload-bg);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0 0.5rem 0;
    border: 1px solid var(--border-color);
}

.control-group {
    margin-bottom: 1rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.control-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.control-group select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
}

.range-value {
    font-weight: 600;
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.format-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.format-option {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.8rem;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text-color);
}

.format-option:hover,
.format-option.selected {
    border-color: var(--primary-color);
    background: rgba(74, 144, 184, 0.1);
    color: var(--primary-color);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.filter-option {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.8rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text-color);
}

.filter-option:hover,
.filter-option.selected {
    border-color: var(--primary-color);
    background: rgba(74, 144, 184, 0.1);
    color: var(--primary-color);
}

.crop-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.crop-ratio {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    background: var(--card-bg);
    color: var(--text-color);
}

.crop-ratio:hover,
.crop-ratio.selected {
    border-color: var(--primary-color);
    background: rgba(74, 144, 184, 0.1);
    color: var(--primary-color);
}

/* Color Picker */
.color-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--upload-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.color-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.color-info {
    flex: 1;
}

.color-info h4 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.color-formats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.color-format-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.color-format-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--upload-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    gap: 1rem;
}

.color-format-value span {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-color);
    flex: 1;
}

.copy-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    min-height: 30px;
    white-space: nowrap;
}

.color-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
}

.color-value {
    text-align: center;
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 0.8rem;
}

/* Download Section */
.download-section {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    background: var(--upload-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.download-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Usage Stats */
.usage-stats {
    text-align: center;
    margin: 3rem 0;
    padding: 2rem;
    background: var(--upload-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.usage-stats p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Banner Section Styles */
.banner-section {
    margin: 2rem 0;
    padding: 1rem;
    background: var(--body-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.banner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 728px;
}

.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
}

/* Native Banner Styles */
.native-banner {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 1.5rem 0;
}

.native-banner .banner-container {
    max-width: 100%;
}

.native-banner .ad-container {
    min-height: 150px;
    flex-direction: column;
    align-items: stretch;
}

#container-a2145519af2a30b3ba901b71659e0299,
#container-a2145519af2a30b3ba901b71659e0299-mid {
    width: 100%;
    text-align: center;
}

.banner-placeholder {
    width: 728px;
    height: 90px;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--border-color) 100%);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.banner-placeholder:hover {
    opacity: 0.9;
    border-color: var(--primary-color);
}

/* Responsive Banner */
@media (max-width: 768px) {
    .banner-placeholder {
        width: 320px;
        height: 50px;
        font-size: 0.8rem;
    }
    
    .banner-container {
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .banner-placeholder {
        width: 300px;
        height: 50px;
        font-size: 0.75rem;
    }
    
    .banner-container {
        max-width: 300px;
    }
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 3rem 0 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.footer-section p,
.footer-section li {
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
    opacity: 0.8;
}

/* Converter Page Styles */
.page-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 3rem;
}

.converter-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.converter-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.converter-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.converter-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    opacity: 0.8;
    white-space: nowrap;
}

.converter-nav a:hover {
    opacity: 1;
    background: rgba(74, 144, 184, 0.1);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.converter-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.converter-category {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px var(--shadow-light);
}

.converter-category:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px var(--shadow-hover);
    border-color: var(--primary-color);
}

.category-icon {
    text-align: center;
    margin-bottom: 1.5rem;
}

.category-icon i {
    font-size: 3rem;
    color: var(--primary-color);
}

.category-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.category-info p {
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1rem;
}

.format-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.format-tags span {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.converter-interface {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-light);
}

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

.converter-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.upload-section {
    margin-bottom: 2rem;
}

.file-list {
    margin-bottom: 2rem;
}

.file-list h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--upload-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.file-details h4 {
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.file-details p {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

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

.conversion-settings {
    margin-bottom: 2rem;
}

.conversion-settings h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.settings-content {
    background: var(--upload-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.setting-group select,
.setting-group input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
}

.conversion-progress {
    text-align: center;
    margin-bottom: 2rem;
}

.conversion-progress h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--upload-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

.conversion-results {
    text-align: center;
}

.conversion-results h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Contact Form */
#contactForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#contactForm input,
#contactForm textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
}

#contactForm textarea {
    min-height: 120px;
    resize: vertical;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
    .tools-grid-3x3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-controls {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
        width: 100%;
    }
    
    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .header-nav a {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .theme-toggle {
        order: 1;
    }
    
    .theme-btn {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .language-switcher {
        order: 2;
    }
    
    .language-switcher select {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        min-width: 120px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 95vh;
    }
    
    .tool-modal-body {
        padding: 1rem;
    }
    
    .tool-modal-header {
        padding: 1.5rem 1rem;
    }
    
    .tool-modal-header h2 {
        font-size: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-content i {
        font-size: 2.5rem;
    }
    
    .upload-content h3 {
        font-size: 1.1rem;
    }
    
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    .btn-large {
        min-height: 50px;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .converter-categories {
        grid-template-columns: 1fr;
    }
    
    .converter-category {
        padding: 1.5rem;
        text-align: center;
    }
    
    .converter-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1.5rem;
    }
    
    .converter-header-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
    
    .converter-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .converter-nav a {
        font-size: 0.85rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .upload-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .format-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .format-option {
        padding: 0.75rem;
        min-height: 44px;
        font-size: 0.9rem;
    }
    
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .filter-option {
        padding: 0.5rem;
        min-height: 40px;
        font-size: 0.8rem;
    }
    
    .crop-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .crop-ratio {
        padding: 1rem;
        min-height: 50px;
        font-size: 0.9rem;
    }
    
    .control-group input[type="range"] {
        height: 44px;
    }
    
    .control-group select {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .tool-icon {
        padding: 1.5rem;
    }
    
    .tool-icon i {
        font-size: 2.5rem;
    }
    
    .tool-info {
        padding: 1.25rem;
    }
    
    .tool-info h3 {
        font-size: 1.2rem;
    }
    
    .tool-info p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .preview-canvas {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .tools-grid-3x3 {
        gap: 1rem;
    }
    
    .tool-info {
        padding: 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    .hero-description {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .section-title {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 2rem;
    }
    
    .page-title {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 2rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.8rem;
    }
    
    .header {
        padding: 0.75rem 0;
    }
    
    .main-content {
        padding: 1.5rem 0;
    }
    
    .hero-section {
        margin-bottom: 3rem;
    }
    
    .tools-grid-section {
        margin: 2rem 0;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
        border-radius: 12px;
    }
    
    .tool-modal-header {
        padding: 1.25rem 1rem;
    }
    
    .tool-modal-header h2 {
        font-size: 1.25rem;
    }
    
    .tool-modal-header p {
        font-size: 0.9rem;
    }
    
    .close-btn {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 15px;
        font-size: 24px;
    }
    
    .upload-area {
        padding: 1.5rem 0.75rem;
        margin-bottom: 1rem;
    }
    
    .upload-content i {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .upload-content h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .upload-content p {
        font-size: 0.85rem;
    }
    
    .btn {
        min-height: 48px;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
        border-radius: 10px;
    }
    
    .btn-large {
        min-height: 54px;
        padding: 1.125rem 1.25rem;
        font-size: 1.05rem;
    }
    
    .format-selector,
    .filter-grid,
    .crop-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .format-option,
    .filter-option,
    .crop-ratio {
        padding: 0.75rem;
        min-height: 42px;
        font-size: 0.85rem;
    }
    
    .control-group label {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .control-group input[type="range"] {
        height: 48px;
        margin: 0.75rem 0;
    }
    
    .control-group select {
        min-height: 48px;
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .color-result {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .color-preview {
        width: 60px;
        height: 60px;
        align-self: center;
    }
    
    .color-values {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .converter-category {
        padding: 1.25rem;
    }
    
    .converter-nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .converter-nav a {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .category-icon i {
        font-size: 2.5rem;
    }
    
    .category-info h3 {
        font-size: 1.25rem;
    }
    
    .format-tags {
        justify-content: center;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .file-info {
        width: 100%;
    }
    
    .file-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .file-actions .btn {
        flex: 1;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .usage-stats {
        margin: 2rem 0;
        padding: 1.5rem;
    }
    
    .preview-canvas {
        max-height: 250px;
    }
    
    #contactForm input,
    #contactForm textarea {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.875rem;
    }
    
    #contactForm textarea {
        min-height: 120px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.5rem;
    }
    
    .section-title,
    .page-title {
        font-size: 1.5rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .tool-box {
        border-radius: 12px;
    }
    
    .modal-content {
        border-radius: 8px;
    }
}

/* Touch-friendly improvements for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .tool-box:hover {
        transform: none;
        box-shadow: 0 8px 32px var(--shadow-light);
    }
    
    .tool-box:active {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px var(--shadow-hover);
    }
    
    .converter-category:hover {
        transform: none;
        box-shadow: 0 8px 32px var(--shadow-light);
    }
    
    .converter-category:active {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px var(--shadow-hover);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: translateY(-1px);
    }
    
    .format-option:hover,
    .filter-option:hover,
    .crop-ratio:hover {
        transform: none;
    }
    
    .format-option:active,
    .filter-option:active,
    .crop-ratio:active {
        transform: scale(0.98);
    }
}

/* Improve readability on small screens */
@media screen and (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* Ensure proper zoom behavior on iOS Safari */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Add better scroll behavior for mobile */
@media screen and (max-width: 768px) {
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .tool-modal-body {
        -webkit-overflow-scrolling: touch;
    }
}


/* Contact Info Styles */
.contact-info {
    margin-bottom: 2rem;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--tool-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.contact-item i {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.contact-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

.contact-info h3 {
    margin: 2rem 0 0.5rem 0;
    color: var(--text-color);
}
