/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 去掉数字输入框的箭头 */
.no-arrow::-webkit-outer-spin-button,
.no-arrow::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-arrow {
    -moz-appearance: textfield;
}

html, body, #app {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f7fa;
}

/* 登录页面 */
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 50px 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo h1 {
    font-size: 28px;
    color: #333;
    margin-top: 20px;
    font-weight: 600;
}

.login-logo p {
    color: #999;
    margin-top: 10px;
    font-size: 15px;
}

.form-group {
    margin-bottom: 24px;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #dcdfe6;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fff;
    line-height: 48px;
}

.form-input:hover {
    border-color: #c0c4cc;
}

.form-input:focus {
    border-color: #409eff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(64,158,255,0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: 44px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.5);
}

.btn-block {
    width: 100%;
}

.error-msg {
    background: #fef0f0;
    color: #f56c6c;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid #fde2e2;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 布局 */
.layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1f2e 0%, #2d3748 100%);
    color: #fff;
    transition: width 0.3s;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}

.sidebar-collapsed {
    width: 80px;
}

.logo {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.menu {
    padding: 16px 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: #a0aec0;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 6px;
    font-weight: 500;
}

.menu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.menu-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.menu-icon {
    margin-right: 12px;
    font-size: 20px;
    width: 24px;
    text-align: center;
}



/* 主内容区 */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    min-height: 100vh;
}

.main-collapsed {
    margin-left: 80px;
}

/* 头部 */
.header {
    height: 70px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.collapse-btn {
    font-size: 22px;
    cursor: pointer;
    color: #606266;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.collapse-btn:hover {
    background: #f5f7fa;
    color: #409eff;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #303133;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 500;
    color: #606266;
}

.btn-logout {
    padding: 8px 18px;
    background: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fde2e2;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #f56c6c;
    color: #fff;
}

/* 内容区 */
.content {
    flex: 1;
    padding: 24px;
    background: #f5f7fa;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #fafbfc, #fff);
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: #303133;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #ebeef5;
}

.table th {
    background: #f5f7fa;
    font-weight: 600;
    color: #606266;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: #f5f7fa;
}

.table tr:last-child td {
    border-bottom: none;
}

/* 按钮 */
.btn-success {
    background: #67c23a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(103,194,58,0.3);
}

.btn-success:hover {
    background: #85ce61;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(103,194,58,0.4);
}

.btn-danger {
    background: #f56c6c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(245,108,108,0.3);
}

.btn-danger:hover {
    background: #f78989;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0 14px;
    height: 32px;
    font-size: 13px;
}

/* 标签 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.tag-success {
    background: #f0f9eb;
    color: #67c23a;
    border: 1px solid #e1f3d8;
}

.tag-error {
    background: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fde2e2;
}

.tag-warning {
    background: #fdf6ec;
    color: #e6a23c;
    border: 1px solid #faecd8;
}

.tag-info {
    background: #f4f4f5;
    color: #909399;
    border: 1px solid #e9e9eb;
}

/* 加载 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #909399;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ebeef5;
    border-top-color: #409eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: #909399;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty p {
    font-size: 14px;
}

/* Dashboard 内容区域 */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-container {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #ebeef5;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #303133;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #909399;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f5f7fa;
    color: #606266;
}

.modal-body {
    padding: 24px;
}

.modal-content {
    font-size: 15px;
    color: #606266;
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #ebeef5;
}

.modal-btn-cancel {
    background: #f5f7fa;
    color: #606266;
    border: 1px solid #dcdfe6;
}

.modal-btn-cancel:hover {
    background: #e4e7ed;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 动画 */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

/* 表单样式 - 产品添加页面 */
.form-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.form-col {
    flex: 1;
    min-width: 0;
}

.form-col.full-width {
    flex: 0 0 100%;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    color: #606266;
    font-size: 14px;
    font-weight: 500;
}

.form-label.required::before {
    content: '* ';
    color: #f56c6c;
}

.form-section {
    background: linear-gradient(to bottom, #fafbfc, #fff);
    border: 1px solid #ebeef5;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 28px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #ebeef5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.calc-tip {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #909399;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid #ebeef5;
}

/* 图片上传 */
.image-upload {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.image-preview {
    width: 180px;
    height: 180px;
    border: 2px solid #ebeef5;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    width: 180px;
    height: 180px;
    border: 2px dashed #dcdfe6;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #909399;
    background: #f5f7fa;
    transition: all 0.3s;
}

.image-placeholder:hover {
    border-color: #409eff;
    color: #409eff;
    background: #ecf5ff;
}

.image-placeholder span {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 500;
}

.image-placeholder p {
    font-size: 13px;
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
}

.image-tip {
    font-size: 13px;
    color: #909399;
    background: #f5f7fa;
    padding: 10px 14px;
    border-radius: 8px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    width: 240px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #ebeef5;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #dcdfe6;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.page-btn:hover {
    border-color: #409eff;
    color: #409eff;
}

.page-btn.active {
    background: #409eff;
    border-color: #409eff;
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.red {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-info h3 {
    font-size: 13px;
    color: #909399;
    margin-bottom: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #303133;
    white-space: nowrap;
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
    /* 登录页 */
    .login-box {
        padding: 30px 20px;
        margin: 10px;
        max-width: 100%;
    }
    
    .login-logo h1 {
        font-size: 22px;
    }
    
    /* 侧边栏 - 默认隐藏 */
    .sidebar {
        width: 0;
        overflow: hidden;
        position: fixed;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        width: 260px;
    }
    
    .main {
        margin-left: 0;
        width: 100%;
        min-width: 320px;
    }
    
    /* 头部 */
    .header {
        padding: 0 12px;
        height: 56px;
        min-width: 320px;
    }
    
    .header-left {
        gap: 10px;
    }
    
    .header-title {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    .user-name {
        display: none;
    }
    
    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* 内容区 */
    .content {
        padding: 12px;
        min-width: 320px;
        overflow-x: hidden;
    }
    
    /* Dashboard 内容区域 - 移动端单列 */
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* 卡片 */
    .card {
        border-radius: 8px;
        margin-bottom: 16px;
    }
    
    .card-header {
        padding: 14px 16px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* 表格 - 横向滚动 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .table {
        min-width: 700px;
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    /* 表单 */
    .form-row {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    .form-col {
        width: 100%;
    }
    
    .form-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 15px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-input {
        height: 44px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
        padding-top: 16px;
    }
    
    .form-actions .btn {
        width: 100%;
        height: 48px;
    }
    
    /* 图片上传 */
    .image-upload {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .image-preview,
    .image-placeholder {
        width: 150px;
        height: 150px;
    }
    
    .image-info {
        text-align: center;
        padding-top: 0;
    }
    
    /* 搜索栏 */
    .search-bar {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    
    .search-input,
    .form-input {
        width: 100% !important;
    }
    
    /* 统计卡片 - 移动端横向滚动 */
    .stats-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 12px;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    
    .stat-card {
        flex: 0 0 140px;
        padding: 16px 12px;
        min-width: 140px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .stat-info h3 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* 按钮 */
    .btn {
        height: 42px;
        padding: 0 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 0 10px;
        height: 32px;
        font-size: 12px;
    }
    
    /* 分页 */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .page-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* 小屏幕手机 */
@media (max-width: 375px) {
    .login-logo h1 {
        font-size: 20px;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .table th,
    .table td {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .btn {
        height: 40px;
        padding: 0 16px;
    }
}

/* 平板 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main {
        margin-left: 220px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
