/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

pre {
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    /* 确保字符编码正确显示 */
    unicode-bidi: embed;
    direction: ltr;
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 登录页面专属样式 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.login-page .container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

.login-page .form-container {
    max-width: 500px;
    width: 100%;
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-in-out;
}

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

.container {
    width: 90%;
    max-width: 98%;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #343a40;
    color: white;
    padding: 15px 0;
    margin-bottom: 30px;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    margin: 0;
}

nav ul {
    list-style: none;
    display: flex;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: #495057;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
}

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

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

/* 登录和表单样式 */
.form-container {
    max-width: 500px;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

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

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

/* 商品列表样式 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.product-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 15px;
}

.product-info h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.product-info .sku {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.product-info .stock {
    font-weight: 600;
    color: #28a745;
}

.product-info .stock.low {
    color: #ffc107;
}

.product-info .stock.out {
    color: #dc3545;
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    min-width: 700px;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

table th {
    background-color: #343a40;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

table th:first-child {
    border-top-left-radius: 8px;
}

table th:last-child {
    border-top-right-radius: 8px;
}

table tr:last-child td {
    border-bottom: none;
}

/* 搜索框样式 */
#search {
    transition: border-color 0.3s ease;
}

#search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

table tr:hover {
    background-color: #f8f9fa;
}

/* 通知样式 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* 浮动通知样式 */
.floating-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translate(-50%, -20px);
}

.floating-alert.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.floating-alert.success {
    background-color: #28a745;
}

.floating-alert.error {
    background-color: #dc3545;
}

/* 分类筛选样式 */
.category-filter {
    margin-bottom: 20px;
}

.category-filter select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.pagination a {
    padding: 8px 12px;
    margin: 0 5px;
    border: 1px solid #dee2e6;
    text-decoration: none;
    color: #007bff;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.pagination a:hover {
    background-color: #f8f9fa;
}

.pagination .active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-content {
    margin: auto;
    padding: 20px;
    max-width: 90%;
    max-height: 80vh;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: #333;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #007bff;
    text-decoration: none;
}

/* 按钮样式补充 */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-secondary {
    background-color: #313335;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    nav ul {
        margin-top: 15px;
        flex-wrap: wrap;
    }
    
    nav ul li {
        margin-left: 0;
        margin-right: 15px;
        margin-bottom: 10px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        display: block;
        overflow-x: auto;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 15px;
    }
}

/* 自定义提示框样式 */
.custom-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-alert.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.custom-alert.show .custom-alert-content {
    transform: scale(1);
}

.custom-alert-header {
    padding: 15px 20px;
    background-color: #343a40;
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.custom-alert-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.custom-alert-body {
    padding: 20px;
    text-align: center;
}

.custom-alert-body p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.custom-alert-footer {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    display: flex;
    justify-content: center;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #0056b3;
}