/* ==================== SVG图标按钮样式 ==================== */

/* SVG图标基础样式 */
.icon-svg {
    width: 1em;
    height: 1em;
    display: inline-block;
    fill: currentColor;
    vertical-align: middle;
    flex-shrink: 0;
}

/* 纯图标按钮 */
.btn-icon-only {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
    background: rgba(0, 123, 255, 0.15);
    border: none;
    color: #007bff;
    cursor: pointer;
}

.btn-icon-only .icon-svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(0, 123, 255, 0.25);
    color: #0056b3;
}

.btn-icon-only:hover .icon-svg {
    transform: scale(1.1);
}

.btn-icon-only:active {
    transform: scale(0.95);
    background: rgba(0, 123, 255, 0.35);
}

/* 图标+文字按钮 */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    color: #007bff;
}

.btn-with-icon .icon-svg {
    width: 16px;
    height: 16px;
    transition: all 0.2s ease;
}

.btn-with-icon:hover .icon-svg {
    transform: scale(1.1);
}

/* 小图标按钮 */
.btn-icon-small {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.btn-icon-small .icon-svg {
    width: 14px;
    height: 14px;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    background: rgba(0, 123, 255, 0.25);
    color: #0056b3;
}

.btn-icon-small:hover .icon-svg {
    transform: scale(1.1);
}

.btn-icon-small:active {
    transform: scale(0.95);
    background: rgba(0, 123, 255, 0.35);
}

/* 小图标按钮颜色变体 */
.btn-icon-small.btn-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #495057;
}

.btn-icon-small.btn-secondary:hover {
    background: rgba(108, 117, 125, 0.25);
    color: #343a40;
}

.btn-icon-small.btn-primary {
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.btn-icon-small.btn-primary:hover {
    background: rgba(0, 123, 255, 0.25);
    color: #0056b3;
}

.btn-icon-small.btn-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #bd2130;
}

.btn-icon-small.btn-danger:hover {
    background: rgba(220, 53, 69, 0.25);
    color: #a71d2a;
}

.btn-icon-small.btn-success {
    background: rgba(40, 167, 69, 0.15);
    color: #1e7e34;
}

.btn-icon-small.btn-success:hover {
    background: rgba(40, 167, 69, 0.25);
    color: #155724;
}

/* 纯图标按钮颜色变体 */
.btn-icon-only.btn-primary {
    background: rgba(0, 123, 255, 0.2);
    color: #007bff;
}

.btn-icon-only.btn-primary:hover {
    background: rgba(0, 123, 255, 0.3);
    color: #0056b3;
}

.btn-icon-only.btn-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #495057;
}

.btn-icon-only.btn-secondary:hover {
    background: rgba(108, 117, 125, 0.25);
    color: #343a40;
}

.btn-icon-only.btn-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #bd2130;
}

.btn-icon-only.btn-danger:hover {
    background: rgba(220, 53, 69, 0.25);
    color: #a71d2a;
}

.btn-icon-only.btn-success {
    background: rgba(40, 167, 69, 0.15);
    color: #1e7e34;
}

.btn-icon-only.btn-success:hover {
    background: rgba(40, 167, 69, 0.25);
    color: #155724;
}

/* Tooltip提示 */
.btn-icon-only[title]:hover::after,
.btn-icon-small[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 按钮组样式 */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

/* 表格中的按钮组 */
table td .btn-group {
    display: inline-flex;
    gap: 0.3rem;
}

/* 订单操作按钮组 */
.order-item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .btn-icon-only {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .btn-icon-only .icon-svg {
        width: 16px;
        height: 16px;
    }
    
    .btn-icon-small {
        width: 26px;
        height: 26px;
        min-width: 26px;
    }
    
    .btn-icon-small .icon-svg {
        width: 13px;
        height: 13px;
    }
    
    .btn-with-icon {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* 移动端隐藏tooltip，避免遮挡 */
    .btn-icon-only[title]:hover::after,
    .btn-icon-small[title]:hover::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .btn-icon-only {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }
    
    .btn-icon-only .icon-svg {
        width: 15px;
        height: 15px;
    }
    
    .btn-icon-small {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }
    
    .btn-icon-small .icon-svg {
        width: 12px;
        height: 12px;
    }
    
    .btn-with-icon {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
        gap: 0.3rem;
    }
}


/* 确保按钮内的图标继承按钮颜色 */
.btn-primary .icon-svg,
.btn-success .icon-svg {
    fill: white;
}

.btn-with-icon.btn-primary,
.btn-with-icon.btn-success {
    color: white;
}

/* 图标按钮使用淡色背景和彩色图标 */
.btn-icon-only.btn-primary .icon-svg,
.btn-icon-small.btn-primary .icon-svg {
    fill: #007bff;
}

.btn-icon-only.btn-danger .icon-svg,
.btn-icon-small.btn-danger .icon-svg {
    fill: #dc3545;
}

/* 状态图标样式 */
.status-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-icon .icon-svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* 图标占位符样式 */
.icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.icon-svg-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-svg-container .icon-svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
