/* 红包封面管理页面专属样式 */

.container-fluid {
    padding: 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    color: #333;
    text-shadow: none;
    font-size: 1.8rem;
}

.btn-back {
    text-decoration: none;
    color: #667eea;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-back:hover {
    transform: translateX(-5px);
}

.header-right {
    display: flex;
    gap: 10px;
}

/* 工具栏 */
.toolbar {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-presets {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.color-dot:hover {
    transform: scale(1.2);
    border-color: #667eea;
}

.color-dot.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

#cellColorPicker {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.tool-tip {
    font-size: 0.9rem;
    color: #888;
}

/* 网格样式 */
.grid-wrapper {
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: auto;
    max-height: calc(100vh - 200px);
}

#packetGrid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定布局，方便图片显示 */
    min-width: 800px;
}

#packetGrid th, #packetGrid td {
    border: 1px solid #eee;
    padding: 10px;
    min-width: 150px;
    height: 100px;
    vertical-align: top;
    position: relative;
    transition: background-color 0.2s;
}

/* 单元格操作按钮容器 */
.cell-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

#packetGrid td:hover .cell-actions,
#packetGrid th:hover .cell-actions {
    opacity: 1;
}

/* 单元格操作按钮基础样式 */
.cell-action-btn {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.cell-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.cell-action-btn:active {
    transform: scale(0.9);
}

/* 具体的复制按钮保持原有类名以防 JS 引用，但继承基础样式 */
.cell-copy-btn {
    /* 继承 .cell-action-btn 的逻辑在 JS 中处理 */
}

/* 表头样式 */
#packetGrid th {
    background: #f8f9fa;
    color: #666;
    font-weight: 600;
    cursor: grab;
    user-select: none;
}

#packetGrid th:active {
    cursor: grabbing;
}

#packetGrid th.corner-cell {
    width: 50px;
    min-width: 50px;
    cursor: default;
    background: #eee;
}

/* 单元格内容 */
.cell-content {
    width: 100%;
    height: 100%;
    min-height: 80px;
    outline: none;
    word-break: break-all;
    overflow-y: auto;
}

.cell-content img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin-top: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 拖拽反馈 */
.drag-over-row {
    border-top: 3px solid #667eea !important;
}

.drag-over-col {
    border-left: 3px solid #667eea !important;
}

.dragging {
    opacity: 0.5;
    background: #e8eaf6 !important;
}

/* 单元格选中效果 */
.cell-focused {
    box-shadow: inset 0 0 0 2px #667eea;
}

/* 行操作按钮 */
.row-header {
    width: 50px;
    text-align: center;
    background: #f8f9fa;
    font-weight: bold;
    color: #999;
}

/* Toast 提示 */
.toast-msg {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    .header-right {
        width: 100%;
        justify-content: center;
    }
}