/**
 * 货物管理系统 - 主样式文件
 * 蓝白简约主调，栅格化布局，美观规范
 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

/* 侧边栏布局 */
.sidebar-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.4;
}

.user-info {
    margin-top: 15px;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-radius: 0;
    margin: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(116, 185, 255, 0.2) 0%, rgba(9, 132, 227, 0.2) 100%);
    color: white;
    border-left: 4px solid #74b9ff;
}

.nav-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 15px;
    font-weight: 500;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-radius: 0;
    margin: 0;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 0;
}

/* 容器 */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* 头部导航 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #333;
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border-bottom: 3px solid #667eea;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav {
    display: flex;
    gap: 10px;
}

.navbar-nav a {
    color: #666;
    text-decoration: none;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s;
    font-weight: 500;
    background: #f8f9fa;
}

.navbar-nav a:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.navbar-nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header {
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    margin-bottom: 20px;
    padding: 12px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 数据概览卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    animation: rotate 25s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
}

.stat-card h3 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 15px;
    opacity: 0.95;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-row-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #ffffff;
}

/* 用户输入的文字颜色 */
.form-control:not(:placeholder-shown) {
    color: #000000;
}

.form-control::placeholder {
    color: #333333 !important;
    font-style: normal;
    opacity: 1 !important;
}

/* 兼容不同浏览器的placeholder */
.form-control::-webkit-input-placeholder {
    color: #333333 !important;
    opacity: 1 !important;
}

.form-control::-moz-placeholder {
    color: #333333 !important;
    opacity: 1 !important;
}

.form-control:-ms-input-placeholder {
    color: #333333 !important;
}

.form-control:focus {
    outline: none;
    border-color: #0984e3;
    box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.1);
}

.form-control:focus::placeholder {
    color: #cccccc !important;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0984e3 0%, #74b9ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #00cec9 0%, #00b894 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #d63031 0%, #e17055 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(214, 48, 49, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #00cec9 0%, #00b894 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

/* 操作列按钮对齐 */
.table td:last-child {
    white-space: nowrap;
}

.table td:last-child .btn {
    margin-right: 5px;
}

.table td:last-child .btn:last-child {
    margin-right: 0;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    color: white;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    padding: 16px;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.table tbody tr:nth-child(even):hover {
    background: #f8f9fa;
}

/* 筛选区 */
.filter-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
}

/* 产品明细表格 */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.product-table th,
.product-table td {
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
}

.product-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.product-table td input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
}

.product-table td select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

.modal-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #007bff;
}

.modal-body {
    margin-bottom: 20px;
    line-height: 1.8;
}

.modal-footer {
    text-align: right;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 消息提示 */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* Badge 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    color: white;
    text-align: center;
}

.badge-primary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

.badge-success {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.badge-warning {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
}

.badge-info {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.badge-danger {
    background: linear-gradient(135deg, #d63031 0%, #e17055 100%);
}

.badge-secondary {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

/* 自动消失的提示 */
.alert-fade {
    animation: fadeOut 0.5s ease-in-out 2s forwards;
    transition: opacity 0.5s ease-in-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        max-height: 100px;
    }
    to {
        opacity: 0;
        max-height: 0;
        padding: 0;
        margin: 0;
        border: 0;
    }
}

/* Toast提示消息 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 4px solid #28a745;
}

.toast-error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-left: 4px solid #dc3545;
}

.toast-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-left: 4px solid #17a2b8;
}

.toast.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 25px 30px;
    color: #636e72;
    font-size: 13px;
    margin-top: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 20px;
        max-width: 100%;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 20px 10px;
    }

    .sidebar-header h2 {
        display: none;
    }

    .nav-text {
        display: none;
    }

    .nav-icon {
        margin-right: 0;
        font-size: 24px;
    }

    .main-content {
        margin-left: 70px;
    }

    .container {
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-section {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    .stat-card {
        padding: 25px 20px;
    }

    .stat-card .stat-value {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .stat-card .stat-value {
        font-size: 32px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 12px 10px;
        font-size: 13px;
    }
}
