/* 采购计划管理系统 - 全局样式 */

:root {
    --primary: #1a73e8;
    --success: #0d904f;
    --warning: #e6a817;
    --danger: #d93025;
    --info: #0d7b9c;
    --dark: #1f2937;
    --light: #f8fafc;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
}

/* 导航栏 */
.navbar {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0.5rem 1rem;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}
.navbar .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255,255,255,0.15);
}
.navbar .btn-outline-light {
    border-color: rgba(255,255,255,0.3);
}

/* 页面容器 */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 0.25em 0.7em;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-purchasing { background: #fef3c7; color: #92400e; }
.status-preparing { background: #dbeafe; color: #1e40af; }
.status-delivering { background: #cffafe; color: #155e75; }
.status-completed { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.status-pending_shipment { background: #cffafe; color: #155e75; }
.status-in_transit { background: #d1fae5; color: #065f46; }
.status-delivered { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }

/* 统计卡片 */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-card .card-title {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
}

/* 表格样式 */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.table-card .table {
    margin-bottom: 0;
}
.table th {
    background: #f8fafc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}
.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* 表单卡片 */
.form-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 2rem;
}
.form-card .section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3b82f6;
}

/* 物资明细行 */
.material-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}
.material-row .row-number {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    width: 28px;
    height: 28px;
    text-align: center;
    line-height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* 详情页 */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}
.detail-field {
    margin-bottom: 0.75rem;
}
.detail-field .label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detail-field .value {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 500;
}

/* 时间线 */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #3b82f6;
}
.timeline-item:first-child::before {
    background: #22c55e;
    box-shadow: 0 0 0 2px #22c55e;
}
.timeline-item .tl-time {
    font-size: 0.8rem;
    color: #94a3b8;
}
.timeline-item .tl-content {
    font-size: 0.9rem;
    color: #334155;
}

/* 按钮组 */
.btn-group-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 按钮间距优化 */
.btn + .btn, .btn + form, form + .btn, form + form {
    margin-left: 0.4rem;
}
.btn-group-sm .btn {
    border-radius: 6px;
}
.btn-group-sm > .btn + .btn {
    margin-left: 3px;
}
.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger,
.btn-outline-success, .btn-outline-warning, .btn-outline-info {
    border-radius: 6px;
}
.btn {
    border-radius: 6px;
    transition: all 0.15s;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
/* 表格内按钮 */
.table td .btn {
    margin: 1px 2px;
}

/* 加载动画 */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}

/* 响应式 - 手机端 */
@media (max-width: 768px) {
    .page-container {
        padding: 0.5rem;
    }
    .form-card {
        padding: 0.75rem;
    }
    .stat-card .stat-number {
        font-size: 1.3rem;
    }
    .stat-card .card-title {
        font-size: 0.7rem;
    }
    /* 表格横滚 */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    /* 按钮触屏友好 */
    .btn, .btn-sm {
        min-height: 36px;
        padding: 0.4rem 0.8rem;
    }
    .btn-group-sm .btn {
        min-height: 32px;
        padding: 0.2rem 0.5rem;
    }
    /* 弹窗全宽 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    /* 隐藏非核心列 */
    .hide-mobile {
        display: none !important;
    }
    /* 导航栏 */
    .navbar-brand {
        font-size: 0.95rem;
    }
    /* 详情页左右堆叠 */
    .detail-sidebar {
        order: -1;
    }
    /* 表单 - 列全宽 */
    .form-card .row.g-3 > [class*="col-"] {
        width: 100%;
    }
    /* 输入框触屏 */
    input, select, textarea, .form-control, .form-select {
        font-size: 16px !important; /* 防止 iOS 缩放 */
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    h4 { font-size: 1.1rem; }
    .stat-card .stat-number { font-size: 1.1rem; }
    .table th, .table td { font-size: 0.7rem; padding: 0.3rem; }
    .status-badge { font-size: 0.65rem !important; padding: 0.15em 0.4em !important; }
}
