/* 组件样式 - 按钮、输入框等通用组件 */

/* 操作按钮 */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
    margin-top: 8px;
}

.action-btn {
    padding: 13px 16px;
    background: linear-gradient(135deg, var(--color-primary, #e91e63), var(--color-primary-light, #f48fb1));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

/* 只在支持 hover 的设备上应用 hover 效果 */
@media (hover: hover) {
    .action-btn:hover::before {
        width: 300px;
        height: 300px;
    }

    .action-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(233, 30, 99, 0.35);
    }
}

.action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
    background: linear-gradient(135deg, var(--color-primary-dark, #c2185b), var(--color-primary, #e91e63));
    opacity: 0.9;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.action-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25);
}

/* ========== 空间合并控制样式 ========== */

.merge-control {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 直观的网格布局 */
.merge-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.merge-grid-top,
.merge-grid-bottom {
    display: flex;
    justify-content: center;
    width: 100%;
}

.merge-grid-middle {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
}

/* 合并按钮基础样式 */
.merge-btn {
    border: 2px dashed var(--color-primary, #e91e63);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    color: var(--color-primary, #e91e63);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 横向合并按钮 */
.merge-btn-horizontal {
    width: 45%;
    max-width: 120px;
    height: 32px;
    padding: 4px 16px;
}

/* 纵向合并按钮 */
.merge-btn-vertical {
    width: 32px;
    height: 55px;
    padding: 8px 2px;
    line-height: 1.2;
}

.merge-text {
    text-align: center;
}

.merge-btn:hover {
    background: rgba(233, 30, 99, 0.1);
    border-style: solid;
}

.merge-btn:active {
    transform: scale(0.95);
}

.merge-btn.merged {
    background: var(--color-primary, #e91e63);
    color: white;
    border-style: solid;
}

.merge-btn.merged:hover {
    background: var(--color-primary-dark, #c2185b);
}

.merge-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
}

.merge-btn:disabled:hover {
    background: transparent;
    border-style: dashed;
}

/* 吸附控制 */
.snap-control {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.snap-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.snap-toggle-btn:hover {
    border-color: #e91e63;
    color: #e91e63;
}

.snap-toggle-btn.active {
    border-color: #e91e63;
    background: linear-gradient(135deg, #e91e63, #f06292);
    color: white;
}

.snap-toggle-btn .snap-icon {
    font-size: 14px;
}

/* 已合并列表 */
.merged-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(233, 30, 99, 0.05);
    border-radius: 8px;
    min-height: 32px;
}

.no-merge-hint {
    font-size: 12px;
    color: #999;
    text-align: center;
    padding: 4px 0;
}

.merged-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.merged-info {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.unmerge-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ff4444;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unmerge-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.unmerge-btn:active {
    transform: scale(0.9);
}