/* ========== 礼物兑换弹窗样式 ========== */
/* 从 modals-food.css 拆分 v3.5 */

/* 礼物弹窗内容区 - 覆盖通用样式 */
#giftMgmtModal .gift-mgmt-modal-content {
    width: 1100px;
    max-width: 95%;
    max-height: 95vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

/* 礼物弹窗body区 - 覆盖通用样式 */
#giftMgmtModal .modal-body {
    max-height: none !important;
    overflow: hidden !important;
    padding-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 礼物标签内容区 */
#giftMgmtModal .gift-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#giftMgmtModal .gift-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* 礼物标签切换 */
.gift-tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.gift-tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

.gift-tab-btn:hover {
    color: var(--theme-color);
    background: rgba(211, 91, 126, 0.05);
}

.gift-tab-btn.active {
    color: var(--theme-color);
    background: rgba(211, 91, 126, 0.1);
    border-bottom: 2px solid var(--theme-color);
    margin-bottom: -12px;
}

/* 礼物标签内容 */
.gift-tab-content {
    display: none;
}

.gift-tab-content.active {
    display: block;
}

/* 礼物列表容器 - 改为网格布局，一行5个 */
#giftMgmtModal .gift-list-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    flex: 1;
    min-height: 400px;
    max-height: calc(95vh - 180px);
    overflow-y: scroll !important;
    overflow-x: hidden;
    padding: 10px 15px 10px 10px;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f0f0f0;
    /* 防止卡片被拉长 - 内容顶部对齐 */
    align-content: start;
}

/* 礼物列表滚动条样式 - Webkit浏览器 */
#giftMgmtModal .gift-list-container::-webkit-scrollbar {
    width: 10px !important;
    display: block !important;
}

#giftMgmtModal .gift-list-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 5px;
}

#giftMgmtModal .gift-list-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
    min-height: 40px;
}

#giftMgmtModal .gift-list-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.gift-list-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    grid-column: 1 / -1;
}

.gift-list-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* 礼物卡片 - 竖向排列布局 */
.gift-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    min-height: 220px;
    /* 不设置固定高度，让内容自适应 */
}

/* 奖励卡片分类背景色 */
.gift-card.category-study {
    background: rgba(250, 211, 84, 0.15); /* 学习工具 #fad354 15% */
}

.gift-card.category-food {
    background: rgba(246, 182, 195, 0.15); /* 甜品饮品 #f6b6c3 15% */
}

.gift-card.category-toy {
    background: rgba(119, 140, 204, 0.10); /* 惊喜礼物 #778ccc 10% */
}

.gift-card.category-others {
    background: rgba(182, 227, 231, 0.15); /* 其他奖励 #b6e3e7 15% */
}

.gift-card:hover {
    border-color: var(--theme-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* 修改按钮 - 左上角 */
.gift-card-edit-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(25, 118, 210, 0.1);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #1976d2;
    z-index: 2;
}

.gift-card-edit-btn:hover {
    background: #e3f2fd;
    transform: scale(1.1);
}

/* 徽章数 - 右上角 */
.gift-card-badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: color-mix(in srgb, var(--theme-color) 85%, #000);
    font-weight: 600;
    background: rgba(211, 91, 126, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 2;
}

.gift-card-badges .badge-icon {
    width: 16px;
    height: 16px;
}

/* 礼物图标 - 上方居中 */
.gift-card-icon {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    margin-top: 25px;
    margin-bottom: 10px;
}

.gift-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: breatheStrong 3s ease-in-out infinite;
}

/* 礼物信息 - 中间 */
.gift-card-info {
    flex: 1;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gift-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.gift-card-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-height: 18px;
}

/* 库存显示 */
.gift-card-stock {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.gift-card-stock .stock-label {
    color: #999;
}

.gift-card-stock .stock-value {
    font-weight: 600;
    color: #333;
}

/* 兑换按钮 - 最下方 */
.gift-card-exchange-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 10px 15px;
    background: var(--theme-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.gift-card-exchange-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gift-card-exchange-btn .exchange-icon {
    width: 18px;
    height: 18px;
}

/* 兑换按钮中的礼物图标包装器 */
.gift-card-exchange-btn .exchange-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    font-size: 14px;
    line-height: 1;
}

/* 隐藏旧的操作按钮区域 */
.gift-card-actions {
    display: none;
}

/* 添加礼物表单 */
.add-gift-form {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.add-gift-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.add-gift-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-gift-numbers {
    display: flex;
    gap: 15px;
}

.form-group-inline {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group-inline label {
    font-size: 12px;
    color: #666;
}

.form-group-inline .form-control {
    width: 100%;
}

/* 修改礼物表单 */
.edit-gift-form {
    padding: 10px;
}

.edit-gift-row {
    display: flex;
    gap: 15px;
}

.edit-gift-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-gift-numbers {
    display: flex;
    gap: 15px;
}

/* 修改礼物弹窗底部布局 */
#editGiftModal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#editGiftModal .modal-footer-right {
    display: flex;
    gap: 10px;
}

/* 删除按钮样式 */
.btn-danger {
    background-color: #e53935;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background-color: #c62828;
    transform: scale(1.02);
}

/* ========== 奖励图标选择弹窗样式 ========== */

/* 奖励图标选择弹窗内容区 */
.gift-icon-select-modal-content {
    width: 620px;
    max-width: 95%;
}

/* 奖励图标分类标签容器 */
.gift-icon-category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

/* 奖励图标分类标签 */
.gift-icon-category-tab {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: #fff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.gift-icon-category-tab:hover {
    border-color: #999;
    transform: translateY(-2px);
}

.gift-icon-category-tab.active {
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* 礼物图标选择网格 - 一行5个，100px x 100px */
.gift-icon-select-grid {
    display: grid;
    grid-template-columns: repeat(5, 100px);
    gap: 15px;
    justify-content: center;
    padding: 10px 0;
}

.gift-icon-select-item {
    width: 100px;
    height: 100px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 10px;
    background: #fff;
}

.gift-icon-select-item:hover {
    border-color: var(--theme-color);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gift-icon-select-item.selected {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px var(--theme-color);
    background: rgba(211, 91, 126, 0.05);
}

.gift-icon-select-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 兑换记录容器 */
.exchange-records-container {
    max-height: 400px;
    overflow-y: auto;
}

.records-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.records-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* 兑换记录项 */
.exchange-record-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.exchange-record-item .record-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.exchange-record-item .record-student {
    font-weight: 600;
    color: var(--theme-color);
}

.exchange-record-item .record-text {
    color: #666;
}

.exchange-record-item .record-gift {
    font-weight: 600;
    color: #333;
}

.exchange-record-item .record-badges {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #e53935;
    font-weight: 500;
}

.exchange-record-item .record-badges .badge-icon-small {
    width: 16px;
    height: 16px;
}

.exchange-record-item .record-time {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}


/* ========== 兑换学生选择弹窗样式 ========== */

#exchangeStudentModal .exchange-student-modal-content {
    width: 500px;
    max-width: 95%;
}

.exchange-student-list {
    max-height: 400px;
    overflow-y: auto;
}

.exchange-list-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.exchange-student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.exchange-student-item:hover {
    border-color: var(--theme-color);
}

.exchange-student-item.eligible {
    background: #fff;
}

.exchange-student-item.ineligible {
    background: #f5f5f5;
    opacity: 0.7;
}

.exchange-student-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.exchange-student-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.exchange-student-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--theme-color);
}

.exchange-student-badges .badge-icon-small {
    width: 16px;
    height: 16px;
}

.exchange-student-right {
    display: flex;
    align-items: center;
}

.btn-do-exchange {
    padding: 8px 16px;
    background: var(--theme-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-do-exchange:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.exchange-ineligible-tip {
    font-size: 12px;
    color: #999;
    padding: 8px 12px;
    background: #eee;
    border-radius: 6px;
}


/* ========== 兑换成功动画样式 ========== */

.exchange-success-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.exchange-success-container.show {
    opacity: 1;
}

.exchange-success-text {
    font-size: 28px;
    font-weight: bold;
    color: #d4a574;
    text-shadow: 2px 2px 8px rgba(139, 90, 43, 0.6), 0 0 20px rgba(255, 215, 0, 0.5);
    animation: textPopIn 0.5s ease-out forwards;
    white-space: nowrap;
}

.exchange-fireworks {
    z-index: 9999;
}


/* ========== 学生奖励列表弹窗样式 ========== */

#studentGiftsModal .modal-content {
    width: 450px;
    max-width: 95%;
}

/* 学生奖励列表容器 */
.student-gifts-list {
    max-height: 400px;
    overflow-y: auto;
}

/* 空状态 */
.student-gifts-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.student-gifts-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.student-gifts-empty p {
    font-size: 14px;
}

/* 奖励统计摘要 */
.student-gifts-summary {
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.student-gifts-summary strong {
    color: var(--theme-color);
    font-size: 18px;
}

/* 奖励网格 */
.student-gifts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* 单个奖励项 */
.student-gift-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.student-gift-item:hover {
    border-color: var(--theme-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 奖励图标 */
.student-gift-item .gift-item-icon {
    width: 45px;
    height: 45px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 奖励信息 */
.student-gift-item .gift-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.student-gift-item .gift-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-gift-item .gift-item-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--theme-color);
}


/* ========== 礼物弹窗响应式 ========== */

/* 大屏幕（1200px以上）：一行5个 */
@media (min-width: 1200px) {
    .gift-list-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* 中等屏幕（900px-1199px）：一行4个 */
@media (min-width: 900px) and (max-width: 1199px) {
    #giftMgmtModal .gift-mgmt-modal-content {
        width: 900px;
    }
    
    .gift-list-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 小屏幕（600px-899px）：一行3个 */
@media (min-width: 600px) and (max-width: 899px) {
    #giftMgmtModal .gift-mgmt-modal-content {
        width: 700px;
    }
    
    .gift-list-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 更小屏幕（480px-599px）：一行2个 */
@media (min-width: 480px) and (max-width: 599px) {
    #giftMgmtModal .gift-mgmt-modal-content {
        width: 95%;
    }
    
    .gift-list-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .gift-card {
        min-height: 200px;
        padding: 12px 10px;
    }
    
    .gift-card-icon {
        width: 60px;
        height: 60px;
    }
    
    .gift-card-exchange-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 手机屏幕（480px以下）：一行2个 */
@media (max-width: 479px) {
    #giftMgmtModal .gift-mgmt-modal-content {
        width: 95%;
    }
    
    .gift-tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .gift-list-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-height: 400px;
    }
    
    .gift-card {
        min-height: 180px;
        padding: 10px 8px;
    }
    
    .gift-card-edit-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: 5px;
        left: 5px;
    }
    
    .gift-card-badges {
        font-size: 11px;
        padding: 3px 6px;
        top: 5px;
        right: 5px;
    }
    
    .gift-card-badges .badge-icon {
        width: 14px;
        height: 14px;
    }
    
    .gift-card-icon {
        width: 50px;
        height: 50px;
        margin-top: 20px;
    }
    
    .gift-card-name {
        font-size: 13px;
    }
    
    .gift-card-desc {
        font-size: 11px;
    }
    
    .gift-card-stock {
        font-size: 11px;
    }
    
    .gift-card-exchange-btn {
        padding: 8px 10px;
        font-size: 12px;
        gap: 4px;
    }
    
    .gift-card-exchange-btn .exchange-icon {
        width: 14px;
        height: 14px;
    }
    
    .add-gift-row {
        flex-direction: column;
    }
    
    .add-gift-numbers {
        flex-direction: column;
    }
    
    .edit-gift-row {
        flex-direction: column;
    }
    
    .edit-gift-numbers {
        flex-direction: column;
    }
    
    #editGiftModal .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    #editGiftModal .modal-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn-danger {
        width: 100%;
    }
    
    .gift-icon-select-item {
        width: 50px;
        height: 50px;
    }
    
    #exchangeStudentModal .exchange-student-modal-content {
        width: 95%;
    }
    
    .exchange-student-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .exchange-student-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    #studentGiftsModal .modal-content {
        width: 95%;
    }
    
    .student-gifts-grid {
        grid-template-columns: 1fr;
    }
    
    .student-gift-item .gift-item-icon {
        width: 40px;
        height: 40px;
    }
}
