/**
 * Image Merger Styles
 * Warm light compact layout for ToolZipper image tool
 *
 * @package Zipper
 */
.imgm-main-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.imgm-input-col {
    position: sticky;
    top: 20px;
}

.imgm-result-col,
.imgm-result-stack,
.imgm-summary-grid,
.imgm-result-dual-table,
.imgm-table-section,
.imgm-preview-section {
    min-width: 0;
}

.imgm-result-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.imgm-input-section,
.imgm-preview-section,
.imgm-table-section,
.imgm-summary-card,
.imgm-waiting {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.imgm-input-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.imgm-input-title,
.imgm-list-title,
.imgm-block-header h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #2d2a26;
}

.imgm-input-title {
    font-size: 14px;
    font-weight: 600;
}

.imgm-input-title i,
.imgm-list-title i,
.imgm-thumb-handle i,
.imgm-disclaimer i,
.imgm-waiting i {
    color: #d4af37;
}

.imgm-upload-area {
    border: 2px dashed #e8e4dc;
    border-radius: 12px;
    background: #faf9f7;
    padding: 22px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.imgm-upload-area:hover,
.imgm-upload-area:focus-visible,
.imgm-upload-area.is-dragover {
    outline: none;
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.imgm-upload-icon {
    display: block;
    font-size: 34px;
    margin-bottom: 8px;
    color: #d4af37;
}

.imgm-upload-text {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 4px;
}

.imgm-upload-hint {
    font-size: 12px;
    color: #7a746d;
}

.imgm-upload-input {
    display: none;
}

.imgm-list-section,
.imgm-control-group,
.imgm-field-block,
.imgm-thumb-meta,
.imgm-thumb-actions,
.imgm-color-wrap,
.imgm-result-stack,
.imgm-preview-wrap,
.imgm-disclaimer,
.imgm-actions,
.imgm-range-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.imgm-list-header,
.imgm-range-header,
.imgm-block-header,
.imgm-thumb-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.imgm-list-title,
.imgm-block-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.imgm-list-guide,
.imgm-field-help,
.imgm-block-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: #7a746d;
}

.imgm-thumb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.imgm-thumb-empty,
.imgm-preview-empty,
.imgm-table-empty {
    color: #8f8983;
    font-size: 13px;
}

.imgm-thumb-empty {
    padding: 14px 12px;
    border: 1px dashed #e0dbd2;
    border-radius: 10px;
    background: #faf9f7;
    text-align: center;
}

.imgm-thumb-card {
    display: grid;
    grid-template-columns: auto 56px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.imgm-thumb-card:hover,
.imgm-thumb-card.is-drop-target {
    border-color: #d4af37;
    background: #fffdf8;
}

.imgm-thumb-card.is-dragging {
    opacity: 0.7;
    transform: scale(0.99);
}

.imgm-thumb-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: #a29c96;
}

.imgm-thumb-preview {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: repeating-conic-gradient(#e8e4dc 0% 25%, #fff 0% 50%) 50% / 8px 8px;
    border: 1px solid #e8e4dc;
}

.imgm-thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.imgm-thumb-topline {
    font-size: 11px;
    color: #7a746d;
}

.imgm-thumb-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.12);
    color: #9e7a12;
    font-weight: 700;
}

.imgm-thumb-name,
.imgm-table-name {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.imgm-thumb-sub {
    font-size: 12px;
    color: #7a746d;
}

.imgm-thumb-actions {
    flex-direction: row;
    gap: 6px;
}

.imgm-thumb-action,
.imgm-inline-btn,
.imgm-preset-btn,
.imgm-choice-btn {
    border: 1px solid #ddd7cb;
    background: #fff;
    color: #5f5a56;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.imgm-thumb-action {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.imgm-thumb-action:hover:not(:disabled),
.imgm-inline-btn:hover,
.imgm-preset-btn:hover,
.imgm-choice-btn:hover,
.imgm-thumb-action:focus-visible,
.imgm-inline-btn:focus-visible,
.imgm-preset-btn:focus-visible,
.imgm-choice-btn:focus-visible {
    outline: none;
    border-color: #d4af37;
    color: #2d2a26;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.imgm-thumb-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.imgm-thumb-action-danger:hover:not(:disabled) {
    color: #dc3232;
    border-color: rgba(220, 50, 50, 0.35);
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.08);
}

.imgm-inline-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.imgm-choice-row,
.imgm-preset-row,
.imgm-actions,
.imgm-download-actions {
    display: grid;
    gap: 8px;
}

.imgm-choice-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.imgm-choice-row-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.imgm-choice-btn,
.imgm-preset-btn {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.imgm-choice-btn.is-active,
.imgm-preset-btn.is-active {
    color: #9e7a12;
    background: #fffaf0;
    border-color: #d4af37;
}

.imgm-select,
.imgm-number-input,
.imgm-color-input,
.imgm-range {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.imgm-select,
.imgm-number-input {
    height: 42px;
    border: 1px solid #ddd7cb;
    border-radius: 8px;
    background: #fff;
    color: #2d2a26;
    padding: 0 12px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.imgm-select:hover,
.imgm-number-input:hover,
.imgm-color-input:hover,
.imgm-range:hover {
    border-color: #d4c67a;
}

.imgm-select:focus,
.imgm-number-input:focus,
.imgm-color-input:focus,
.imgm-range:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.imgm-control-label {
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
}

.imgm-unit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.imgm-unit-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e8e4dc;
    background: #f5f3f0;
    color: #5f5a56;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.imgm-preset-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.imgm-color-wrap {
    display: none;
}

.imgm-color-wrap.is-visible {
    display: flex;
}

.imgm-color-input {
    height: 42px;
    padding: 4px;
    border: 1px solid #ddd7cb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.imgm-range-header {
    flex-direction: row;
}

.imgm-range-value {
    font-size: 13px;
    font-weight: 700;
    color: #d4af37;
}

.imgm-range {
    height: 6px;
    border-radius: 999px;
    border: 0;
    background: #e8e4dc;
    appearance: none;
    cursor: pointer;
}

.imgm-range::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.imgm-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.imgm-actions {
    grid-template-columns: 1fr auto;
}

.imgm-download-actions {
    grid-template-columns: 1fr;
}

.imgm-btn {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.imgm-btn i {
    margin-right: 6px;
}

.imgm-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.imgm-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.imgm-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

.imgm-btn-secondary {
    color: #5f5a56;
    background: #f5f3f0;
    border-color: #e8e4dc;
}

.imgm-btn-secondary:hover:not(:disabled) {
    border-color: #d4af37;
    background: #fffaf0;
}

.imgm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.imgm-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 38px 22px;
    text-align: center;
    color: #7a746d;
}

.imgm-waiting i {
    font-size: 32px;
    opacity: 0.45;
}

.imgm-waiting p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
}

.imgm-waiting[hidden],
.imgm-preview-canvas[hidden],
.imgm-table-section[hidden],
.imgm-field-block[hidden],
.imgm-preview-empty[hidden] {
    display: none !important;
}

.imgm-result-stack {
    gap: 12px;
}

.imgm-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.imgm-summary-grid + .imgm-preview-section {
    margin-top: 6px;
}

.imgm-summary-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.12);
}

.imgm-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: #7a746d;
}

.imgm-summary-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #2d2a26;
}

.imgm-summary-card-kpi .imgm-summary-value {
    font-size: 24px;
    color: #b58913;
}

.imgm-preview-section,
.imgm-table-section {
    padding: 16px;
}

.imgm-block-note {
    text-align: right;
}

.imgm-preview-wrap {
    gap: 10px;
    min-height: 280px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #e8e4dc;
    background: #faf9f7;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.imgm-preview-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(45, 42, 38, 0.08);
    background: #fff;
}

.imgm-result-dual-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.imgm-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.imgm-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.imgm-table th,
.imgm-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ece7df;
    text-align: left;
    font-size: 13px;
    color: #2d2a26;
    vertical-align: middle;
}

.imgm-table th {
    white-space: nowrap;
    font-weight: 700;
    color: #5f5a56;
    background: #faf9f7;
}

.imgm-table tbody tr:last-child td,
.imgm-table tbody tr:last-child th {
    border-bottom: 0;
}

.imgm-disclaimer {
    margin-top: 14px;
    flex-direction: row;
    padding: 10px 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    font-size: 11px;
    color: #9e9a96;
    line-height: 1.55;
}

.imgm-disclaimer i {
    flex-shrink: 0;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .imgm-main-layout {
        grid-template-columns: 1fr;
    }

    .imgm-input-col {
        position: static;
    }

    .imgm-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .imgm-result-dual-table,
    .imgm-actions,
    .imgm-choice-row-compact {
        grid-template-columns: 1fr;
    }

    .imgm-choice-row {
        grid-template-columns: 1fr;
    }

    .imgm-preset-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .imgm-thumb-card {
        grid-template-columns: 20px 48px minmax(0, 1fr);
    }

    .imgm-thumb-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .imgm-block-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .imgm-block-note {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .tool-section,
    .imgm-main-layout,
    .imgm-input-section,
    .imgm-result-col,
    .imgm-preview-section,
    .imgm-table-section {
        max-width: 100%;
        overflow-x: hidden;
    }

    .imgm-input-section,
    .imgm-preview-section,
    .imgm-table-section,
    .imgm-summary-card {
        padding: 14px;
    }

    .imgm-summary-grid {
        grid-template-columns: 1fr;
    }

    .imgm-summary-value {
        font-size: 18px;
    }

    .imgm-summary-card-kpi .imgm-summary-value {
        font-size: 22px;
    }

    .imgm-preset-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .imgm-unit-chip {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .imgm-thumb-card {
        grid-template-columns: 1fr;
    }

    .imgm-thumb-handle,
    .imgm-thumb-preview {
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .imgm-upload-area,
    .imgm-thumb-card,
    .imgm-thumb-action,
    .imgm-inline-btn,
    .imgm-preset-btn,
    .imgm-choice-btn,
    .imgm-btn,
    .imgm-select,
    .imgm-number-input,
    .imgm-color-input {
        transition: none !important;
    }

    .imgm-btn:hover,
    .imgm-thumb-card:hover {
        transform: none !important;
    }
}
