:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f3f4f6;
    --text: #111827;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg-light: #f9fafb;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --page-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: #f8fafc;
}

.containert {
    max-width: 85%;
    margin: 2rem auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--page-shadow);
    overflow: hidden;
}

.header-t {
    padding: 28px 32px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    background: white;
    position: relative;
}

.header-t h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.3;
}

.header-t p {
    font-size: 1.05rem;
    max-width: 700px;
    margin: 0 auto;
    color: var(--text);
    line-height: 1.6;
}

.version-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(79, 70, 229, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--primary);
}

.main-content {
    padding: 32px;
}

.upload-section {
    text-align: center;
    padding: 48px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background-color: var(--bg-light);
    transition: var(--transition);
    margin-bottom: 32px;
    position: relative;
}

.upload-section.active {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    font-size: 56px;
    color: var(--primary);
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 12px;
    font-weight: 500;
}

.upload-hint {
    font-size: .95rem;
    color: var(--text-light);
    margin-bottom: 24px;
    text-align: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--primary);
    color: white;
    border: 0;
    font-size: 1rem;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-upload:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#avif-upload {
    display: none;
}

.images-container {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.image-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.image-header {
    padding: 14px 18px;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-action-btn {
    background: 0;
    border: 0;
    color: white;
    cursor: pointer;
    opacity: .8;
    transition: var(--transition);
    font-size: 14px;
}

.image-action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.image-number {
    background-color: white;
    color: var(--primary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
}

.image-content {
    padding: 20px;
    background-color: var(--bg-light);
}

.image-preview-container {
    position: relative;
    margin-bottom: 18px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: white;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pdf-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-label {
    font-size: .85rem;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.option-label .info-icon {
    color: var(--text-light);
    cursor: help;
}

.option-input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    width: 100%;
    transition: var(--transition);
}

.option-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    width: 100%;
    background-color: white;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.option-input:focus,
.option-select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.action-buttons {
    display: none;
    justify-content: center;
    gap: 20px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 0;
    font-size: 1rem;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #0d9f6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-info {
    background-color: var(--info);
    color: white;
}

.btn-info:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.global-actions {
    display: none;
    justify-content: space-between;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.global-options {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.apply-all-btn {
    background-color: var(--success);
    color: white;
    border: 0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.apply-all-btn:hover {
    background-color: #0d9f6e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.global-settings {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.global-setting-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

.file-info {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--secondary);
    border-radius: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
}

.file-info-item i {
    color: var(--primary);
}

@media (max-width: 1024px) {
    .containert {
        max-width: 95%;
        margin: 30px auto;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 24px;
    }
    
    .upload-section {
        padding: 32px 24px;
    }
    
    .images-container {
        grid-template-columns: 1fr;
    }
    
    .pdf-options {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 16px;
    }
    
    .btn {
        width: 100%;
    }
    
    .global-actions {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .global-settings {
        width: 100%;
    }
    
    .global-setting-group {
        width: 100%;
    }
}

.loading {
    display: none;
    margin: 24px 0;
    text-align: center;
    color: var(--primary);
}

.loading-content {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    animation: spin 1s linear infinite;
    font-size: 2.5rem;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress {
    height: 100%;
    background-color: var(--primary);
    width: 0;
    transition: width .3s ease;
}

.error-message {
    display: none;
    padding: 16px;
    background-color: #fee2e2;
    color: var(--error);
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.success-message {
    display: none;
    padding: 16px;
    background-color: #d1fae5;
    color: var(--success);
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity .3s;
    font-size: .85rem;
    font-weight: normal;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

@keyframes spin {
    0% {
        transform: rotate(0)
    }

    100% {
        transform: rotate(360deg)
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    background-color: var(--primary);
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all .3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background-color: var(--success);
}

.toast.error {
    background-color: var(--error);
}

.toast i {
    font-size: 1.2rem;
}

/* ===== FIXED: CONTENT SECTION - NO TEXT BREAKING ===== */
.content-wrapper {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    line-height: 1.7;
}

.content-wrapper h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 40px;
    margin-bottom: 20px;
    text-align: left;
}

.content-wrapper h3 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 30px;
    margin-bottom: 15px;
}

/* FIX: This is the key fix - text won't break mid-sentence */
.content-wrapper p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.7;
    text-align: left;
    max-width: 100%;
    white-space: normal;
    word-wrap: normal;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: manual;
}

.content-wrapper ul {
    margin: 15px 0 25px 25px;
    list-style-position: outside;
}

.content-wrapper li {
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.6;
    padding-left: 5px;
}

.content-wrapper a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all .2s ease;
}

.content-wrapper a:hover {
    text-decoration: underline;
    color: #2e59d9;
}

.feature-icon {
    color: var(--primary);
    margin-right: 10px;
    width: 20px;
    text-align: center;
    display: inline-block;
}

/* Force all content wrapper elements to have proper text flow */
.content-wrapper * {
    max-width: 100%;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: normal;
}

/* How-to Section */
.how-to-section-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.how-to-section-wrapper h2 {
    text-align: center;
    font-size: 2.2rem;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 40px;
    font-weight: 700;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.step-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: left;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.step-card .step-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    background-color: var(--primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.step-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text);
    line-height: 1.4;
    font-weight: 600;
}

.step-card p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
}

/* Media Queries for Content Section */
@media (max-width: 1200px) {
    .content-wrapper,
    .how-to-section-wrapper {
        padding: 0 30px;
    }
}

@media (max-width: 992px) {
    .content-wrapper h2 {
        font-size: 1.9rem;
    }
    
    .content-wrapper h3 {
        font-size: 1.4rem;
    }
    
    .content-wrapper p {
        font-size: 1.05rem;
    }
    
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-wrapper,
    .how-to-section-wrapper {
        padding: 0 20px;
        margin: 2.5rem auto;
    }
    
    .content-wrapper h2,
    .how-to-section-wrapper h2 {
        font-size: 1.8rem;
    }
    
    .content-wrapper h3 {
        font-size: 1.3rem;
    }
    
    .content-wrapper p {
        font-size: 1rem;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .step-card {
        padding: 20px;
    }
    
    .step-card h3 {
        font-size: 1.2rem;
    }
    
    .step-card p {
        font-size: 0.95rem;
    }
    
    .content-wrapper ul {
        margin-left: 20px;
    }
}

@media (max-width: 576px) {
    .content-wrapper,
    .how-to-section-wrapper {
        padding: 0 15px;
        margin: 2rem auto;
    }
    
    .content-wrapper h2 {
        font-size: 1.6rem;
    }
    
    .content-wrapper h3 {
        font-size: 1.2rem;
    }
    
    .content-wrapper ul {
        margin-left: 15px;
    }
}

@media print {
    .upload-section,
    .action-buttons,
    .global-actions,
    .file-info,
    .how-to-section-wrapper {
        display: none !important;
    }
    
    .content-wrapper {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .content-wrapper h2 {
        page-break-before: always;
    }
    
    .content-wrapper h3 {
        page-break-after: avoid;
    }
    
    .content-wrapper p {
        orphans: 3;
        widows: 3;
    }
}