/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
    background: #f5f5f5;
}

/* 登录页面样式 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

/*.form-group label {*/
/*    display: block;*/
/*    margin-bottom: 8px;*/
/*    color: #666;*/
/*}*/

/*.form-input {*/
/*    width: 100%;*/
/*    padding: 12px;*/
/*    border: 1px solid #ddd;*/
/*    border-radius: 5px;*/
/*    font-size: 14px;*/
/*}*/

.form-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.form-group label {
    width: 40px; /* 设置固定宽度以保持对齐 */
    text-align: right; /* 右对齐文本 */
    margin-right: 10px; /* 标签与输入框之间的间距 */
    color: #666;
}

.form-input {
    flex: 1; /* 让输入框占据剩余的空间 */
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.register-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

/* 头部样式 */
.header {
    background: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: #666;
    font-size: 14px;
}

.btn-default {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
}

.btn-default:hover {
    background: #e9ecef;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* 主要内容区域 */
.main-content {
    margin-top: 80px;
    padding: 20px;
}

/* 九宫格导航 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.grid-item {
    background: #fff;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.grid-item i {
    font-size: 32px;
    color: #667eea;
}

.grid-item span {
    font-size: 16px;
    font-weight: 500;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

.expire-info {
    color: #dc3545;
    font-size: 14px;
    padding: 4px 8px;
    background: #fff3f4;
    border-radius: 4px;
    border: 1px solid #ffdee1;
}

/* 商品管理页面样式 */
.container {
    padding: 20px;
    min-height: 100vh;
    width: 100%;
    background: #f5f5f5;
}

/* 头部搜索栏 */
.search-bar {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    padding: 20px;
    margin: 0 0 20px 0;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 美化分类下拉框 */
.select-input {
    padding: 12px 35px 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-width: 180px;
    appearance: none;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="%23666" viewBox="0 0 16 16"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>') no-repeat;
    background-position: calc(100% - 12px) center;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
}

.select-input:hover {
    border-color: #667eea;
}

.select-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* 美化搜索框 */
.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.search-input {
    border: none;
    padding: 12px 15px;
    font-size: 14px;
    color: #333;
    width: 100%;
}

.search-input:focus {
    outline: none;
}

.search-btn {
    padding: 12px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background: #5a6fd6;
}

/* 添加商品按钮样式 */
.btn-primary {
    padding: 12px 24px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.2);
}

.btn-primary i {
    font-size: 16px;
}

/* 数据表格 */
.data-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.data-table th,
.data-table td {
    padding: 12px 8px;  /* 调整padding使表格更紧凑 */
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;  /* 防止内容换行 */
}

.data-table th {
    background: #f8f9fa;
    font-weight: 500;
    color: #333;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table td:last-child {
    position: relative;
}

.product-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    min-width: 40px;  /* 防止图片被压缩 */
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.status-badge.active {
    background: #e6f4ea;
    color: #1e7e34;
}

.status-badge.inactive {
    background: #feeced;
    color: #dc3545;
}

/* 下拉菜单容器样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

/* 下拉菜单按钮样式 */
.dropdown-toggle {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    min-width: 160px;
    padding: 8px 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    z-index: 9999;
    display: none;
    right: 0;
}

/* 显示下拉菜单 */
.dropdown.show .dropdown-menu {
    display: block;
}

/* 下拉菜单项样式 */
.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    clear: both;
    font-weight: 400;
    color: #333;
    text-align: inherit;
    white-space: nowrap;
    background: none;
    border: 0;
    text-decoration: none;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item.text-danger {
    color: #dc3545;
}

.dropdown-item.text-danger:hover {
    background-color: #fff5f5;
}

/* 确保内容区域不会遮挡下拉菜单 */
.content {
    position: relative;
    overflow: visible;
}

/* 分页 */
.pagination {
    margin: 20px 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.per-page-selector select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

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

.page-link {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f8f9fa;
}

.page-link.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* 返回按钮 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    color: #666;
    text-decoration: none;
    margin-bottom: 20px;
}

.back-link i {
    font-size: 14px;
}

.back-link:hover {
    color: #333;
}

/* 修改商品管理页面的header样式 */
.container .header {
    display: flex;
    justify-content: space-between;  /* 改为两端对齐 */
    align-items: center;
    padding: 15px 20px;
    background: transparent;
    box-shadow: none;
    margin-bottom: 0;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .search-input-wrapper {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        width: 100%;
    }
    
    .select-input {
        width: 100%;
    }
}

/* 返回按钮样式 */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.back-btn i {
    font-size: 16px;
}

.back-btn span {
    font-size: 14px;
    font-weight: 500;
}

.back-btn:hover {
    color: #667eea;
    transform: translateX(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 商品表单样式 */
.form-container {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    margin: 20px 0;
}

.product-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* 图片上传区域样式优化 */
.image-upload {
    position: relative;
    margin-top: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: #667eea;
    background: rgba(102,126,234,0.05);
}

.file-label i {
    font-size: 24px;
    color: #667eea;
    margin-bottom: 10px;
}

.image-preview {
    margin-top: 0;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview:empty {
    display: none;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 3px solid #fff;
    transition: all 0.3s ease;
}

.image-preview img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* 添加图片预览提示 */
.image-preview:empty::before {
    content: '选择或上传图片后在此处预览';
    color: #999;
    font-size: 14px;
}

/* 开关按钮样式 */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    margin-top: 8px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-label:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-label {
    background: #667eea;
}

.toggle-input:checked + .toggle-label:after {
    left: calc(100% - 22px);
}

/* 表单操作区域 */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

.form-actions .btn {
    min-width: 150px;
}

/* 图片选择相关样式 */
.upload-options {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group input[type="radio"] {
    cursor: pointer;
}

.option-group label {
    cursor: pointer;
    margin: 0;
}

/* 图片选择网格样式 */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-item.selected {
    border-color: #667eea;
}

.image-item.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 5px;
    top: 5px;
    background: #667eea;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 上传按钮组样式优化 */
.upload-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ddd;
}

.upload-buttons .btn {
    flex: 1;
    max-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.upload-buttons .btn i {
    font-size: 16px;
}

.upload-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 800px;
    margin: 50px auto;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

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

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* 图片网格样式 */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview {
    margin-top: 15px;
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 商品信息展示样式 */
.product-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.product-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

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

.product-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

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

.detail-item label {
    color: #666;
    font-weight: 500;
    margin: 0;
}

.detail-item span {
    color: #333;
}

/* 入库表单样式 */
.stock-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

.stock-form textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

.form-static {
    padding: 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #666;
}

/* 日期范围选择器样式 */
.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 按钮组样式 */
.btn-group {
    display: flex;
    gap: 10px;
}

/* 数据表格优化 */
.data-table {
    margin-bottom: 20px;
}

.data-table th {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 打印样式 */
@media print {
    .header, .search-bar, .pagination {
        display: none;
    }
    
    .container {
        padding: 0;
    }
    
    .data-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .data-table th, .data-table td {
        border: 1px solid #000;
        padding: 8px;
    }
} 