/* ============ 玻璃质感 苹果风格 ============ */

:root {
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --glass-blur: 20px;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9500;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* 动态渐变背景 */
body {
    min-height: 100vh;
    background: linear-gradient(135deg, #c9e4ff 0%, #e8c5ff 35%, #ffd9e8 65%, #c9f5d8 100%);
    background-size: 400% 400%;
    animation: gradientFlow 20s ease infinite;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 背景光晕装饰 */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}
body::before {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, #7ab6ff, transparent 70%);
    top: -120px;
    left: -80px;
    animation: float1 12s ease-in-out infinite;
}
body::after {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #ff9ecd, transparent 70%);
    bottom: -160px;
    right: -100px;
    animation: float2 15s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(60px, 40px); }
}
@keyframes float2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-50px, -30px); }
}

/* ============ 玻璃卡片通用 ============ */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.glass-strong {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

/* ============ 登录页 ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    animation: fadeInUp 0.6s ease;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #0071e3, #6ec1ff);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.35);
}

.login-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ============ 表单 ============ */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    padding-left: 4px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}
.form-input::placeholder {
    color: #a1a1a6;
}
.form-textarea {
    resize: vertical;
    min-height: 70px;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 113, 227, 0.4);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #ff5247; }
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #2db84e; }
.btn-ghost {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.6);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.8);
}
.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}
.btn-block {
    width: 100%;
}

/* ============ 顶部导航 ============ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-brand .logo-mini {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #0071e3, #6ec1ff);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-link:hover {
    color: var(--accent);
    background: rgba(0, 113, 227, 0.08);
}
.nav-link.active {
    color: var(--accent);
    background: rgba(0, 113, 227, 0.12);
}
.nav-user {
    color: var(--text-secondary);
    font-size: 14px;
    margin-right: 8px;
}

/* ============ 主容器 ============ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    position: relative;
    z-index: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.page-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============ 项目卡片网格 ============ */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.project-card {
    padding: 26px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0071e3, #6ec1ff, #ff9ecd);
    opacity: 0.8;
}
.project-name {
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.project-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    min-height: 20px;
}
.project-stats {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.stat-item .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-item .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 2px;
}
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }

/* ============ 表格 ============ */
.table-wrapper {
    padding: 8px 4px;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    white-space: nowrap;
}
td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.3); }

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}
.badge-set { background: rgba(0,113,227,0.15); color: var(--accent); }
.badge-single { background: rgba(52,199,89,0.15); color: var(--success); }

.stock-low { color: var(--danger); font-weight: 600; }
.stock-ok { color: var(--success); font-weight: 600; }

/* ============ 模态框 ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    animation: fadeInUp 0.3s ease;
}
.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* ============ 提示消息 ============ */
.flash-msg {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    animation: fadeInUp 0.3s ease;
}
.flash-success {
    background: rgba(52,199,89,0.2);
    border: 1px solid rgba(52,199,89,0.4);
    color: #1a7a35;
}
.flash-error {
    background: rgba(255,59,48,0.15);
    border: 1px solid rgba(255,59,48,0.4);
    color: #a0231a;
}

/* ============ 出库计算结果 ============ */
.arrival-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius-md);
    display: none;
    animation: fadeInUp 0.3s ease;
}
.arrival-result.show { display: block; }
.arrival-result.need-order {
    background: rgba(255,149,0,0.15);
    border: 1px solid rgba(255,149,0,0.4);
}
.arrival-result.ready {
    background: rgba(52,199,89,0.15);
    border: 1px solid rgba(52,199,89,0.4);
}
.arrival-msg {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}
.detail-table {
    margin-top: 12px;
    font-size: 13px;
}
.detail-table th, .detail-table td {
    padding: 8px 10px;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 16px;
}

/* ============ 信息提示行 ============ */
.info-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.info-card {
    flex: 1;
    min-width: 180px;
    padding: 20px 24px;
}
.info-card .info-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.info-card .info-value {
    font-size: 28px;
    font-weight: 700;
}

/* ============ 动画 ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.4s ease; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .navbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .nav-link { padding: 6px 10px; font-size: 13px; }
    .container { padding: 20px 16px 40px; }
    .page-title { font-size: 24px; }
    .login-card { padding: 36px 24px; }
    .modal { padding: 24px; }
}

/* ============ 操作按钮组 ============ */
.action-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* 加载旋转 */
.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 分区标题 ============ */
.section-title {
    font-size: 22px;
    font-weight: 700;
    margin: 36px 0 18px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .count-pill {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.5);
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.6);
}

/* ============ 物品卡片网格 ============ */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}
.item-card {
    padding: 22px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(0,0,0,0.14);
}
.item-image {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-md);
    object-fit: cover;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #f0f0f3, #e3e3e8);
}
.item-image-placeholder {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    background: linear-gradient(135deg, rgba(167,217,255,0.4), rgba(255,200,220,0.4));
    color: rgba(0,0,0,0.3);
}
.item-number-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0,113,227,0.12);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}
.item-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.item-meta .meta-val {
    font-weight: 600;
    color: var(--text-primary);
}
.item-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 10px 0;
    min-height: 18px;
    line-height: 1.4;
    border-top: 1px solid rgba(0,0,0,0.06);
    padding-top: 10px;
}
.item-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 10px;
}

/* 复选标签（添加项目时选物品） */
.checkbox-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.4);
}
.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}
.checkbox-row:hover { background: rgba(255,255,255,0.6); }
.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.qty-inline {
    width: 70px;
    padding: 5px 8px;
    font-size: 13px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    background: rgba(255,255,255,0.7);
}
.qty-inline:disabled { opacity: 0.4; }

/* 缩略图 */
.thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #eee;
}
.thumb-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(167,217,255,0.3);
}

/* 文件上传预览 */
.file-upload {
    border: 2px dashed rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.4);
}
.file-upload:hover {
    border-color: var(--accent);
    background: rgba(0,113,227,0.05);
}
.file-upload input[type="file"] { display: none; }
.file-upload .preview-img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    margin-top: 10px;
}
