/* ================================================================
   菜刀客在线工具页 · favicon-maker.html 私有样式
   需在 /css/common.css 之后加载。
   ================================================================ */

/* ---- 裁切选区 ---- */
.crop-wrap {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
}

.crop-wrap img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    margin: 0 auto;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.crop-rect {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4000px rgba(15, 23, 42, 0.55);
    cursor: move;
    touch-action: none;
}

.crop-h {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid #fff;
    border-radius: 2px;
    box-sizing: border-box;
    z-index: 6;
}

.ch-nw { left: -7px; top: -7px; cursor: nw-resize; }
.ch-n  { left: 50%; top: -7px; margin-left: -6px; cursor: n-resize; }
.ch-ne { right: -7px; top: -7px; cursor: ne-resize; }
.ch-e  { right: -7px; top: 50%; margin-top: -6px; cursor: e-resize; }
.ch-se { right: -7px; bottom: -7px; cursor: se-resize; }
.ch-s  { left: 50%; bottom: -7px; margin-left: -6px; cursor: s-resize; }
.ch-sw { left: -7px; bottom: -7px; cursor: sw-resize; }
.ch-w  { left: -7px; top: 50%; margin-top: -6px; cursor: w-resize; }

.crop-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.crop-actions .btn {
    padding: 5px 10px;
    font-size: 12px;
}

.crop-info {
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
}

.check-inline input[type="checkbox"] {
    accent-color: #667eea;
    cursor: pointer;
}

/* ---- 上传区 ---- */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #eef2ff;
}

.upload-area .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-area .upload-text {
    color: #6b7280;
    font-size: 14px;
}

.upload-area .upload-text strong {
    color: #667eea;
}

.upload-area .upload-tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

/* ---- 文件信息卡片 ---- */
.info-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.info-card .thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fff;
}

.info-card .meta {
    flex: 1;
    min-width: 0;
}

.info-card .name {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-card .dims {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.btn-remove {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.btn-remove:hover {
    color: #dc2626;
}

/* ---- 尺寸预设与勾选 ---- */
.size-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.size-quick .btn {
    flex: 1 1 0;
    padding: 8px 10px;
    font-size: 12px;
    justify-content: center;
    text-align: center;
    color: #fff;
    border: none;
}

.size-quick .btn:nth-child(1) {
    background: linear-gradient(135deg, #06b6d4, #0284c7);
}

.size-quick .btn:nth-child(2) {
    background: linear-gradient(135deg, #10b981, #059669);
}

.size-quick .btn:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.size-quick .btn:hover {
    filter: brightness(1.08);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
}

.check-item input[type="checkbox"] {
    accent-color: #667eea;
    cursor: pointer;
}

.check-item:has(input:checked) {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 500;
}

.tip {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
    margin-top: 6px;
}

/* ---- 背景行 ---- */
.bg-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.radio-group {
    display: flex;
    gap: 6px;
}

.radio-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.radio-card input[type="radio"] {
    accent-color: #667eea;
    cursor: pointer;
}

.radio-card:has(input:checked) {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 500;
}

.bg-t {
    flex: 0 0 auto;
    min-width: 72px;
}

.flex-1 {
    flex: 1;
}

.color-picker {
    width: 100%;
    height: 38px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* ---- 预览网格 ---- */
#grpCrop + .ico-preview {
    margin-top: 14px;
}

.ico-preview {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 棋盘格底，便于观察透明背景 */
    background: #f2f3f5;
    background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
                      linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
}

.ico-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.ico-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ico-tile img {
    image-rendering: pixelated;
    display: block;
}

.ico-cap {
    font-size: 11px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.tip-row {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin-top: 10px;
}

/* ---- 右侧下载按钮：彩色背景 ---- */
#btnPng {
    background: linear-gradient(135deg, #84c5ff, #4a90e2);
    color: #fff;
    border: none;
}

#btnPng:hover:not(:disabled) {
    filter: brightness(1.08);
}

#btnPng,
#btnIco {
    transition: filter 0.2s;
}

#btnPng:disabled,
#btnIco:disabled {
    background: #e5e7eb;
    color: #9ca3af;
}

@media (max-width: 600px) {
    .check-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .radio-group {
        flex-wrap: wrap;
    }
}