.img-converter-tool>h2 {
    text-align: center;
    color: #1f2937;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 26px;
    font-weight: 500;
}

/* Desktop Layout */
@media (min-width: 769px) {
    .img-converter-tool {
        max-width: 600px;
        margin: 2rem auto;
        background: #fff;
        padding: 30px;
        border-radius: 12px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    }

    .ictc-main-content {
        display: flex;
        flex-direction: row;
        display: block;
    }

    .ictc-options-wrapper {
        max-width: 600px;
        margin: 0 auto;
    }

    .ictc-file-list {
        display: block;
        margin-top: 15px;
        padding: 1rem;
        border: 1px solid #eee;
        border-radius: 8px;
        max-height: 400px;
        overflow-y: auto;
    }
}

.ictc-hidden {
    display: none !important;
}

#ictcTargetSize::-webkit-outer-spin-button,
#ictcTargetSize::-webkit-inner-spin-button,
#ictcHeight::-webkit-outer-spin-button,
#ictcHeight::-webkit-inner-spin-button,
#ictcWidth::-webkit-outer-spin-button,
#ictcWidth::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#ictcTargetSize,
#ictcHeight,
#ictcWidth {
    appearance: textfield;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.ictc-input-group {
    display: flex;
    gap: 0;
}

#ictcTargetSize {
    width: 70px;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#ictcTargetUnit {
    min-width: 60px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.ictc-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#ictcSelectBtn,
#ictcConvertBtn,
#ictcDownloadAllBtn,
#ictcClearBtn {
    padding: 9px 13px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
}

#ictcSelectBtn,
#ictcConvertBtn {
    background-color: #2a73d9;
    color: white;
}

#ictcDownloadAllBtn {
    background-color: #28a745;
    color: white;
}

#ictcClearBtn {
    background-color: #5a6268;
    color: white;
}

/* --- Prevent Theme Overrides for Buttons --- */
.img-converter-tool #ictcSelectBtn:hover,
.img-converter-tool #ictcConvertBtn:hover {
    background-color: #2a73d9;
    /* Keep same color on hover */
}

.img-converter-tool #ictcDownloadAllBtn:hover {
    background-color: #28a745;
    /* Keep same color on hover */
}

.img-converter-tool #ictcClearBtn:hover {
    background-color: #5a6268;
    /* Keep same color on hover */
}

.img-converter-tool .ictc-button:focus {
    outline: none;
    box-shadow: none;
}

/* Add a "push down" effect on click for all action buttons */
.img-converter-tool .ictc-button:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}

.ictc-button .ictc-button-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* For spinner */
    transition: opacity 0.2s;
}

.ictc-drop-area {
    border: 2px dashed #adb5bd;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 8px;
    transition: all 0.2s;
    background: #f8f9fa;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    cursor: pointer;
    box-sizing: border-box;
}

.ictc-drop-area-progress {
    width: 80%;
    max-width: 250px;
    text-align: center;
}

#ictcDropAreaContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

#ictcDropAreaContent p:first-of-type {
    margin: 0;
    font-weight: 400;
    font-size: 17px;
}

#ictcDropAreaContent p:nth-of-type(2) {
    margin: 0.5rem 0;
    font-size: 17px;
    color: #425565;
}

.ictc-drop-area p {
    text-align: center;
}

.ictc-drop-area:hover {
    border-color: #4a6bff;
    background: #f1f3ff;
}

.ictc-drop-area.dragover {
    border-color: #4a6bff;
    background: #e9ecef;
}

#ictcFileInput {
    display: none;
}

.ictc-controls-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.5rem;
    align-items: center;
}

.ictc-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ictc-control-group label {
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

.img-converter-tool .ictc-select,
.img-converter-tool .ictc-input,
.img-converter-tool .ictc-dimention,
.img-converter-tool input[type="number"],
.img-converter-tool select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ced4da;
    min-width: 90px;
    background-color: white;
    font-size: 15px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

/* --- Prevent Theme Overrides for Inputs/Selects --- */
.img-converter-tool .ictc-select:hover,
.img-converter-tool .ictc-input:hover,
.img-converter-tool .ictc-dimention:hover {
    border-color: #ced4da;
    /* Keep border color the same on hover */
}

.img-converter-tool .ictc-select:focus,
.img-converter-tool .ictc-input:focus,
.img-converter-tool .ictc-dimention:focus {
    outline: none;
    border-color: #4a6bff;
    box-shadow: 0 0 0 1px rgba(74, 107, 255, 0.25);
    /* Highlight with a box-shadow ring */
    background-color: white;
}

.ictc-range {
    width: 120px;
}

.ictc-file-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 8px;
}

.ictc-file-preview {
    width: 80px;
    height: 60px;
    object-fit: contain;
    margin-right: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
}

.ictc-file-details {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ictc-file-details::-webkit-scrollbar {
    display: none;
}

.ictc-file-name {
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.ictc-file-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

.ictc-file-converted {
    display: block;
    margin-top: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: #e8f5e9;
    color: #534e4e;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.ictc-download-btn {
    margin-left: 1rem;
    padding: 0.4rem 0.8rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.ictc-button-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ictc-spin 1s linear infinite;
}

.ictc-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #4a6bff;
    border-radius: 50%;
    animation: ictc-spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes ictc-spin {
    to {
        transform: rotate(360deg);
    }
}

.ictc-buttons-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Hide optional panels and buttons by default */
.ictc-optional-panel,
.ictc-buttons-wrapper,
.ictc-file-list {
    display: none;
}

/* Show them only when files have been added */
.img-converter-tool.has-files .ictc-optional-panel {
    display: block;
}

.img-converter-tool.has-files .ictc-buttons-wrapper {
    display: flex;
}

.img-converter-tool.has-files .ictc-file-list {
    display: block;
}


.img-converter-tool .ictc-dimention {
    width: 70px;
}

/* Custom large arrow for dropdowns */
.img-converter-tool select.ictc-select,
.img-converter-tool select.ictc-dimention {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 22px 22px;
    padding-right: 30px;
    /* space for icon */
    cursor: pointer;
}

.ictc-optional-panel {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 20px;
}

.ictc-optional-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    font-size: 17px;
    user-select: none;
    scroll-margin-top: 20px;
}

.ictc-optional-arrow {
    color: #495057;
    transition: transform 0.2s ease-in-out;
}

.ictc-optional-header[aria-expanded="true"] .ictc-optional-arrow {
    transform: rotate(180deg);
}

.ictc-optional-content {
    padding: 1rem 1rem 0 1rem;
    border-top: 1px solid #e9ecef;
    background-color: #fff;
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

.ictc-file-list-placeholder {
    text-align: center;
    color: #634f4f;
    padding: 2rem;
    border: 2px dashed #eee;
    border-radius: 8px;
    height: 80%;
    display: flex;
    align-items: top;
    justify-content: center;
}

.ictc-progress-wrapper {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding: 0 10px;
    width: 100%;
}

.ictc-progress-label {
    font-size: 17px;
    color: #495057;
    margin-bottom: 0.5rem;
    text-align: center;
}

.ictc-progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.ictc-progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #2a73d9;
    transition: width 0.3s ease-in-out;
}

.ictc-file-preview-wrapper {
    position: relative;
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 1rem;
    margin-bottom: 1rem;
}

.ictc-file-preview-wrapper .ictc-file-preview {
    width: 100%;
    height: 100%;
    margin: 0;
}

.ictc-single-download-icon {
    position: absolute;
    bottom: 4px;
    right: -8px;
    width: 22px;
    height: 22px;
    background-color: rgba(40, 167, 69, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.ictc-single-download-icon:active {
    transform: scale(0.9);
}

.ictc-single-download-icon:hover {
    background-color: #28a745;
}

.ictc-single-download-icon svg {
    width: 14px;
    height: 14px;
}

.ictc-remove-file-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background-color: #dc3545;
    color: white;
    border: 1px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.ictc-remove-file-btn svg {
    width: 14px;
    height: 14px;
}

.ictc-progress-view {
    padding: 20px 0;
}

.ictc-progress-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.ictc-progress-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: ictc-spin 1s linear infinite;
    margin-right: 15px;
}

.ictc-progress-container {
    flex-grow: 1;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.ictc-progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #3498db;
    transition: width 0.2s ease-in-out;
    border-radius: 10px;
}

.ictc-progress-percentage-text {
    font-weight: 500;
    margin-left: 15px;
    color: #2c3e50;
}

.ictc-animated-loading-text {
    text-align: center;
    font-size: 17px;
    color: #5a6a7a;
    height: 20px;
    margin-top: 10px;
}

/* Mobile Layout */
@media (max-width: 768px) {
    .ictc-buttons-wrapper {
        margin-top: 0;
        margin-bottom: 0;
        scroll-margin-top: 10px;
    }

    .img-converter-tool {
        flex-direction: column;
        padding: 20px 0;
        box-shadow: none;
        border-radius: 0;
        margin: 1rem 0;
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
    }

    .ictc-file-list {
        display: none;
        border-left: none;
        padding-left: 0;
        margin-top: 15px;
        max-height: 300px;
        overflow-y: auto;
    }

    .img-converter-tool.has-files .ictc-file-list {
        display: block;
    }

    .ictc-options-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .ictc-control-group label {
        text-align: left;
    }

    .ictc-optional-panel {
        margin-top: 0;
        width: 100%;
    }

    .ictc-optional-content {
        padding-left: 5px;
        padding-right: 0;
    }

    .ictc-optional-header {
        padding: 12px 5px;
    }

}