/* Style-Cabinet.css - 场景物品管理页面样式 */

body {
    background: #f8f9fa;
    font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* 确保所有元素都没有意外的 margin 和 padding */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #2c3e50, #2980b9);
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.header-title {
    font-size: 22px;
    font-weight: 600;
    margin-left: 10px;
}

.main-content {
    margin-top: 70px;
    padding: 20px;
    min-height: 80vh;
}

/* D_Page 页面不需要顶部导航栏的 margin */
body.cabinet-detail-page .main-content {
    margin-top: 0;
}

.cabinet-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.cabinet-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.2s;
    padding: 18px 12px 12px 12px;
}

.cabinet-card:hover {
    box-shadow: 0 4px 16px rgba(41, 128, 185, 0.15);
}

.cabinet-image img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
    background: #f4f6fa;
    margin-bottom: 10px;
}

.cabinet-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2c3e50;
}

.cabinet-info p {
    margin: 2px 0;
    color: #6c757d;
    font-size: 14px;
}

.cabinet-detail-btn {
    margin-top: 10px;
    padding: 8px 18px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.cabinet-detail-btn:hover {
    background: #2980b9;
}

.cabinet-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.cabinet-back-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.cabinet-back-btn:hover {
    background: #eaf6fb;
}

/* 场景页面头部样式 */
.scene-header {
    background: linear-gradient(135deg, #2c3e50, #2980b9);
    color: white;
    padding: 20px;
    margin: -20px -20px 20px -20px;
    border-radius: 0 0 10px 10px;
    position: relative;
    z-index: 10;
}

.scene-title {
    font-size: 24px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.scene-description {
    opacity: 0.9;
    margin: 0;
    font-size: 14px;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 物品网格和卡片样式 - 统一命名 */
.cabinet-items-grid,
.item-detail-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 大屏5列 */
    gap: 18px;
}

.cabinet-item-card,
.item-detail-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(41, 128, 185, 0.10), 0 1.5px 6px rgba(44, 62, 80, 0.06);
    padding: 18px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.35s cubic-bezier(.4, 2, .3, 1), transform 0.25s cubic-bezier(.4, 2, .3, 1), filter 0.25s;
    position: relative;
    will-change: transform, box-shadow, filter;
    min-height: 200px;
}

.cabinet-item-card:hover,
.item-detail-card:hover {
    box-shadow: 0 12px 36px 0 rgba(41, 128, 185, 0.18), 0 4px 24px rgba(44, 62, 80, 0.12);
    transform: translateY(-8px) scale(1.045) rotateZ(-0.5deg);
    filter: brightness(1.04) drop-shadow(0 0 8px #3498db33);
    z-index: 2;
}

/* 动画效果更流畅 */
.cabinet-item-card,
.item-detail-card {
    transition: box-shadow 0.35s cubic-bezier(.4, 2, .3, 1), transform 0.25s cubic-bezier(.4, 2, .3, 1), filter 0.25s;
}

.cabinet-item-image img,
.item-detail-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #f4f6fa;
    margin-bottom: 8px;
    padding: 8px;
}

.cabinet-item-info h4,
.item-detail-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
    text-align: center;
    font-weight: 600;
}

.cabinet-item-info p,
.item-detail-info p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 13px;
    text-align: center;
    line-height: 1.4;
}

/* 新增：卡片操作按钮 */
.card-actions {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.item-detail-card:hover .card-actions {
    opacity: 1;
    pointer-events: auto;
}

.action-btn {
    background-color: rgba(44, 62, 80, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
    background-color: rgba(44, 62, 80, 1);
    transform: scale(1.1);
}

/* 新增：数量控制 */
.item-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 6px 0;
}

.item-quantity-input {
    width: 40px;
    text-align: center;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 4px;
}

.quantity-decrease,
.quantity-increase {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #e9ecef;
    color: #2c3e50;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.quantity-decrease:hover,
.quantity-increase:hover {
    background: #3498db;
    color: white;
}

/* 新增：浮动添加按钮 */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #3498db;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1001;
}

.fab:hover {
    transform: scale(1.1);
    background: #2980b9;
}

/* 新增：模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.close-button {
    float: right;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    border: none;
    background: none;
}

.close-button:hover {
    color: #343a40;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 移动端优化 */
@media (max-width: 1200px) {

    .cabinet-items-grid,
    .item-detail-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {

    .cabinet-items-grid,
    .item-detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-top: 60px;
        padding: 10px;
    }

    body.cabinet-detail-page .main-content {
        margin-top: 0;
    }

    .cabinet-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cabinet-items-grid,
    .item-detail-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cabinet-card,
    .cabinet-item-card,
    .item-detail-card {
        padding: 10px;
    }

    .cabinet-image img,
    .cabinet-item-image img,
    .item-detail-image {
        width: 60px;
        height: 60px;
    }

    .fab {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {

    .cabinet-list,
    .cabinet-items-grid,
    .item-detail-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cabinet-card,
    .cabinet-item-card,
    .item-detail-card {
        padding: 8px;
    }

    .cabinet-image img,
    .cabinet-item-image img,
    .item-detail-image {
        width: 44px;
        height: 44px;
    }

    .header-title {
        font-size: 16px;
    }

    .fab {
        width: 45px;
        height: 45px;
        font-size: 18px;
        bottom: 15px;
        right: 15px;
    }

    .modal-content {
        padding: 15px;
        width: 95%;
    }
}

/* 加载动画样式 */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-container p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* 无物品提示样式 */
.no-items {
    text-align: center;
    color: #666;
    font-size: 16px;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

/* 无柜子提示样式 */
.no-cabinets {
    text-align: center;
    color: #666;
    font-size: 16px;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

/* 物品操作按钮样式 */
.item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.item-actions button {
    flex: 1;
    min-width: 60px;
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-borrow {
    background-color: #4CAF50;
    color: white;
}

.btn-borrow:hover {
    background-color: #45a049;
}

.btn-return {
    background-color: #2196F3;
    color: white;
}

.btn-return:hover {
    background-color: #1976D2;
}

.btn-records {
    background-color: #FF9800;
    color: white;
}

.btn-records:hover {
    background-color: #F57C00;
}

/* 使用记录模态框样式 */
.records-content {
    max-height: 400px;
    overflow-y: auto;
}

.records-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.records-header h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 18px;
}

.records-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid;
    background-color: #f9f9f9;
}

.record-borrow {
    border-left-color: #4CAF50;
    background-color: #f1f8e9;
}

.record-return {
    border-left-color: #2196F3;
    background-color: #e3f2fd;
}

.record-type {
    font-weight: bold;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.record-borrow .record-type {
    background-color: #4CAF50;
    color: white;
}

.record-return .record-type {
    background-color: #2196F3;
    color: white;
}

.record-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-user {
    font-weight: bold;
    color: #333;
}

.record-quantity {
    color: #666;
    font-size: 14px;
}

.record-time {
    color: #999;
    font-size: 12px;
}

.no-records {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

/* 大模态框样式 */
.modal-content.large {
    max-width: 600px;
    width: 90%;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .item-actions {
        flex-direction: column;
        gap: 6px;
    }

    .item-actions button {
        width: 100%;
        padding: 8px;
        font-size: 13px;
    }

    .record-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .record-type {
        align-self: flex-start;
    }

    .modal-content.large {
        width: 95%;
        margin: 20px auto;
    }
}