/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #4CAF50;
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-message {
    color: #f44336;
    margin-top: 10px;
    text-align: center;
}

/* 管理系统主页面样式 */
.container {
    width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-areas: 
        "header header"
        "sidebar content"
        "footer footer";
    grid-template-columns: 250px 1fr;
    grid-template-rows: 60px 1fr 50px;
    min-height: 100vh;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 顶部导航栏 */
.header {
    grid-area: header;
    background-color: #333;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header .user-info span {
    font-size: 14px;
}

.header .btn-logout {
    background-color: transparent;
    color: #fff;
    border: 1px solid #fff;
    padding: 8px 16px;
    font-size: 14px;
}

.header .btn-logout:hover {
    background-color: #fff;
    color: #333;
}

/* 侧边栏导航 */
.sidebar {
    grid-area: sidebar;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 20px 0;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 5px;
}

.sidebar a {
    display: block;
    padding: 12px 30px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    background-color: #e9ecef;
    border-left-color: #4CAF50;
}

.sidebar a.active {
    background-color: #e3f2fd;
    border-left-color: #2196F3;
    font-weight: 500;
}

/* 内容区域 */
.content {
    grid-area: content;
    padding: 30px;
    overflow-y: auto;
}

.content h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 22px;
}

/* 产品列表样式 */
.product-list {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.product-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.product-list-header h3 {
    color: #333;
    font-size: 18px;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
}

.product-table th,
.product-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.product-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.product-table tr:hover {
    background-color: #f8f9fa;
}

.product-images {
    display: flex;
    gap: 5px;
}

.product-images img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.btn-edit {
    background-color: #2196F3;
    color: #fff;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-edit:hover {
    background-color: #0b7dda;
}

.btn-copy {
    background-color: #4CAF50;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    margin-left: 8px;
}

.btn-copy:hover {
    background-color: #45a049;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.pagination select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pagination button {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 12px;
    font-size: 14px;
}

.pagination button:hover {
    background-color: #e9ecef;
}

.pagination button.active {
    background-color: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

/* 产品创建和编辑表单 */
.form-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-full-width {
    grid-column: 1 / -1;
}

.image-upload {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.image-upload .image-item {
    width: 100px;
    height: 100px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.image-upload .image-item:hover {
    border-color: #4CAF50;
    background-color: #f8f9fa;
}

.image-upload .image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.image-upload .image-item .remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* 管理员管理页面 */
.admin-form {
    max-width: 600px;
    margin: 0 auto;
}

/* 底部版权信息 */
.footer {
    grid-area: footer;
    background-color: #f8f9fa;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-top: 1px solid #e9ecef;
}

/* 响应式设计 */
@media (max-width: 1600px) {
    .container {
        width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 管理员操作按钮 */
.admin-actions {
    margin: 20px 0;
}

.admin-actions button {
    margin-right: 10px;
}

/* 悬浮窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.close-modal {
    margin-right: 10px;
}

/* 管理员管理页面样式 */
.admin-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    overflow: hidden;
}



.admin-content {
    padding: 20px;
}

.admin-list h4 {
    margin-bottom: 20px;
    color: #333;
    font-size: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.admin-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.admin-table tr:hover {
    background-color: #f8f9fa;
}

.admin-table td:last-child {
    text-align: center;
}