* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #2ecc71;
    --danger: #ff4757;
    --warning: #f39c12;
    --dark: #2d3436;
    --gray: #636e72;
    --light-gray: #b2bec3;
    --lighter-gray: #dfe6e9;
    --white: #ffffff;
    --bg-light: #f8f9ff;
    --sidebar-width: 260px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    color: var(--dark);
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header-content {
    flex: 1;
}

.sidebar-header h2 {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-header .subtitle {
    font-size: 0.85em;
    opacity: 0.9;
}

.sidebar-close {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
    color: var(--white);
}

@media (max-width: 900px) {
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.nav-list {
    list-style: none;
    padding: 15px 0;
}

.nav-section {
    padding: 15px 20px 8px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--light-gray);
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.nav-item.active a {
    background: var(--bg-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--white);
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1em;
}

/* Converter Card */
.converter-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
    padding: 60px 30px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-light);
    cursor: pointer;
}

.drop-zone.dragover {
    background: #e8ebff;
    border-color: var(--primary-dark);
    transform: scale(1.02);
}

.upload-icon {
    width: 70px;
    height: 70px;
    color: var(--primary);
    margin-bottom: 20px;
}

.drop-text {
    font-size: 1.4em;
    color: var(--dark);
    margin-bottom: 10px;
    font-weight: 600;
}

.drop-subtext {
    color: var(--gray);
    margin: 10px 0;
}

.file-label {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 10px 0;
}

.file-label:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.supported-formats {
    color: var(--gray);
    font-size: 0.9em;
    margin-top: 15px;
}

/* File Info Section */
.file-info-section {
    margin-top: 30px;
}

.detected-file {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
}

.file-icon-large {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 0.9em;
}

.file-details {
    flex: 1;
}

.file-details h3 {
    font-size: 1.1em;
    color: var(--dark);
    margin-bottom: 4px;
    word-break: break-all;
}

.file-details p {
    color: var(--gray);
    font-size: 0.9em;
}

.btn-remove {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.2s;
    border-radius: 50%;
}

.btn-remove:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

.btn-remove svg {
    width: 20px;
    height: 20px;
}

/* Conversion Options */
.conversion-options h4 {
    font-size: 1em;
    color: var(--dark);
    margin-bottom: 15px;
}

.output-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.output-option {
    padding: 10px 20px;
    background: var(--lighter-gray);
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--gray);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.output-option:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
}

.output-option.selected {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Conversion Settings */
.conversion-settings {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 25px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.setting-group input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.setting-group input[type="number"],
.setting-group select {
    padding: 10px 15px;
    border: 2px solid var(--lighter-gray);
    border-radius: var(--radius-sm);
    font-size: 1em;
    width: 100%;
    transition: border-color 0.2s;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: var(--radius-sm);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
}

.btn-large {
    width: 100%;
    justify-content: center;
    padding: 18px;
}

.btn-secondary {
    background: var(--lighter-gray);
    color: var(--gray);
    border: none;
    padding: 15px 30px;
    border-radius: var(--radius-sm);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border: none;
    padding: 15px 25px;
    border-radius: var(--radius-sm);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.btn-success svg {
    width: 18px;
    height: 18px;
}

/* Progress Section */
.progress-section {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--lighter-gray);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.9em;
}

.progress-text {
    text-align: center;
    color: var(--gray);
    font-weight: 500;
}

/* Result Section */
.result-section {
    margin-top: 30px;
    text-align: center;
}

.success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.success-icon {
    width: 60px;
    height: 60px;
    color: var(--success);
    margin-bottom: 15px;
}

.success-message p {
    font-size: 1.3em;
    color: var(--dark);
    font-weight: 600;
}

.download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Quick Links */
.quick-links {
    margin-top: 40px;
    max-width: 800px;
}

.quick-links h3 {
    color: var(--white);
    font-size: 1.2em;
    margin-bottom: 20px;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    background: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.quick-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.quick-link .from,
.quick-link .to {
    font-weight: 700;
    font-size: 0.9em;
}

.quick-link .from {
    color: var(--primary);
}

.quick-link .to {
    color: var(--primary-dark);
}

.quick-link svg {
    width: 16px;
    height: 16px;
    color: var(--gray);
}

/* Category Page Styles */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.conversion-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.conversion-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.conversion-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
    margin-bottom: 10px;
}

.conversion-card .badge {
    background: var(--primary);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
}

.conversion-card .badge-alt {
    background: var(--primary-dark);
}

.conversion-card p {
    color: var(--gray);
    font-size: 0.9em;
}

/* File List */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: #e8ebff;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: bold;
    font-size: 0.75em;
}

.file-name {
    color: var(--dark);
    font-weight: 500;
}

/* Grouped Files (Smart Convert) */
.grouped-files {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.file-type-group {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    gap: 12px;
    flex-wrap: wrap;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95em;
}

.group-title svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.group-count {
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: normal;
}

.group-convert-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.group-convert-all span {
    opacity: 0.9;
}

.group-format-select {
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    color: var(--dark);
}

.group-format-select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

.group-files {
    padding: 10px;
    background: var(--bg-light);
}

.grouped-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--white);
    border-radius: 6px;
    margin-bottom: 6px;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.grouped-file-item:last-child {
    margin-bottom: 0;
}

.grouped-file-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.file-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-ext-badge {
    background: var(--primary);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.file-name-small {
    font-size: 0.9em;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size-small {
    font-size: 0.8em;
    color: var(--gray);
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-convert-select {
    padding: 6px 10px;
    border: 1px solid var(--lighter-gray);
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    background: var(--white);
    min-width: 70px;
    color: var(--dark);
}

.file-convert-select:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-remove-small {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--gray);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-small:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

/* Responsive grouped files */
@media (max-width: 600px) {
    .group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .grouped-file-item {
        flex-wrap: wrap;
        padding: 12px;
    }

    .file-info-left {
        width: 100%;
        margin-bottom: 8px;
    }

    .file-size-small {
        display: none;
    }

    .file-actions {
        width: 100%;
        justify-content: space-between;
    }

    .file-convert-select {
        flex: 1;
    }
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 150;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    box-shadow: var(--shadow);
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

.mobile-title {
    color: var(--white);
    font-size: 1.3em;
    font-weight: 700;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 80px 20px 20px;
    }

    .converter-card {
        padding: 25px;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .download-buttons {
        flex-direction: column;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.8em;
    }
}

@media (max-width: 600px) {
    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .output-options {
        justify-content: center;
    }

    .quick-link {
        padding: 12px 10px;
        font-size: 0.85em;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .conversion-preview {
        gap: 10px;
        padding: 15px;
    }

    .preview-badge {
        padding: 10px 15px;
        font-size: 1em;
    }
}

/* Conversion Preview (Direct Conversion Pages) */
.conversion-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 25px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
}

.preview-badge {
    padding: 15px 30px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1.2em;
}

.preview-badge.from {
    background: var(--primary);
    color: var(--white);
}

.preview-badge.to {
    background: var(--primary-dark);
    color: var(--white);
}

.conversion-preview svg {
    color: var(--gray);
}

/* Links styled as buttons */
a.btn-success {
    text-decoration: none;
}

a.btn-primary {
    text-decoration: none;
}

/* Empty settings state */
.conversion-settings:empty {
    display: none;
}

/* Multi-file support styles */
.file-section {
    margin-top: 20px;
}

.file-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.file-section-header h3 {
    color: var(--dark);
    font-size: 1.1em;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.btn-text-danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

.file-details-inline {
    display: flex;
    flex-direction: column;
}

.file-details-inline .file-size {
    color: var(--gray);
    font-size: 0.85em;
}

.mixed-type-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    color: #856404;
    font-size: 0.9em;
}

.mixed-type-warning svg {
    color: #856404;
    flex-shrink: 0;
}

.no-conversions {
    color: var(--gray);
    text-align: center;
    padding: 20px;
}

.error-text {
    color: var(--danger);
    text-align: center;
    padding: 20px;
}

/* Download buttons layout */
.main-download-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.btn-download-all {
    flex: 1;
    justify-content: center;
    padding: 15px;
    background: #3498db;
}

.btn-download-all:hover {
    background: #2980b9;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-zip {
    flex: 1;
    justify-content: center;
    font-size: 1em;
    padding: 15px;
}

@media (max-width: 600px) {
    .main-download-buttons {
        flex-direction: column;
    }
}

.individual-downloads {
    margin-top: 20px;
    width: 100%;
}

.downloads-label {
    color: var(--gray);
    font-size: 0.9em;
    margin-bottom: 10px;
    text-align: center;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.btn-download-small {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--bg-light);
    border: 2px solid var(--lighter-gray);
    border-radius: var(--radius-sm);
    color: var(--dark);
    text-decoration: none;
    font-size: 0.85em;
    transition: all 0.2s;
    overflow: hidden;
}

.btn-download-small:hover {
    border-color: var(--primary);
    background: #f0f3ff;
}

.btn-download-small svg {
    color: var(--primary);
    flex-shrink: 0;
}

.btn-download-small span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversion-errors {
    margin-top: 20px;
    padding: 15px;
    background: #fff5f5;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.conversion-errors p {
    color: var(--danger);
    margin-bottom: 10px;
}

.conversion-errors ul {
    margin: 0;
    padding-left: 20px;
    color: var(--dark);
}

.conversion-errors li {
    margin-bottom: 5px;
}

/* File list scrollable on many files */
.file-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Add more files zone */
.add-more-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    margin-top: 15px;
    border: 2px dashed var(--lighter-gray);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--gray);
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.add-more-zone:hover {
    border-color: var(--primary);
    background: #f0f3ff;
}

.add-more-zone.dragover {
    border-color: var(--primary);
    background: #e8ebff;
    transform: scale(1.01);
}

.add-more-zone svg {
    color: var(--primary);
}

.add-more-btn {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.add-more-btn:hover {
    color: var(--primary-dark);
}

@media (max-width: 600px) {
    .files-grid {
        grid-template-columns: 1fr;
    }

    .file-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ===== TOOL PAGES - CONSISTENT IMAGE HANDLING ===== */

/* Tool container - constrains overall width */
.tool-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Editor sections - white card background */
.editor-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

/* Standard two-column layout for tools */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* Preview area - CONSTRAINED height */
.preview-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-wrapper {
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #f5f5f5 0% 50%) 50% / 16px 16px;
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 350px;
    overflow: hidden;
}

/* Images inside preview - STRICTLY constrained */
.preview-wrapper img,
.preview-wrapper canvas {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Controls panel - scrollable if needed */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding-right: 8px;
}

/* Control groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
}

/* Action buttons at bottom of controls */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--lighter-gray);
}

.action-buttons button {
    flex: 1;
}

/* File navigation */
.file-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

/* Icon buttons */
.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive tool layouts */
@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .preview-wrapper {
        max-height: 250px;
    }

    .preview-wrapper img,
    .preview-wrapper canvas {
        max-height: 220px;
    }

    .controls-panel {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 600px) {
    .editor-section {
        padding: 16px;
    }

    .preview-wrapper {
        min-height: 150px;
        max-height: 200px;
        padding: 12px;
    }

    .preview-wrapper img,
    .preview-wrapper canvas {
        max-height: 170px;
    }
}

/* ===== IMAGE EDITOR SPECIFIC ===== */
.editor-app {
    max-width: 1400px;
    margin: 0 auto;
}

.editor-main {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--lighter-gray);
    flex-wrap: wrap;
    gap: 10px;
}

.tool-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tool-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--gray);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tool-tab:hover {
    background: var(--white);
    color: var(--dark);
}

.tool-tab.active {
    background: var(--primary);
    color: var(--white);
}

.tool-tab svg {
    width: 16px;
    height: 16px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.editor-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    min-height: 400px;
    max-height: calc(100vh - 200px);
}

.canvas-area {
    display: flex;
    flex-direction: column;
    background: #2a2a2a;
    position: relative;
    overflow: hidden;
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: repeating-conic-gradient(#3a3a3a 0% 25%, #2a2a2a 0% 50%) 50% / 16px 16px;
    position: relative;
    max-height: 400px;
}

#mainCanvas {
    max-width: 100%;
    max-height: 350px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.zoom-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #222;
    border-top: 1px solid #333;
}

.zoom-bar input[type="range"] {
    flex: 1;
    max-width: 150px;
    accent-color: var(--primary);
}

#zoomLevel {
    min-width: 45px;
    color: #aaa;
    font-size: 0.8rem;
    text-align: center;
}

.tool-panels {
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
    border-left: 1px solid var(--lighter-gray);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.tool-panel {
    display: none;
    padding: 16px;
}

.tool-panel.active {
    display: block;
}

.tool-panel h3 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    color: var(--dark);
}

.panel-section {
    margin-bottom: 14px;
}

.panel-section label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 6px;
}

.panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.panel-actions button {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
}

.output-section {
    padding: 16px;
    margin-top: auto;
    border-top: 1px solid var(--lighter-gray);
    background: var(--white);
}

.output-section h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
}

.output-section select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--lighter-gray);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.image-info {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 10px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.btn-download {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-text {
    width: 100%;
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 10px;
    margin-top: 8px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--primary);
}

/* Crop overlay */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px dashed #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: all;
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: 2px;
}

.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }

/* Ratio buttons */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.ratio-btn {
    padding: 6px 4px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.ratio-btn:hover {
    border-color: var(--primary);
}

.ratio-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.custom-ratio {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    align-items: center;
}

.custom-ratio input {
    width: 45px;
    padding: 4px;
    border: 1px solid var(--lighter-gray);
    border-radius: 4px;
    text-align: center;
    font-size: 0.8rem;
}

/* Dimension grid */
.dim-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.dim-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dim-field span {
    font-size: 0.65rem;
    color: var(--light-gray);
    text-transform: uppercase;
}

.dim-field input {
    padding: 5px 4px;
    border: 1px solid var(--lighter-gray);
    border-radius: 4px;
    text-align: center;
    font-size: 0.8rem;
    width: 100%;
}

/* Resize inputs */
.resize-inputs {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.resize-inputs .dim-field {
    flex: 1;
}

.btn-link {
    width: 32px;
    height: 32px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.btn-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Preset buttons */
.preset-btns {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.preset-btn {
    padding: 3px 6px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
}

.preset-btn:hover {
    border-color: var(--primary);
}

/* Rotate/flip buttons */
.rotate-btns, .flip-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

/* Background color options */
.bg-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.bg-btn, .canvas-bg-btn {
    padding: 5px 8px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.bg-btn.active, .canvas-bg-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Canvas padding grid */
.canvas-padding {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
    text-align: center;
}

.canvas-padding input {
    padding: 5px;
    border: 1px solid var(--lighter-gray);
    border-radius: 4px;
    text-align: center;
    font-size: 0.8rem;
    width: 100%;
}

.pad-center {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lighter-gray);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--gray);
}

.uniform-pad {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.uniform-pad label {
    margin: 0;
    font-size: 0.8rem;
}

.uniform-pad input {
    width: 50px;
}

/* Editor responsive */
@media (max-width: 1000px) {
    .editor-body {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .canvas-wrapper {
        max-height: 300px;
    }

    #mainCanvas {
        max-height: 260px;
    }

    .tool-panels {
        max-height: 400px;
        border-left: none;
        border-top: 1px solid var(--lighter-gray);
    }
}

@media (max-width: 600px) {
    .editor-toolbar {
        padding: 8px 12px;
    }

    .tool-tab {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .tool-tab span {
        display: none;
    }

    .canvas-wrapper {
        max-height: 220px;
        padding: 10px;
    }

    #mainCanvas {
        max-height: 190px;
    }

    .tool-panel {
        padding: 12px;
    }

    .ratio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dim-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== COMPRESS TOOL ===== */
.compress-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.preview-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-side h4 {
    margin: 0;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

.preview-side .preview-box {
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #f5f5f5 0% 50%) 50% / 16px 16px;
    border-radius: var(--radius-sm);
    min-height: 150px;
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.preview-side .preview-box img {
    max-width: 100%;
    max-height: 170px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.size-info {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px;
    background: var(--bg-light);
    border-radius: 4px;
}

.size-info.compressed {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.savings {
    color: #22c55e;
    font-weight: 600;
}

/* Format and quality buttons */
.format-buttons {
    display: flex;
    gap: 8px;
}

.format-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.format-btn:hover {
    border-color: var(--primary);
}

.format-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.quality-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.batch-info {
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.batch-info h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
}

.batch-info p {
    margin: 4px 0;
    color: var(--gray);
    font-size: 0.9rem;
}

.batch-info span {
    color: var(--dark);
    font-weight: 500;
}

@media (max-width: 700px) {
    .preview-comparison {
        grid-template-columns: 1fr;
    }

    .preview-side .preview-box {
        min-height: 120px;
        max-height: 150px;
    }

    .preview-side .preview-box img {
        max-height: 130px;
    }
}

/* ===== MERGE TOOL ===== */
.merge-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.layout-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
}

.layout-btn:hover {
    border-color: var(--primary);
}

.layout-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.layout-btn svg {
    flex-shrink: 0;
}

.image-list {
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-light);
    border-radius: 4px;
}

.image-item img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
}

.image-item span {
    flex: 1;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-item .move-btns {
    display: flex;
    gap: 2px;
}

.image-item button {
    padding: 3px 6px;
    border: none;
    background: var(--white);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
}

.image-item button:hover {
    background: var(--primary);
    color: var(--white);
}

.add-more-label {
    padding: 10px;
    border: 1px dashed var(--lighter-gray);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    color: var(--gray);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.add-more-label:hover {
    border-color: var(--primary);
    color: var(--primary);
}

@media (max-width: 900px) {
    .merge-layout {
        grid-template-columns: 1fr;
    }
}

/* ===== METADATA TOOL ===== */
.metadata-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.info-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.basic-info, .exif-info {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.basic-info h3, .exif-info h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exif-status {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: normal;
}

.exif-status.found {
    background: #fef3c7;
    color: #92400e;
}

.exif-status.clean {
    background: #d1fae5;
    color: #065f46;
}

.basic-info table {
    width: 100%;
    font-size: 0.85rem;
}

.basic-info td {
    padding: 4px 0;
}

.basic-info td:first-child {
    color: var(--gray);
    width: 80px;
}

.basic-info td:last-child {
    font-weight: 500;
    word-break: break-all;
}

.exif-data {
    max-height: 180px;
    overflow-y: auto;
}

.exif-data table {
    width: 100%;
    font-size: 0.8rem;
}

.exif-data td {
    padding: 3px 0;
    vertical-align: top;
}

.exif-data td:first-child {
    color: var(--gray);
    width: 100px;
}

.exif-data td:last-child {
    word-break: break-all;
}

.no-exif {
    color: var(--light-gray);
    font-style: italic;
    margin: 0;
    font-size: 0.85rem;
}

.privacy-warning {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #991b1b;
    font-size: 0.85rem;
}

.privacy-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.privacy-warning strong {
    display: block;
    margin-bottom: 3px;
}

.privacy-warning p {
    margin: 0;
}

@media (max-width: 900px) {
    .metadata-layout {
        grid-template-columns: 1fr;
    }

    .exif-data {
        max-height: 150px;
    }
}

/* ===== WATERMARK TOOL ===== */
.watermark-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.type-buttons {
    display: flex;
    gap: 8px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.type-btn:hover {
    border-color: var(--primary);
}

.type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-row input[type="color"] {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid var(--lighter-gray);
    cursor: pointer;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.pos-btn {
    padding: 10px;
    border: 1px solid var(--lighter-gray);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.pos-btn:hover {
    border-color: var(--primary);
}

.pos-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.file-label.small {
    padding: 10px;
    border: 1px dashed var(--lighter-gray);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    display: block;
}

.file-label.small:hover {
    border-color: var(--primary);
}

@media (max-width: 900px) {
    .watermark-layout {
        grid-template-columns: 1fr;
    }
}
