/* Modified CSS to avoid conflicts with Font Awesome */
:root {
    --primary: #1ba4c8;
    --primary-dark: #1892B2;
    --secondary: #1892B2;
    --light-bg: #F8FCFF;
    --border: #e1e5f1;
    --text: #333;
    --text-light: #666;
    --danger: #ff6b6b;
    --success: #06d6a0;
    --warning: #ffd166;
    --file-hover: rgba(0,0,0,0.1);
}

/*------------------------------------
 DARK THEME
------------------------------------*/
[data-theme="dark"] {

    --primary: #1ba4c8;
    --primary-dark: #1892B2;
    --secondary: #1892B2;
    --light-bg: #383b43;
    --border: #747383;
    --text: white;
    --text-light: #E5E5E5;
    --danger: #ff6b6b;
    --success: #06d6a0;
    --warning: #ffd166;
    --file-hover: rgba(0,0,0,0.5);
}


input,
select,
textarea,
button {
    margin-bottom: 0 !important;
}


/* Main Container */
.container-custom {
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.container-custom p { text-align: center; line-height: 10px; }
.container-custom select { margin-bottom: 0; }
.container-custom h3, 
.container-custom h3 a { font-size: 18px !important; padding: 0px; }

/* Content Wrapper */
.content-wrapper-custom {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Left Panel - NO SCROLL */
.left-panel-custom {
    flex: 0 0 300px;
    padding: 15px;
    overflow-y: visible !important; /* No scrolling */
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

/* Right Panel */
.right-panel-custom {
    flex: 1;
    padding: 15px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.section-title-custom {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-custom .fa-icon {
    color: var(--primary);
}

/* Upload Area */
.upload-area-custom {
    border: 2px dashed var(--primary);
    border-radius: 8px;
    padding: 5px 10px;
    text-align: center;
    background-color: rgb(164 187 200 / 10%);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 5px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.upload-area-custom:hover {
    background-color: rgb(164 187 200 / 20%);
    border-color: var(--primary-dark);
}
.upload-area-custom i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2px;
}
.upload-area-custom h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--secondary);
}
.upload-area-custom p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 10px;
    text-align: center;
}

#fileInput {
    display: none;
}

/* Form Controls */
.form-group-custom {
    margin-bottom: 2px;
}

.form-group-custom label {
    display: block;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

/* Dimension Input Styling */
.dimension-field-custom {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dimension-label-custom {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    margin: 0;
    line-height: 1;
}

.dimensions-input-custom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dimensions-input-custom input {
    padding: 9px 0px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

.dimensions-input-custom .separator-custom {
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}

.units-select-custom {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

.select-full-custom {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Radio Groups */
.radio-group-custom {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    flex: 1;
    justify-content: center;
}

.radio-group-custom input {
    margin-right: 6px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.radio-group-custom label {
    font-size: 0.85rem;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.radio-groups-container-custom {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(27, 164, 200, 0.2);
    border-radius: 6px;
    flex-wrap: nowrap; /* Prevent wrapping */
}

/* Make entire button clickable, hide radio button */
.radio-groups-container-custom .radio-group-custom {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0; /* Allow shrinking */
}

.radio-groups-container-custom .radio-group-custom input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    margin: 0;
    z-index: 2;
}

.radio-groups-container-custom .radio-group-custom label {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.radio-groups-container-custom .radio-group-custom:hover {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.05);
}

.radio-groups-container-custom .radio-group-custom:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.1);
}

.radio-groups-container-custom input[type="radio"]:checked ~ .radio-group-custom {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.1);
}

/* Hide the actual radio buttons but keep them functional */
.radio-groups-container-custom input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-groups-container-custom input[type="radio"]:focus + label {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Color Options */
.color-options-custom {
    display: flex;
    gap: 8px;
    margin: 2px 0;
    flex-wrap: wrap;
}

.color-option-custom {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.color-option-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #aaa;
}

.color-option-custom.active-custom {
    border-color: #4b6cb7;
    box-shadow: 0 0 0 2px rgba(75, 108, 183, 0.2);
}

.color-preview-custom {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Color Picker */
.color-picker-wrapper-custom {
    position: relative;
}

#colorPicker {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Quality Slider */
.quality-slider-container-custom {
    /*margin-top: 8px;*/
}

.quality-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quality-value-custom {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.quality-description-custom {
    font-size: 0.8rem;
    color: var(--text-light);
}

.quality-slider-custom {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--slider-percent, 85%), #e0e0e0 var(--slider-percent, 85%), #e0e0e0 100%);
    outline: none;
    border-radius: 2.5px;
}

.quality-slider-custom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: var(--primary);
}

/* Action Buttons */
.action-buttons-custom {
    display: flex;
    gap: 5px;
    margin-top: 16px;
}

.action-buttons-custom button {
    width: 100%;
}

/* Preview Area - Fixed height */
.preview-area-custom {
    height: 400px !important;
    min-height: 400px !important;
    max-height: 400px !important;
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    flex: 0 0 400px !important; /* Fixed, non-scrollable */
    flex-shrink: 0 !important;
}

.preview-container-custom {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
}

#previewImage {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: none;
    margin: auto;
}

.preview-placeholder-custom {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.preview-placeholder-custom .fa-icon {
    font-size: 3rem;
    color: #d1d9f0;
    margin-bottom: 10px;
}

/* Combined Info Container */
.combined-info-container-custom {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgb(31 31 32 / 49%);
    color: white;
    padding: 2px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(2px);
    z-index: 10;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    height: 70px;
    margin: 0;
    pointer-events: none;
}

.combined-info-container-custom * {
    pointer-events: auto;
}

.combined-info-container-custom::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
}
.info-left-custom {
    flex: 0 0 auto;
}

.info-right-custom {
    flex: 1;
    margin-left: 20px;
    min-width: 0;
    text-align: right;
}

.dimension-values-custom {
    display: flex;
    gap: 15px;
}

.dimension-item-custom {
    text-align: center;
    min-width: 60px;
}

.dimension-row-custom {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dimension-row-custom .value-custom {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dimension-row-custom .label-custom {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.info-text-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-line-custom {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

/* File List Container - Takes remaining space */
.file-list-container-custom {
   flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 350px; /* Limit height to show ~5 files */
    overflow: hidden;
    position: relative;
}

.file-list-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; /* Prevent shrinking */
}

.file-list-header-custom h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary);
}

.file-count-custom {
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* File List - Scrollable area only */
.file-list-custom {
   flex: 1;
    overflow-y: auto; /* Scroll when more than 5 files */
    overflow-x: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px;
    min-height: 150px;
    max-height: calc(5 * 58px); /* 5 files * file item height (approx) */
}

/* File Item - Updated with delete button styles */
.file-item-custom {
   display: flex;
    align-items: center;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s;
    cursor: pointer;
    min-height: 50px;
    height: 50px; /* Fixed height for consistent layout */
    box-sizing: border-box;
}

.file-item-custom:last-child {
    border-bottom: none;
}

.file-item-custom:hover {
    background-color: var(--file-hover);
}

.file-item-custom.active-custom {
    background-color: rgba(75, 108, 183, 0.1);
    border-left: 3px solid var(--primary);
}

.file-preview-custom {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-preview-custom img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-preview-custom .fa-icon {
    color: #d1d9f0;
    font-size: 1.1rem;
}

.file-details-custom {
    flex: 1;
    min-width: 0;
}

.file-name-custom {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px; /* Limit width to prevent overflow */
}

.file-size-custom {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* File Actions - Matching your example styles */
.file-actions-custom {
    margin-left: 8px;
    flex-shrink: 0;
    z-index: 2;
    opacity: 0; /* Hides button by default */
    transition: opacity 0.2s ease; /* Smooth fade effect */
}

.file-item-custom:hover .file-actions-custom {
    opacity: 1; /* Shows button on hover */
}

.delete-file-btn-custom {
    background: none;
    color: var(--danger);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    padding: 0;
}

.delete-file-btn-custom:hover {
    background: none;
    color: var(--danger);
    transform: scale(1.2);
    border: none;
    box-shadow: none;
}

.delete-file-btn-custom:active {
    transform: scale(0.9);
}

/* Loading */
.loading-custom {
    display: none;
    text-align: center;
    padding: 8px;
}

.spinner-custom {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state-custom {
   text-align: center;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 150px;
    margin: 0;
    padding: 20px; /* Keep some padding but not too much */
}

.empty-state-custom .fa-icon {
    font-size: 2rem;
    color: #d1d9f0;
    margin-bottom: 8px;
}

.empty-state-custom p {
    margin: 5px 0;
    line-height: 1.4;
}

.empty-state-custom .helper-text {
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.7;
}

/* Gradient Picker Modal */
.gradient-picker-modal-custom {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.gradient-picker-content-custom {
    padding: 20px;
    border-radius: 10px;
    width: 90%; /* Same approach */
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 15px;
    margin: 10px auto;
    background: var(--background);
}

.gradient-preview-custom {
    box-sizing: border-box;
    width: 100%;
    height: 50px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #f8f9fa;
}

.gradient-preview-custom canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.gradient-controls-custom {
    margin-bottom: 20px;
}

.gradient-control-group-custom {
    margin-bottom: 15px;
}

.gradient-control-group-custom:last-child {
    margin-bottom: 0;
}

.gradient-control-group-custom label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.gradient-control-group-custom select,
.gradient-control-group-custom input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

.gradient-control-group-custom input[type="range"] {
    -webkit-appearance: none;
    height: 5px;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) 50%, #e0e0e0 50%, #e0e0e0 100%);
    border-radius: 2.5px;
    border: none;
    padding: 0;
}

.gradient-control-group-custom input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: var(--primary);
}

#gradientAngle[type="range"] {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) 50%, #e0e0e0 50%, #e0e0e0 100%);
    outline: none;
    border-radius: 2.5px;
    border: none;
    padding: 0;
}

#gradientAngle[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: var(--primary);
}

/* Color Stop Sliders */
.color-stops-container-custom {
    margin-bottom: 15px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 5px;
}

.color-stop-item-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--light-bg);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.color-stop-input-custom {
    width: 36px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    flex-shrink: 0;
}

.color-stop-slider-container-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.color-stop-position-custom {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.color-stop-position-custom[type="range"] {
    -webkit-appearance: none;
    height: 5px;
    border-radius: 2.5px;
    border: none;
    padding: 0;
    margin: 0;
}

.color-stop-percent-custom {
    min-width: 36px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
    flex-shrink: 0;
}

.remove-color-stop-custom {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.remove-color-stop-custom:hover {
    background: #ff5252;
}

.modal-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.modal-header-custom h3 {
    font-size: 1.1rem;
    color: var(--secondary);
    margin: 0;
    font-weight: 600;
}

.modal-close-custom {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close-custom:hover {
    background: #f5f5f5;
}

.modal-actions-custom {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

#applyGradient {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

#applyGradient:hover {
    background: var(--primary-dark);
}

#addColorStop {
    padding: 6px 12px;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

#addColorStop:hover {
    background: var(--primary);
    color: white;
    text-shadow: none;
}

#addColorStop i {
    font-size: 12px;
}

/* Scrollbars */
/* Left panel scrollbar */
.left-panel-custom::-webkit-scrollbar {
    width: 6px;
}

.left-panel-custom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.left-panel-custom::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.left-panel-custom::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* File List Scrollbar */
.file-list-custom::-webkit-scrollbar {
    width: 6px;
}

.file-list-custom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.file-list-custom::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.file-list-custom::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Color stops scrollbar */
.color-stops-container-custom::-webkit-scrollbar {
    width: 5px;
}

.color-stops-container-custom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.color-stops-container-custom::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.color-stops-container-custom::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Hide scrollbar when empty state is shown */
.file-list-custom:has(.empty-state-custom:only-child) {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 900px) {
    .content-wrapper-custom {
        flex-direction: column;
    }
    
    .left-panel-custom {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: auto;
    }
    
    .right-panel-custom {
        flex: 1;
        padding: 15px;
        overflow-y: hidden;
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
    }
    
    .preview-area-custom {
        flex: 0 0 300px; /* Smaller fixed height on tablet */
        max-height: 300px;
        min-height: 300px;
    }
    
    .combined-info-container-custom {
        height: 60px;
        padding: 10px;
    }
    
    .dimension-values-custom {
        gap: 10px;
    }
    
    .dimension-item-custom {
        min-width: 50px;
    }
    
    .dimension-row-custom .value-custom {
        font-size: 14px;
    }
    
    .info-line-custom {
        font-size: 11px;
    }
    
    .file-list-container-custom {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .dimensions-input-custom input {
        width: 50px;
    }
    
    .dimension-label-custom {
        font-size: 0.8rem;
    }

    
    .dimensions-input-custom {
        gap: 6px;
    }
    
    .dimension-field-custom {
        gap: 4px;
    }
    
    .btn-custom {
        font-size: 0.85rem;
        padding: 8px 3px;
    }
    
    .gradient-picker-content-custom {
        /*width: 95%;*/
        /*max-width: 95%;*/
        margin: 10px auto;
        padding: 15px;
    }
    
    .color-stop-item-custom {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .preview-area-custom {
        flex: 0 0 250px; /* Even smaller on very small screens */
        max-height: 250px;
        min-height: 250px;
    }
    
    .upload-area-custom {
        min-height: 120px;
        padding: 12px 8px;
    }
    
    .combined-info-container-custom {
        height: 55px;
        padding: 8px 10px;
    }
    
    .dimension-values-custom {
        gap: 8px;
    }
    
    .dimension-item-custom {
        min-width: 45px;
    }
    
    .dimension-row-custom .value-custom {
        font-size: 13px;
    }
    
    .dimension-row-custom .label-custom {
        font-size: 10px;
    }
    
    .info-text-custom {
        gap: 2px;
    }
    
    .info-line-custom {
        font-size: 10px;
    }
    
    .file-list-container-custom {
        min-height: 120px;
    }
    
    .file-name-custom {
        max-width: 140px; /* Smaller max width on mobile */
    }
    
    .file-item-custom {
        padding: 6px 4px;
        min-height: 45px;
    }
    
    .action-buttons-custom {
        flex-direction: column;
    }

    .action-buttons-custom button {
        width: 100%;
    }
}

/* Remove any conflicting overflow rules from sections */
.section-custom:not(.file-list-container-custom) {
    overflow: visible !important;
}

/* Ensure preview area doesn't exceed its container */
.preview-area-custom,
.preview-container-custom {
    overflow: hidden !important;
}

/* ===== DOWNLOAD MODAL (Auto-opens after resize) ===== */
.download-modal-custom {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.download-modal-content-custom {
    border-radius: 12px;
    width: 90%; /* Use percentage instead of fixed width */
    max-width: 420px; /* Keep max-width for larger screens */
    min-width: 280px; /* Minimum width to prevent too small */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    margin: 0 auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.download-modal-header-custom {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--light-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.download-modal-header-custom h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--secondary);
    font-weight: 600;
}

.download-modal-close-custom {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.download-modal-close-custom:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.download-modal-body-custom {
    padding: 25px;
}

.download-options-custom {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.download-option-custom {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: var(--light-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.download-option-custom:hover {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(27, 164, 200, 0.1);
}

.download-option-icon-custom {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.download-option-content-custom {
    flex: 1;
}

.download-option-title-custom {
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 5px;
    font-size: 1rem;
}

.download-option-description-custom {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
}

.download-stats-custom {
    margin-top: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stats-grid-custom {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-item-custom {
    text-align: center;
    padding: 8px;
}

.stat-value-custom {
    display: block;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 3px;
}

.stat-label-custom {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Responsive for download modal */
@media (max-width: 480px) {
    .download-modal-content-custom {
        width: 95%; /* Slightly more width on very small screens */
        max-width: 95%;
        margin: 10px auto; /* Add margin on all sides */
    }
    
    .download-modal-header-custom {
        padding: 15px;
    }
    
    .download-modal-body-custom {
        padding: 15px;
    }
    
    .download-option-custom {
        padding: 15px;
    }
    
    .download-option-icon-custom {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stats-grid-custom {
        grid-template-columns: 1fr;
    }
}