/* CRITICAL: Force background display and isolate from theme */
.mt-pds-wrapper {
    all: initial !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    background: #ffffff !important;
    min-height: auto !important;
    color: #1f2937 !important;
    line-height: 1.6 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    display: block !important;
    position: relative !important;
    box-sizing: border-box !important;
    isolation: isolate !important;
    z-index: 1 !important;
}

.mt-pds-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
  background: #ffffff;
  border: 3px solid #d1d5db;
  border-radius: 20px;
  position: relative;
  transition: all 0.3s ease;
  isolation: isolate;
}

/* On hover, gradient border via background trick */
.mt-pds-container:hover {
  border: 3px solid transparent;
  background: 
    linear-gradient(#ffffff, #ffffff) padding-box, 
    linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899) border-box;
  background-clip: padding-box, border-box;
  background-origin: border-box;
}



.mt-pds-header {
    text-align: center;
    margin-bottom: 3rem;
}

.mt-pds-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.mt-pds-subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    font-weight: 400;
}

.mt-pds-tool-section {
    background: #f8fafc;
    border: 2px solid #d1d5db;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.mt-pds-tool-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.mt-pds-section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.mt-pds-upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.mt-pds-upload-area:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.mt-pds-upload-area.dragover {
    border-color: #8b5cf6;
    background: #faf5ff;
    transform: scale(1.02);
}

.mt-pds-upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.6;
}

.mt-pds-upload-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.mt-pds-upload-subtext {
    font-size: 0.9rem;
    color: #6b7280;
}

.mt-pds-file-input {
    display: none !important;
}

.mt-pds-file-info {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    display: none;
}

.mt-pds-file-info.show {
    display: block;
}

.mt-pds-file-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mt-pds-file-details {
    font-size: 0.9rem;
    color: #6b7280;
}

.mt-pds-input-group {
    margin-bottom: 1.5rem;
}

.mt-pds-input-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.mt-pds-input-field {
    width: 100%;
    padding: 1.2rem;
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    font-size: 1rem; /* = 16px (default base font size) */
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.mt-pds-input-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ✅ Mobile Optimization */
@media (max-width: 480px) {
    .mt-pds-input-field {
        padding: 0.8rem;         /* Less padding for smaller space */
        font-size: 0.875rem;     /* = 14px */
        border-radius: 8px;      /* Slightly tighter rounding */
    }
}


.mt-pds-input-help {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.mt-pds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 44px;
}

.mt-pds-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.mt-pds-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.mt-pds-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.mt-pds-btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 2px solid #d1d5db;
}

.mt-pds-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mt-pds-status-message {
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-weight: 500;
    display: none;
}

.mt-pds-status-message.show {
    display: block;
}

.mt-pds-status-success {
    background: #ecfdf5;
    color: #065f46;
    border: 2px solid #10b981;
}

.mt-pds-status-error {
    background: #fef2f2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.mt-pds-status-info {
    background: #eff6ff;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

.mt-pds-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
    display: none;
}

.mt-pds-progress-bar.show {
    display: block;
}

.mt-pds-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
}

.mt-pds-button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.mt-pds-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.mt-pds-feature-card {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.mt-pds-feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.mt-pds-feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.8;
}

.mt-pds-feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mt-pds-feature-desc {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Split Mode Cards */
.mt-pds-split-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.mt-pds-mode-card {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.mt-pds-mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.mt-pds-mode-card.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.mt-pds-mode-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    color: #6b7280;
    transition: color 0.3s ease;
}

.mt-pds-mode-card.active .mt-pds-mode-icon {
    color: #3b82f6;
}

.mt-pds-mode-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mt-pds-mode-desc {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Page Preview */
.mt-pds-page-preview {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: none;
}

.mt-pds-page-preview.show {
    display: block;
}

.mt-pds-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mt-pds-preview-title {
    font-weight: 600;
    color: #1f2937;
}

.mt-pds-preview-controls {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 0.5rem;
    justify-content: center;
}

/* Make buttons responsive */
.mt-pds-preview-controls button {
    padding: 8px 12px;
    font-size: 14px;
    flex: 1 1 auto;        /* allow shrink and grow */
    min-width: 100px;
    max-width: 200px;
}

/* On very small screens (e.g. <= 480px), reduce further */
@media (max-width: 480px) {
    .mt-pds-preview-controls button {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 80px;
        max-width: 100%;
    }
}


.mt-pds-btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mt-pds-btn-small:hover {
    background: #f8fafc;
    border-color: #3b82f6;
}

.mt-pds-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.mt-pds-page-thumbnail {
    border: 2px solid #d1d5db;
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ffffff;
    position: relative;
}

.mt-pds-page-thumbnail:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.mt-pds-page-thumbnail.selected {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.mt-pds-thumbnail-image {
    width: 100%;
    height: 120px;
    background: #f8fafc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.mt-pds-thumbnail-number {
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
}

/* Size Input Group */
.mt-pds-size-input-group {
    display: flex;
    gap: 0.5rem;
}

.mt-pds-size-input {
    flex: 2;
}

.mt-pds-size-unit {
    flex: 1;
    min-width: 80px;
}

/* Output Settings */
.mt-pds-output-settings {
    space-y: 1.5rem;
}

.mt-pds-quality-settings {
    margin-top: 1.5rem;
}

.mt-pds-setting-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.mt-pds-setting-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    position: relative;
    padding-left: 2rem;
}

.mt-pds-setting-label input[type="checkbox"] {
    position: absolute;
    left: 0;
    opacity: 0;
}

.mt-pds-checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mt-pds-setting-label:hover .mt-pds-checkmark {
    border-color: #3b82f6;
}

.mt-pds-setting-label input:checked ~ .mt-pds-checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.mt-pds-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mt-pds-setting-label input:checked ~ .mt-pds-checkmark:after {
    display: block;
}

/* Hidden utility */
.mt-pds-hidden {
    display: none !important;
}

/* Enhanced Progress */
.mt-pds-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.mt-pds-progress-percentage {
    font-weight: 600;
    color: #3b82f6;
}

/* Results Section */
.mt-pds-results-section {
    background: #f8fafc;
    border: 2px solid #d1d5db;
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    display: none;
}

.mt-pds-results-section.show {
    display: block;
}

.mt-pds-results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mt-pds-results-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mt-pds-results-subtitle {
    color: #6b7280;
}

.mt-pds-download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.mt-pds-download-card {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.mt-pds-download-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.mt-pds-download-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mt-pds-download-info {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.mt-pds-download-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.mt-pds-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* PDF Preview Styles */
.mt-pds-pdf-preview {
    width: 100%;
    height: 80px;
    border: none;
    border-radius: 4px;
    pointer-events: none;
    background: #f8fafc;
}

.mt-pds-page-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 4px 8px;
    border-radius: 0 0 6px 6px;
}

.mt-pds-page-label {
    font-size: 0.7rem;
    font-weight: 500;
}

.mt-pds-thumbnail-image {
    width: 100%;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mt-pds-page-placeholder {
    text-align: center;
    color: #6b7280;
    font-size: 0.8rem;
}

.mt-pds-page-placeholder small {
    display: block;
    font-size: 0.6rem;
    margin-top: 2px;
}

.mt-pds-page-thumbnail.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.05);
}

.mt-pds-page-thumbnail:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);
}

.mt-pds-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.mt-pds-form-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.mt-pds-mode-info {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
}

.mt-pds-info-text {
    color: #374151;
    margin-bottom: 1rem;
}

.mt-pds-info-stats {
    color: #6b7280;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .mt-pds-container {
        padding: 20px 16px;
        margin: 10px;
    }
    
    .mt-pds-title {
        font-size: 1.8rem;
    }
    
    .mt-pds-split-modes {
        grid-template-columns: 1fr;
    }
    
    .mt-pds-thumbnails-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .mt-pds-feature-grid {
        grid-template-columns: 1fr;
    }
    
    .mt-pds-button-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mt-pds-btn {
        min-height: 44px; /* Touch target minimum */
    }
    
    .mt-pds-form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .mt-pds-setting-row {
        flex-direction: column;
        gap: 1rem;
    }
}