/* ============================================
   进销存管理系统 - 前台自定义样式
   包含：导航栏、首页、商品浏览、订单、登录注册等页面样式
   ============================================ */

/* ---------- 全局基础样式 ---------- */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-color);
    min-height: 100vh;
}

/* ---------- 导航栏样式 ---------- */
.navbar-dark.bg-primary {
    background-color: #2563eb !important;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.navbar .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    transition: background-color var(--transition-speed);
    border-radius: 4px;
}

.navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ---------- 页面主体内容 ---------- */
.body-content {
    min-height: calc(100vh - 200px);
    padding-bottom: 20px;
}

/* ---------- Jumbotron 首页横幅 ---------- */
.jumbotron {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
    border: none;
    position: relative;
    overflow: hidden;
}

.jumbotron::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.jumbotron::after {
    content: "";
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.jumbotron .display-4 {
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.jumbotron .lead,
.jumbotron p,
.jumbotron hr {
    position: relative;
    z-index: 1;
}

/* ---------- 统计卡片 ---------- */
.card {
    border: none;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    border-radius: 8px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card .card-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.card .card-text {
    color: #6c757d;
    font-size: 0.9rem;
}

/* ---------- 商品卡片 ---------- */
.product-card {
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed);
}

.product-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.product-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .card-body {
    padding: 1rem;
}

.product-card .card-footer {
    padding: 0.5rem 1rem;
}

.product-card .btn-outline-primary {
    transition: all var(--transition-speed);
}

.product-card .btn-outline-primary:hover {
    transform: scale(1.02);
}

/* ---------- 登录/注册卡片 ---------- */
.card.shadow {
    box-shadow: var(--shadow-lg);
}

.card-header.bg-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    padding: 1.25rem;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #198754, #157347) !important;
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    padding: 1.25rem;
}

/* ---------- 表单控件增强 ---------- */
.form-control,
.form-select {
    border-radius: 6px;
    border-color: var(--border-color);
    padding: 0.6rem 0.9rem;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.3rem;
}

/* ---------- 按钮增强 ---------- */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all var(--transition-speed);
}

.btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #157347;
    transform: translateY(-1px);
}

/* ---------- 表格增强 ---------- */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f1f5f9;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    color: #475569;
    padding: 0.75rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(241, 245, 249, 0.5);
}

.table-hover tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.04);
}

/* ---------- 徽章样式 ---------- */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 4px;
    font-size: 0.8rem;
}

.badge.bg-warning {
    color: #212529;
}

/* ---------- 页脚 ---------- */
footer {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 1rem 0;
}

footer p {
    margin: 0;
}

/* ---------- 空数据提示 ---------- */
.text-center.text-muted.py-5 h5 {
    font-weight: 500;
}

/* ---------- 提示信息 ---------- */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
}

.alert-warning {
    background-color: #fff8e1;
    color: #856404;
}

/* ---------- 商品详情页 ---------- */
.table td.text-muted {
    font-weight: 500;
    background-color: #f8f9fa;
    width: 120px;
}

/* ---------- 链接样式 ---------- */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: #1d4ed8;
}

/* ---------- 分页样式 ---------- */
.pagination .page-link {
    border-radius: 4px;
    margin: 0 2px;
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ---------- 响应式调整 ---------- */
@media (max-width: 768px) {
    .jumbotron {
        padding: 2rem 1rem !important;
    }

    .jumbotron .display-4 {
        font-size: 1.75rem;
    }

    .card .card-title {
        font-size: 1.5rem;
    }

    .product-card .card-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .body-content {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ---------- 动画效果 ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.4s ease-out;
}

.product-card:nth-child(1) { animation-delay: 0s; }
.product-card:nth-child(2) { animation-delay: 0.05s; }
.product-card:nth-child(3) { animation-delay: 0.1s; }
.product-card:nth-child(4) { animation-delay: 0.15s; }

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ---------- 加载状态 ---------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
