/* =====================================================
   客户门户专用样式
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

body {
    background: url('/images/background.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    padding: 20px;
}

/* 半透明遮罩 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* 容器 */
.portal-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* =====================================================
   统一头部样式
   ===================================================== */

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 12px 24px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-left .company-logo {
    height: 45px;
    object-fit: contain;
}

.header-center {
    flex: 2;
    text-align: center;
}

.header-center h1 {
    font-size: 2.0rem;
	font-weight: 800;
    color: #2c3e50;
    margin: 0;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

/* 语言切换按钮 */
.lang-switch {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: none;
    border: 1px solid #cfddee;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: #e9ecef;
}

.lang-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* 用户菜单 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.85rem;
}

.login-link, .register-link {
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.login-link {
    color: #2c3e50;
    border: 1px solid #2c3e50;
}

.login-link:hover {
    background: #2c3e50;
    color: white;
}

.register-link {
    background: #2c3e50;
    color: white;
}

.register-link:hover {
    background: #1e2a36;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
}

.logout-btn:hover {
    background: #c82333;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.card-body {
    padding: 50px;
}

/* 表单 3 列布局 */
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 30px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c3e50;
    font-size: 0.85rem;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfddee;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44,62,80,0.1);
}

/* 按钮 */
.btn-primary {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #1e2a36;
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #dee2e6;
}

.btn-outline {
    background: none;
    border: 1px solid #2c3e50;
    color: #2c3e50;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-block;
}

.btn-outline:hover {
    background: #2c3e50;
    color: white;
}

/* 报价预览卡片 */
.quote-preview {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-top: 24px;
    border: 1px solid #e9ecef;
}

.quote-price {
    font-size: 2.5rem;
    font-weight: bold;
    color: #28a745;
}

.quote-lead-time {
    color: #28a745;
	font-size: 18px;
	font-weight: bold;
    margin-top: 8px;
}

/* 警告卡片 */
.warning-card {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending {
    background: #e9ecef;
    color: #495057;
}

.status-quoted {
    background: #cfe2ff;
    color: #084298;
}

.status-confirmed {
    background: #d4edda;
    color: #155724;
}

.status-ordered {
    background: #d1ecf1;
    color: #0c5460;
}

.status-manual_required {
    background: #fff3cd;
    color: #856404;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #cfddee;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbfc;
}

.upload-area:hover {
    border-color: #2c3e50;
    background: #f8f9fa;
}

.gerber-status {
    margin-top: 12px;
    font-size: 0.85rem;
    padding: 12px;
    border-radius: 8px;
}

.gerber-status.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.gerber-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.gerber-status.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* =====================================================
   响应式设计 - 修复版
   ===================================================== */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    /* 头部改为垂直布局，但元素保持顺序 */
    .portal-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        text-align: center;
    }
    
    /* 左、中、右全部占满宽度 */
    .header-left,
    .header-center,
    .header-right {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    /* 右侧按钮组：水平居中对齐 */
    .header-right {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
        align-items: center;
    }
    
	/* 手机端确保 logo 显示 */
	.header-left .company-logo {
		display: inline-block !important;
		max-height: 35px;
		width: auto;
	}
    
    .header-center h1 {
        font-size: 1.3rem;
    }
    
    /* 按钮组内元素排列 */
    .home-link,
    .lang-switch,
    .user-menu {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    
    /* 语言切换按钮 */
    .lang-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    /* 表单 3 列改为 1 列 */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* 卡片内边距 */
    .card-body {
        padding: 16px;
    }
    
    /* 全宽按钮 */
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }
    
    /* 按钮组内按钮 */
    .btn-group .btn-primary,
    .btn-group .btn-secondary {
        width: 100%;
        margin: 0 0 8px 0;
    }
    
    /* 表格水平滚动 */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    /* 报价预览 */
    .quote-price {
        font-size: 1.6rem;
    }
    
    /* 上传区域 */
    .upload-area {
        padding: 20px;
    }
    
    /* 卡片标题 */
    .card-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .card-header .btn-primary {
        width: auto;
        display: inline-block;
    }
}

/* 3 列布局 */
.form-row-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 0px;
}

/* 响应式：手机改为 1 列 */
@media (max-width: 768px) {
    .form-row-3col {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* 按钮行 - 水平排列 */
.action-buttons-row {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}

.action-buttons-row .btn-primary,
.action-buttons-row .btn-secondary {
    padding: 10px 24px;
    margin: 0;
}

/* 响应式：手机改为垂直排列 */
@media (max-width: 768px) {
    .action-buttons-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-buttons-row .btn-primary,
    .action-buttons-row .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* 语言切换栏 - 独立行靠右 */
.lang-bar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 20px;
	flex-shrink: 0;
}
.lang-switch {
	display: flex;
	gap: 8px;
	background: rgba(255, 255, 255, 0.9);
	padding: 6px 12px;
	border-radius: 30px;
	backdrop-filter: blur(5px);
}
.lang-btn {
	background: none;
	border: 1px solid #cfddee;
	padding: 6px 14px;
	border-radius: 25px;
	cursor: pointer;
	font-size: 0.8rem;
	font-weight: 500;
	transition: all 0.2s;
}
.lang-btn:hover {
	background: #e9ecef;
}
.lang-btn.active {
	background: #2c3e50;
	color: white;
	border-color: #2c3e50;
}

/* 按钮区域 - 固定在底部 */
.action-buttons {
    position: sticky;
    bottom: 0;
    background: white;
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 0;
    padding: 6px 20px;
    border-top: 1px solid #e9ecef;
    z-index: 10;
}

/* 1. 优化手机端卡片内边距和表单间距 */
@media (max-width: 768px) {
    .card-body {
        padding: 16px 12px; /* 进一步减小内边距 */
    }
    .form-group {
        margin-bottom: 15px; /* 压缩表单组间距 */
    }
    .form-row {
        margin-bottom: 12px; /* 压缩行间距 */
    }
}

/* 2. 调整粘性按钮栏的样式，避免遮挡 */
.action-buttons {
    position: sticky;
    bottom: 0;
    padding: 10px 16px;
    /* 增加底部留白，避免按钮栏与卡片内容重叠 */
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

/* 3. 确保卡片容器可滚动，且body不限制滚动 */
body {
    min-height: 100vh;
    overflow-y: auto; /* 显式允许垂直滚动 */
    padding-bottom: 80px; /* 为底部粘性按钮栏预留空间 */
}

/* 4. 若portal-container有高度限制，移除或修改 */
.portal-container {
    max-width: 1400px;
    margin: 0 auto;
    /* 移除 height: 100vh / overflow: hidden 这类限制 */
    min-height: 100%;
}

/* 5. 优化报价预览卡片的手机端样式（减少高度占用） */
@media (max-width: 768px) {
  /* 自动识别：底部栏里有 2 个 button */
  .action-buttons:has(> button:nth-child(2)) {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 20px;
  }
  .action-buttons:has(> button:nth-child(2)) button {
    flex: 1;
    min-width: 45%;
  }
  /* 卡片自动预留底部空间 */
  .card:has(+ .action-buttons:has(> button:nth-child(2))) {
    padding-bottom: 100px !important;
  }
}

.help-icon {
	position: fixed;
	bottom: 30px;
	right: 30px;
	background: #ffffff;
	color: #1a4c6e;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: bold;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(0,0,0,0.25);
	transition: all 0.2s ease;
	z-index: 99;
	text-decoration: none;
	border: 1px solid rgba(255,255,255,0.2);
}

.help-icon:hover {
	transform: scale(1.08);
	background: #f0f4f8;
	box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
	.help-icon {
		bottom: 20px;
		right: 20px;
		width: 44px;
		height: 44px;
		font-size: 20px;
	}
}