/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 头部 */
header {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

header h1 {
    color: #333;
    font-size: 28px;
}

/* 操作栏 */
.toolbar {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-export {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.4);
}

.btn-import {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.btn-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 48, 49, 0.4);
}

.btn-stats {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
}

.btn-stats:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 分类标签栏 */
.category-tags {
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.category-label {
    font-weight: 500;
    color: #666;
    font-size: 15px;
    margin-right: 5px;
}

.category-tag {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-tag:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.category-tag.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 提醒框 */
.alert {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    color: #856404;
}

.alert.hidden {
    display: none;
}

/* 物品列表容器 */
.items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 物品卡片 */
.item-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.item-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-title h3 {
    font-size: 20px;
    color: #333;
}

.item-category {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 13px;
    color: #666;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: #74b9ff;
    color: white;
}

.btn-edit:hover {
    background: #0984e3;
}

.btn-delete {
    background: #ff7675;
    color: white;
}

.btn-delete:hover {
    background: #d63031;
}

/* 进度条容器 - 核心部分 */
.progress-container {
    margin-bottom: 15px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 14px;
    color: #666;
}

.progress-percentage {
    font-size: 16px;
    font-weight: 600;
}

/* 进度条背景 */
.progress-bar {
    width: 100%;
    height: 25px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* 进度条填充 - 带动画 */
.progress-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

/* 进度条颜色 - 根据剩余百分比 */
.progress-fill.safe {
    background: linear-gradient(90deg, #55efc4 0%, #00b894 100%);
}

.progress-fill.warning {
    background: linear-gradient(90deg, #fdcb6e 0%, #e17055 100%);
}

.progress-fill.danger {
    background: linear-gradient(90deg, #fd79a8 0%, #e84393 100%);
}

.progress-fill.expired {
    background: linear-gradient(90deg, #d63031 0%, #e17055 100%);
}

/* 物品详情 */
.item-details {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.item-notes {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
}

/* 空状态 */
.empty-state {
    background: white;
    padding: 60px 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.empty-state.hidden {
    display: none;
}

/* 分页控件 */
.pagination {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    border-color: #667eea;
    color: #667eea;
}

.page-number.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

.empty-state p:first-child {
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-state p:last-child {
    color: #999;
    font-size: 16px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    color: #333;
    font-size: 22px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

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

/* 表单样式 */
form {
    padding: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-divider {
    margin: 25px 0 20px 0;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.form-divider span {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.form-divider small {
    color: #666;
    font-size: 13px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 15px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .item-details {
        flex-direction: column;
        gap: 5px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================== 开封后保质期功能样式 ==================== */

/* 开封按钮样式 */
.btn-open {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-open:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3);
}

.btn-open:active {
    transform: translateY(0);
}

/* 快捷选择按钮 */
.quick-btn {
    font-size: 12px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 6px;
    margin-bottom: 6px;
    transition: all 0.2s;
    display: inline-block;
}

.quick-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quick-btn:active {
    transform: translateY(0);
}

/* ==================== 导入预览表格样式 ==================== */
.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 15px 0;
}

.import-preview-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 500;
}

.import-preview-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.import-preview-table tr:nth-child(even) {
    background: #f8f9fa;
}

.import-preview-table tr:hover {
    background: #e9ecef;
}

.import-error-msg {
    color: #d63031;
    font-size: 13px;
    margin-top: 10px;
    padding: 10px;
    background: #ffe5e5;
    border-radius: 8px;
    border-left: 4px solid #d63031;
}

.import-success-msg {
    color: #00b894;
    font-size: 13px;
    margin-top: 10px;
    padding: 10px;
    background: #e5fff9;
    border-radius: 8px;
    border-left: 4px solid #00b894;
}

/* ==================== 统计面板样式 ==================== */
.stats-panel {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.stats-panel h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 15px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-item.stat-safe {
    border-color: #00b894;
    background: linear-gradient(135deg, #e5fff9 0%, #f0fff9 100%);
}

.stat-item.stat-warning {
    border-color: #fdcb6e;
    background: linear-gradient(135deg, #fff9e5 0%, #fffef0 100%);
}

.stat-item.stat-expired {
    border-color: #d63031;
    background: linear-gradient(135deg, #ffe5e5 0%, #fff0f0 100%);
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.stat-percent {
    font-size: 14px;
    font-weight: 400;
    color: #999;
}

.stats-category h4 {
    color: #333;
    font-size: 16px;
    margin-bottom: 12px;
}

.category-stat-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.category-stat-label {
    min-width: 120px;
    font-size: 14px;
    color: #666;
}

.category-stat-bar {
    flex: 1;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 10px;
}

.category-stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.category-stat-value {
    min-width: 80px;
    text-align: right;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* ==================== 视图切换按钮样式 ==================== */
.view-toggle {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.view-btn {
    padding: 10px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.view-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.view-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ==================== 日历视图样式 ==================== */
.calendar-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    color: #333;
    font-size: 20px;
}

.calendar-nav-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.calendar-nav-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.calendar-day-header {
    text-align: center;
    padding: 10px;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.calendar-day:hover {
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.calendar-day.today {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.has-expired {
    background: #ffe5e5;
    border-color: #d63031;
}

.calendar-day.has-expired .calendar-day-number {
    color: #d63031;
    font-weight: 600;
}

.calendar-day-number {
    font-size: 16px;
    color: #333;
}

.calendar-day-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #d63031;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.calendar-details {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 100px;
}

.calendar-details h4 {
    color: #333;
    margin-bottom: 10px;
}

.calendar-details-empty {
    color: #999;
    text-align: center;
    padding: 20px;
}

.calendar-item {
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.calendar-item.expired {
    border-left-color: #d63031;
}

/* ==================== 批量删除对话框样式 ==================== */
.batch-delete-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #fff0f0;
    border-radius: 6px;
    border-left: 4px solid #d63031;
    color: #333;
}

/* ==================== 物品复选框样式 ==================== */
.item-checkbox-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.item-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.item-card {
    position: relative;
    padding-left: 50px !important;
}

/* ==================== 自定义对话框样式 ==================== */
#customAlert .modal-content,
#customConfirm .modal-content,
#customPrompt .modal-content {
    animation: slideDown 0.3s ease;
}

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

#alertMessage,
#confirmMessage {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

#confirmMessage {
    border-left-color: #fdcb6e;
}

.prompt-input:focus {
    outline: none;
    border-color: #00b894;
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}
