/**
 * Image Pixelate Styles
 * 이미지 픽셀화 도구 전용 스타일
 *
 * @package Zipper
 */

.pxl-main-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pxl-input-col {
    position: sticky;
    top: 20px;
    min-width: 0;
}

.pxl-result-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.pxl-upload-panel,
.pxl-editor-stack,
.pxl-info-layout,
.pxl-result-stack,
.pxl-preview-section,
.pxl-palette-section,
.pxl-result-summary,
.pxl-detail-section {
    min-width: 0;
}

.pxl-editor-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pxl-info-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.pxl-upload-panel,
.pxl-editor-card,
.pxl-input-section,
.pxl-preview-section,
.pxl-palette-section,
.pxl-detail-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    box-sizing: border-box;
}

.pxl-upload-panel,
.pxl-editor-card,
.pxl-input-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
    transition: box-shadow 0.2s ease;
}

.pxl-editor-card.is-wide {
    grid-column: 1 / -1;
}

.pxl-upload-panel:hover,
.pxl-editor-card:hover,
.pxl-input-section:hover {
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.1);
}

.pxl-result-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pxl-input-title,
.pxl-preview-title,
.pxl-palette-title,
.pxl-result-summary-title,
.pxl-detail-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1816;
}

.pxl-palette-title {
    white-space: nowrap;
}

.pxl-input-title i,
.pxl-preview-title i,
.pxl-palette-title i,
.pxl-result-summary-title i,
.pxl-detail-title i,
.pxl-disclaimer i,
.pxl-control-note i {
    color: #d4af37;
}

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

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

.pxl-upload-icon {
    font-size: 32px;
    color: #d4af37;
    margin-bottom: 8px;
}

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

.pxl-upload-hint {
    font-size: 12px;
    color: #9e9a96;
    line-height: 1.5;
}

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

.pxl-slider-group,
.pxl-output-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pxl-slider-compact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.pxl-slider-header,
.pxl-preview-header,
.pxl-palette-head,
.pxl-result-summary-head,
.pxl-detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pxl-slider-label,
.pxl-inline-title {
    font-size: 11px;
    font-weight: 600;
    color: #5f5a56;
}

.pxl-slider-value {
    font-size: 11px;
    font-weight: 700;
    color: #d4af37;
    text-align: right;
    min-width: 44px;
}

.pxl-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: #e8e4dc;
    cursor: pointer;
}

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

.pxl-slider::-webkit-slider-thumb:hover {
    transform: scale(1.08);
}

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

.pxl-control-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    font-size: 11px;
    color: #5f5a56;
    line-height: 1.45;
}

.pxl-control-note strong {
    color: #2d2a26;
}

.pxl-presets,
.pxl-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pxl-preset-btn,
.pxl-choice-btn,
.pxl-toggle-chip,
.pxl-reset-btn,
.pxl-btn,
.pxl-compare-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid #e8e4dc;
    border-radius: 9px;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.pxl-preset-btn,
.pxl-choice-btn {
    flex: 1 1 88px;
}

.pxl-style-presets .pxl-preset-btn {
    flex-basis: 82px;
}

.pxl-aspect-grid .pxl-choice-btn {
    flex-basis: 72px;
}

.pxl-palette-choice-grid .pxl-choice-btn {
    flex-basis: 78px;
}

.pxl-scale-grid .pxl-choice-btn {
    flex: 1 1 56px;
}

.pxl-bg-grid .pxl-choice-btn {
    flex-basis: 110px;
}

.pxl-preset-btn:hover,
.pxl-choice-btn:hover,
.pxl-toggle-chip:hover,
.pxl-reset-btn:hover,
.pxl-compare-toggle:hover:not(:disabled) {
    border-color: #d4c67a;
    color: #2d2a26;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

.pxl-preset-btn.active,
.pxl-choice-btn.active,
.pxl-toggle-chip.active,
.pxl-compare-toggle.active {
    border-color: #d4af37;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    color: #b58913;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.14);
}

.pxl-toggle-row {
    display: flex;
    gap: 6px;
}

.pxl-toggle-chip {
    width: auto;
    padding-inline: 12px;
}

.pxl-color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: #faf9f7;
    font-size: 12px;
    font-weight: 600;
    color: #5f5a56;
}

.pxl-color-field input {
    width: 42px;
    height: 32px;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.pxl-color-field.is-hidden {
    display: none;
}

.pxl-btn-group {
    display: flex;
    gap: 6px;
}

.pxl-reset-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.pxl-download-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    z-index: 30;
}

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

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

.pxl-btn:disabled,
.pxl-compare-toggle:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pxl-download-scale-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 11px;
    font-weight: 700;
}

.pxl-download-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    display: none;
    min-width: 210px;
    max-height: min(320px, calc(100vh - 120px));
    overflow-y: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(45, 42, 38, 0.12);
}

.pxl-download-menu.show {
    display: block;
}

.pxl-download-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 12px;
    color: #2d2a26;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.pxl-download-item:hover {
    background: #faf6ec;
    color: #b58913;
}

.pxl-preview-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.pxl-empty-state,
.pxl-canvas-pane,
.pxl-compare-container {
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    background: #faf9f7;
}

.pxl-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 420px;
    padding: 24px;
    text-align: center;
    color: #9e9a96;
}

.pxl-empty-state i {
    font-size: 32px;
    color: #d4af37;
    opacity: 0.4;
}

.pxl-empty-state p {
    margin: 0;
    font-size: 13px;
}

.pxl-canvas-pane {
    position: relative;
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 440px;
    padding: 18px;
    overflow: auto;
    background-image:
        linear-gradient(45deg, rgba(232, 228, 220, 0.45) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(232, 228, 220, 0.45) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(232, 228, 220, 0.45) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(232, 228, 220, 0.45) 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.pxl-canvas-pane.show {
    display: flex;
}

.pxl-preview-tip {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(45, 42, 38, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    pointer-events: none;
}

.pxl-preview-tip.is-hidden {
    display: none;
}

.pxl-canvas {
    display: block;
    max-width: 100%;
    max-height: 560px;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 8px;
    background: transparent;
    cursor: default;
}

.pxl-canvas.is-draggable {
    cursor: grab;
    touch-action: none;
}

.pxl-canvas.is-dragging {
    cursor: grabbing;
}

.pxl-compare-container {
    display: none;
    grid-template-columns: 1fr 1px 1fr;
    gap: 0;
    min-height: 440px;
    overflow: hidden;
}

.pxl-compare-container.show {
    display: grid;
}

.pxl-compare-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-width: 0;
    background:
        linear-gradient(45deg, rgba(232, 228, 220, 0.42) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(232, 228, 220, 0.42) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(232, 228, 220, 0.42) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(232, 228, 220, 0.42) 75%),
        #faf9f7;
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.pxl-compare-side::before {
    content: attr(data-label);
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(45, 42, 38, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.pxl-compare-divider {
    width: 1px;
    background: #e8e4dc;
}

.pxl-compare-img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.pxl-palette-head,
.pxl-result-summary-head {
    align-items: flex-start;
}

.pxl-palette-note,
.pxl-summary-note {
    font-size: 11px;
    color: #7a756d;
    line-height: 1.4;
}

.pxl-palette-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.pxl-meta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f5f3ef;
    border: 1px solid #e8e4dc;
    font-size: 11px;
    font-weight: 600;
    color: #5f5a56;
}

.pxl-palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.pxl-palette-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #efe6c9;
    border-radius: 9px;
    background: linear-gradient(135deg, #fffdfa 0%, #faf6ec 100%);
}

.pxl-palette-swatch {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    border: 1px solid rgba(45, 42, 38, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.pxl-palette-card-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.pxl-palette-value {
    font-size: 11px;
    font-weight: 700;
    color: #2d2a26;
    line-height: 1.35;
    word-break: break-all;
}

.pxl-palette-ratio {
    font-size: 10px;
    color: #7a756d;
}

.pxl-palette-empty {
    grid-column: 1 / -1;
    padding: 12px;
    border: 1px dashed #e8e4dc;
    border-radius: 10px;
    background: #faf9f7;
    text-align: center;
    font-size: 12px;
    color: #9e9a96;
}

.pxl-palette-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0ece5;
}

.pxl-palette-actions-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pxl-palette-action-note {
    font-size: 11px;
    color: #7a756d;
    line-height: 1.4;
}

.pxl-result-summary {
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border: 1px solid #efe6c9;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.12);
    box-sizing: border-box;
}

.pxl-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.pxl-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #efe6c9;
    border-radius: 10px;
}

.pxl-summary-label {
    font-size: 11px;
    font-weight: 600;
    color: #7a756d;
}

.pxl-summary-value {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #2d2a26;
    letter-spacing: -0.02em;
    word-break: keep-all;
}

.pxl-summary-item.is-kpi .pxl-summary-value {
    font-size: 18px;
    color: #b58913;
}

.pxl-detail-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin-top: 8px;
}

.pxl-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pxl-detail-table th,
.pxl-detail-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0ece5;
    text-align: left;
    vertical-align: top;
}

.pxl-detail-table th {
    width: 34%;
    color: #5f5a56;
    font-weight: 600;
    background: #faf9f7;
}

.pxl-detail-table td {
    color: #2d2a26;
    font-weight: 500;
}

.pxl-detail-caption {
    margin: 8px 0 0;
    font-size: 12px;
    color: #7a756d;
    line-height: 1.45;
}

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

.tool-section .pxl-slider,
.tool-section .pxl-preset-btn,
.tool-section .pxl-choice-btn,
.tool-section .pxl-btn,
.tool-section .pxl-reset-btn,
.tool-section .pxl-compare-toggle,
.tool-section .pxl-toggle-chip {
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .pxl-editor-stack,
    .pxl-slider-compact-grid,
    .pxl-info-layout {
        grid-template-columns: 1fr;
    }

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

    .pxl-summary-grid,
    .pxl-palette-grid,
    .pxl-btn-group {
        grid-template-columns: 1fr 1fr;
    }

    .pxl-btn-group {
        display: grid;
    }

    .pxl-preview-header,
    .pxl-result-summary-head,
    .pxl-palette-head,
    .pxl-palette-actions-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .pxl-empty-state,
    .pxl-canvas-pane,
    .pxl-compare-container {
        min-height: 340px;
    }
}

@media (max-width: 640px) {
    .pxl-upload-panel,
    .pxl-editor-card,
    .pxl-input-section,
    .pxl-preview-section,
    .pxl-palette-section,
    .pxl-result-summary,
    .pxl-detail-section {
        padding: 16px;
    }

    .pxl-summary-grid,
    .pxl-btn-group {
        grid-template-columns: 1fr;
    }

    .pxl-btn-group {
        display: flex;
        flex-direction: column;
    }

    .pxl-preset-btn,
    .pxl-choice-btn,
    .pxl-toggle-chip {
        flex-basis: calc(50% - 6px);
    }

    .pxl-compare-container {
        grid-template-columns: 1fr;
    }

    .pxl-compare-divider {
        display: none;
    }

    .pxl-empty-state,
    .pxl-canvas-pane,
    .pxl-compare-container {
        min-height: 260px;
    }

    .pxl-summary-value {
        font-size: 14px;
    }

    .pxl-summary-item.is-kpi .pxl-summary-value {
        font-size: 17px;
    }

    .pxl-preview-tip {
        max-width: calc(100% - 24px);
        white-space: normal;
    }

    .pxl-detail-table th,
    .pxl-detail-table td {
        padding: 10px;
        font-size: 13px;
    }
}

@media (hover: none) {
    .pxl-btn:hover,
    .pxl-preset-btn:hover,
    .pxl-choice-btn:hover,
    .pxl-reset-btn:hover,
    .pxl-toggle-chip:hover,
    .pxl-compare-toggle:hover {
        transform: none;
        box-shadow: none;
    }
}
