/* 学生查询样式 */
.student-container {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.student-container header {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    margin: 0;
    border-radius: 0;
}

#studentContent {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

/* 登录表单样式 */
.login-form {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    margin: 50px auto;
}

.login-form h2 {
    color: #007bff;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.login-form input {
    font-size: 1.2em;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.login-form button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
}

/* 学生信息面板样式 */
.student-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.info-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #007bff;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

.balance-display {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
}

.balance-amount {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.rank-display {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 1.2em;
    color: #6c757d;
}

/* 历史记录样式 */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.history-item.positive {
    border-left-color: #28a745;
}

.history-item.negative {
    border-left-color: #dc3545;
}

.history-info {
    flex: 1;
}

.history-reason {
    font-weight: bold;
    margin-bottom: 5px;
}

.history-time {
    font-size: 0.9em;
    color: #6c757d;
}

.history-points {
    font-size: 1.2em;
    font-weight: bold;
}

.history-points.positive {
    color: #28a745;
}

.history-points.negative {
    color: #dc3545;
}

/* 商品浏览样式 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.product-card-image.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
}

.no-image-icon {
    font-size: 3em;
    opacity: 0.4;
    filter: grayscale(1);
}

/* 商品图片放大预览 */
.product-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.product-image-lightbox {
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    cursor: default;
}

.product-image-lightbox img {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

.product-image-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #333;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: transform 0.2s;
}

.product-image-close:hover {
    transform: scale(1.1);
    background: #f0f0f0;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-name {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    font-size: 1.5em;
    color: #007bff;
    font-weight: bold;
    margin-bottom: 15px;
}

/* 名称 + 所需积分 同一行 */
.product-name-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.product-name-row .product-name {
    margin-bottom: 0;
}

.product-name-row .product-price {
    font-size: 1.1em;
    margin-bottom: 0;
}

/* 库存：跟在“兑换数量”同一行 */
.product-qty-row .product-stock {
    margin-bottom: 0;
    margin-left: 6px;
}

.product-stock {
    color: #6c757d;
    margin-bottom: 15px;
}

.reserve-btn {
    width: 100%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.reserve-btn:disabled {
    background: #6c757d;
}

/* 商品数量选择器 */
.product-qty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.qty-label {
    font-size: 0.9em;
    color: #666;
}

.qty-btn {
    width: 32px;
    height: 30px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: #f0f0f0;
    border-color: #28a745;
    color: #28a745;
}

.qty-value {
    font-size: 1.1em;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    color: #333;
}

/* 学生头部样式 */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.student-welcome h2 {
    color: #007bff;
    margin-bottom: 5px;
    font-size: 1.8em;
}

.student-welcome p {
    color: #6c757d;
    margin: 0;
    font-size: 1.1em;
}

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

.refresh-btn {
    background: #17a2b8;
    color: white;
}

.logout-btn {
    background: #6c757d;
    color: white;
}

/* 仪表板标签页样式 */
.dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #dee2e6;
    background: white;
    padding: 0 25px;
    border-radius: 15px 15px 0 0;
}

.dashboard-tabs .tab-button {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1.1em;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
}

.dashboard-tabs .tab-button:hover {
    color: #007bff;
    background: #eef3ff;
}

.dashboard-tabs .tab-button.active,
.dashboard-tabs .tab-button.active:hover {
    color: #ffffff;
    background: #007bff;
    border-bottom-color: #007bff;
    font-weight: bold;
}

.dashboard-content {
    display: none;
    background: white;
    border-radius: 0 0 15px 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dashboard-content.active {
    display: block;
}

/* 概览网格样式 */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.balance-card .balance-display {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 15px;
}

.balance-amount {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.balance-amount.negative {
    color: #ff6b6b;
}

.balance-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.balance-status {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    font-weight: bold;
}

.rank-card .rank-display {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 15px;
}

.rank-number {
    font-size: 2.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.rank-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.rank-status {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    font-weight: bold;
}

/* 最近记录样式 */
.recent-history {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.recent-reason {
    font-size: 0.95em;
    color: #495057;
}

.recent-points {
    font-weight: bold;
    font-size: 1em;
}

.recent-points.positive {
    color: #28a745;
}

.recent-points.negative {
    color: #dc3545;
}

.view-all-btn {
    width: 100%;
    background: #007bff;
    color: white;
    padding: 8px;
    font-size: 0.9em;
}

/* 统计信息样式 */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #6c757d;
}

/* 历史记录样式增强 */
.history-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h3 {
    margin: 0;
    color: #495057;
}

.history-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.history-type {
    font-size: 0.85em;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 5px;
}

/* 商品样式增强 */
/* ===== 兑换活动（限时折扣横幅 + 折后价）===== */
.campaign-banner {
    background: linear-gradient(135deg, #ff7a45 0%, #ff4d4f 100%);
    color: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.25);
}

.campaign-banner-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 16px;
    font-weight: bold;
}

.campaign-tag {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    font-weight: normal;
}

.campaign-discount {
    background: #fff;
    color: #ff4d4f;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 14px;
}

/* 每人每件限购标签（学生端活动横幅）*/
.campaign-limit-tag {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 13px;
}

.campaign-banner-sub {
    margin-top: 6px;
    font-size: 13px;
    opacity: 0.95;
}

.product-price-paid {
    color: #ff4d4f;
    font-weight: bold;
}

.product-price-del {
    margin-left: 6px;
    color: #999;
    font-size: 0.85em;
    text-decoration: line-through;
    font-weight: normal;
}

.order-price-orig {
    margin-left: 6px;
    color: #999;
    font-size: 0.9em;
}

/* 订单上的活动名（快照显示，活动删除/过期也保留）*/
.order-campaign {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 8px;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    color: #ff4d4f;
    font-size: 12px;
    line-height: 1.6;
}

.products-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.products-header h3 {
    margin: 0;
    color: #495057;
}

.products-info {
    font-size: 1.1em;
    color: #007bff;
    font-weight: bold;
}

.product-description {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 15px;
    line-height: 1.4;
}

.product-stock.out-of-stock {
    color: #dc3545;
    font-weight: bold;
}

/* 预约样式增强 */
.orders-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.orders-header h3 {
    margin: 0;
    color: #495057;
}

.orders-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
}

.order-product {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
    color: #495057;
}

.order-price {
    color: #007bff;
    font-weight: bold;
    margin-bottom: 8px;
}

.order-price-detail {
    margin-bottom: 8px;
    font-size: 1em;
}

.order-unit-price {
    color: #666;
}

.order-total-price {
    color: #dc3545;
    font-weight: bold;
    margin-left: 4px;
}

.order-time,
.order-confirmed,
.order-cancelled {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 3px;
}

.order-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.cancel-order-btn {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    font-size: 0.9em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.cancel-order-btn:hover {
    background: #c82333;
}

/* 登录表单增强 */
.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.login-tips {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.login-tips p {
    margin: 0;
    color: #0056b3;
    font-size: 0.95em;
}

/* 错误和无数据样式 */
.error {
    text-align: center;
    padding: 40px;
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: 15px;
    color: #721c24;
}

.error h3 {
    margin-bottom: 15px;
    font-size: 1.5em;
}

.error p {
    margin-bottom: 20px;
    font-size: 1.1em;
}

.retry-btn {
    background: #007bff;
    color: white;
    margin-right: 10px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
    font-size: 1.1em;
    background: #f8f9fa;
    border-radius: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .student-dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-tabs {
        flex-wrap: wrap;
        gap: 5px;
        padding: 0 15px;
    }
    
    .dashboard-tabs .tab-button {
        padding: 12px 15px;
        font-size: 1em;
    }
    
    .student-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .history-header,
    .products-header,
    .orders-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .order-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    #studentContent {
        padding: 20px;
    }
}

/* 修改密码按钮 */
.change-pwd-btn {
    background: #ffc107;
    color: #333;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
}

.change-pwd-btn:hover {
    background: #e0a800;
}

/* 模态框覆盖层 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8em;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
    font-size: 0.95em;
}

.modal-body .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.modal-body .form-group input:focus {
    border-color: #007bff;
    outline: none;
}

.form-tips {
    background: #e7f3ff;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    margin-top: 10px;
}

.form-tips p {
    margin: 0;
    color: #0056b3;
    font-size: 0.9em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 25px;
    border-top: 1px solid #dee2e6;
}

.modal-footer .btn-cancel {
    padding: 10px 25px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.modal-footer .btn-cancel:hover {
    background: #f8f9fa;
    border-color: #c8ccd0;
}

.modal-footer .btn-confirm {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    color: white;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.modal-footer .btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}