* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 100%);
    min-height: 100vh;
    padding: 20px;
    color: #0c4a6e;
}

.boxed-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #0369a1 0%, #0c4a6e 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 2.5em;
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
}

header h1 img {
    height: 60px;
    width: auto;
    margin-right: 15px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

/* Language Selector */
.language-selector {
    position: relative;
}

.language-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.language-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.language-dropdown.active {
    display: block;
}

.language-dropdown a {
    display: block;
    padding: 12px 20px;
    color: #0c4a6e;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.language-dropdown a:last-child {
    border-bottom: none;
}

.language-dropdown a:hover {
    background: #f0f9ff;
    color: #0284c7;
}

/* Main Content */
main {
    padding: 40px;
}

/* Upload Area */
.upload-section {
    margin-bottom: 30px;
}

#upload-area {
    border: 3px dashed #0284c7;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f0f9ff;
}

#upload-area:hover {
    border-color: #0ea5e9;
    background: #e0f2fe;
    transform: scale(1.02);
}

#upload-area.dragover {
    border-color: #0284c7;
    background: #bae6fd;
    transform: scale(1.05);
}

.upload-box h3 {
    color: #0284c7;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.upload-box p {
    color: #475569;
    margin-bottom: 15px;
}

#file-input {
    display: none;
}

.choose-files-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: transform 0.2s;
}

.choose-files-btn:hover {
    transform: scale(1.05);
}

.file-size-info, .terms-info {
    margin-top: 15px;
    font-size: 0.85em;
    color: #475569;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    color: white;
}

.action-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.action-btn.secondary {
    background: white;
    border: 2px solid #0284c7;
    color: #0284c7;
}

.action-btn.secondary:hover:not(:disabled) {
    background: #e0f2fe;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Settings Panel */
.settings-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    height: fit-content;
}

.settings-panel h3 {
    color: #0284c7;
    margin-bottom: 20px;
    font-size: 1.2em;
    border-bottom: 2px solid #0284c7;
    padding-bottom: 10px;
}

.tool-group {
    margin-bottom: 22px;
}

.tool-label {
    display: block;
    font-weight: 600;
    color: #0c4a6e;
    margin-bottom: 8px;
    font-size: 0.95em;
}

/* Format Buttons */
.format-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.format-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9em;
}

.format-btn.active {
    background: #0284c7;
    color: white;
    border-color: #0284c7;
}

.format-btn:hover {
    border-color: #0284c7;
    color: #0284c7;
}

.format-btn.active:hover {
    background: #0369a1;
    color: white;
    border-color: #0369a1;
}

/* Quality Slider */
.quality-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#qualitySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0284c7;
    cursor: pointer;
    transition: all 0.2s;
}

#qualitySlider::-webkit-slider-thumb:hover {
    background: #0ea5e9;
    transform: scale(1.2);
}

#qualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0284c7;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

#qualitySlider::-moz-range-thumb:hover {
    background: #0ea5e9;
    transform: scale(1.2);
}

.quality-value {
    min-width: 40px;
    text-align: center;
    font-weight: 700;
    color: #0284c7;
    font-size: 0.95em;
}

/* Select Dropdown */
select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    background: white;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: #0284c7;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #0284c7;
}

.checkbox-group label {
    cursor: pointer;
    font-weight: 500;
}

/* Preview/Results Panel */
.preview-results {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #94a3b8;
    text-align: center;
    order: 1;
}

/* When files are loaded */
.preview-results.has-files {
    flex-direction: column;
}

.preview-results.has-files .preview-placeholder {
    height: auto;
    min-height: 250px;
    justify-content: flex-start;
    padding-top: 20px;
    order: 2;
}

.preview-results.has-files #image-container {
    order: 1;
}

.preview-placeholder p {
    font-size: 3em;
    margin-bottom: 15px;
}

#image-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#image-container.active {
    display: flex;
}

/* File Cards */
.file-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.file-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-column h5 {
    color: #0284c7;
    font-size: 0.95em;
    margin: 0;
    border-bottom: 2px solid #0284c7;
    padding-bottom: 6px;
}

.file-thumbnail {
    width: 100%;
    height: 150px;
    background: #eee;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2.5em;
    overflow: hidden;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85em;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    color: #475569;
}

.detail-row span:last-child {
    font-weight: 600;
    color: #0284c7;
}

.compression-badge {
    margin-top: 8px;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 6px;
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.85em;
    text-align: center;
}

.download-link {
    display: inline-block;
    background: #4caf50;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s;
}

.download-link:hover {
    background: #2e7d32;
    transform: translateY(-2px);
}

/* Progress Animations */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #0ea5e9);
    border-radius: 2px;
    animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 100%; }
}

.converting-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #0284c7;
    font-size: 0.85em;
    font-weight: 600;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0284c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Progress Overlay */
#loading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: #fff;
    text-align: center;
}

.progress-container {
    width: 80%;
    max-width: 400px;
    background-color: #ddd;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

#progress-bar {
    height: 20px;
    background-color: #0284c7;
    border-radius: 20px;
    transition: width 0.3s ease;
}

#progress-percentage {
    font-size: 18px;
}

/* Content Sections */
.step-by-step,
.features,
.faq,
.new-features,
.formats {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 30px;
}

.step-by-step h2,
.features h2,
.faq h2,
.new-features h2,
.formats h2 {
    color: #0284c7;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.new-features p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #475569;
}

.new-features ul {
    list-style: none;
    padding: 0;
}

.new-features ul li {
    margin-bottom: 12px;
    line-height: 1.6;
    padding-left: 20px;
    position: relative;
}

.new-features ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #0284c7;
    font-weight: 700;
}

/* Formats Grid */
.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.format-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.format-card:hover {
    border-color: #0284c7;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.format-card h3 {
    color: #0284c7;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.format-card p {
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.step-by-step ol {
    padding-left: 25px;
}

.step-by-step ol li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.features ul {
    list-style: none;
    padding: 0;
}

.features ul li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.faq dl {
    margin: 0;
}

.faq dt {
    font-weight: 600;
    color: #0c4a6e;
    margin-top: 15px;
    margin-bottom: 8px;
}

.faq dd {
    margin-left: 0;
    margin-bottom: 15px;
    color: #475569;
    line-height: 1.6;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #475569;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
    margin-top: auto;
}

footer nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    justify-content: center;
    gap: 15px;
}

footer nav a {
    text-decoration: none;
    color: #0284c7;
}

footer nav a:hover {
    color: #0ea5e9;
}

/* Language Modal */
.language-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0);
}

.language-modal-content {
    background-color: #fff;
    margin: 0 auto;
    padding: 10px 20px;
    border-radius: 0;
    width: 100%;
    max-width: none;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-modal-message {
    font-size: 16px;
    display: inline-block;
    margin-right: 10px;
}

.language-modal-buttons {
    display: flex;
    align-items: center;
}

.switch-language-button,
.close-language-modal {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    margin-left: 5px;
}

.switch-language-button {
    background-color: #0284c7;
    color: #fff;
}

.switch-language-button:hover {
    background-color: #0ea5e9;
}

.close-language-modal {
    background-color: #6c757d;
    color: #fff;
}

.close-language-modal:hover {
    background-color: #5a6268;
}

/* PWA Install Modal */
.pwa-install-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.pwa-install-modal-content {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pwa-install-modal-content p {
    font-size: 18px;
    margin-bottom: 20px;
    color: #0c4a6e;
}

.pwa-install-button,
.pwa-close-modal {
    padding: 10px 20px;
    font-size: 16px;
    margin: 0 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.pwa-install-button {
    background-color: #0284c7;
    color: #fff;
}

.pwa-install-button:hover {
    background-color: #0ea5e9;
}

.pwa-close-modal {
    background-color: #ccc;
    color: #0c4a6e;
}

.pwa-close-modal:hover {
    background-color: #94a3b8;
}

/* Responsive Design */
@media screen and (max-width: 900px) {
    .file-card {
        gap: 10px;
        padding: 12px;
    }

    .file-thumbnail {
        height: 120px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 10px;
        overflow-x: hidden;
    }

    .boxed-container {
        border-radius: 8px;
        overflow-x: hidden;
    }

    main {
        overflow-x: hidden;
    }

    header h1 {
        font-size: 1.8em;
    }

    header h1 img {
        height: 45px;
        margin-right: 10px;
    }

    main {
        padding: 20px;
    }

    #upload-area {
        padding: 40px 20px;
    }

    .action-buttons {
        grid-template-columns: 1fr 1fr;
    }
}

@media screen and (max-width: 640px) {
    .file-card {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    header h1 {
        font-size: 1.2em;
    }

    header h1 img {
        height: 35px;
        margin-right: 8px;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .format-buttons {
        flex-direction: column;
    }

    .format-btn {
        width: 100%;
    }
}

/* Ad Container Styles */
.horizontal-ad-container {
    margin: 20px auto;
    max-width: 728px;
    text-align: center;
    overflow: hidden;
}

/* Desktop ad - visible by default */
.desktop-ad {
    display: block;
}

/* Mobile ad - hidden by default */
.mobile-ad {
    display: none;
}

.placeholder-ad-container {
    width: 100%;
    min-width: 300px;
    max-width: 800px;
    min-height: 250px;
    margin: 0 auto;
}

/* Mobile Ad Responsiveness */
@media screen and (max-width: 768px) {
    /* Hide desktop ad, show mobile ad */
    .desktop-ad {
        display: none !important;
    }

    .mobile-ad {
        display: block !important;
    }

    .horizontal-ad-container {
        max-width: 100%;
        margin: 10px auto;
        padding: 0;
    }

    .placeholder-ad-container {
        max-width: 100%;
        min-width: 250px;
        padding: 0;
        margin: 0 auto;
    }

    .settings-panel {
        overflow-x: hidden;
        padding: 15px;
    }

    .preview-results {
        overflow-x: hidden;
        padding: 10px;
    }
}

@media screen and (max-width: 480px) {
    .horizontal-ad-container {
        padding: 0 5px;
    }

    .placeholder-ad-container {
        min-width: 200px;
        min-height: 200px;
    }
}
