/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

header h1 {
    font-size: 24px;
    color: #333;
}

/* 主要内容区域 */
main {
    padding: 15px 0;
    flex: 1; /* Allow main content to grow */
}

/* 上传区域样式 */
.upload-section {
    margin-bottom: 30px;
}

.placeholder {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background-color: #f9f9f9;
}

.placeholder p {
    margin-bottom: 20px;
    color: #666;
    font-size: 16px;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.primary {
    background-color: #007bff;
    color: white;
}

.primary:hover {
    background-color: #0069d9;
}

.secondary {
    background-color: #6c757d;
    color: white;
}

.secondary:hover {
    background-color: #5a6268;
}

/* 预览区域样式 */
.preview {
    text-align: center;
    margin-bottom: 20px;
}

.preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

/* 加载中样式 */
.loading {
    text-align: center;
    padding: 30px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 结果区域样式 */
.result-section {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.result-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.result-item {
    display: flex;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.label {
    font-weight: bold;
    width: 80px;
    color: #555;
}

.value {
    flex: 1;
    word-break: break-all;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 15px 0;
    margin-top: 30px;
    border-top: 1px solid #eee;
    color: #777;
    font-size: 14px;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
}

/* Tab Bar Styles */
.tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 600px; /* Match .container max-width */
    margin: 0 auto; /* Center the tab bar */
    background-color: #fff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tab-button {
    flex-grow: 1;
    padding: 15px 10px;
    background-color: transparent;
    border: none;
    border-top: 3px solid transparent;
    font-size: 16px;
    color: #555;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s;
    text-align: center;
}

.tab-button:hover {
    color: #007bff;
}

.tab-button.active {
    color: #007bff;
    border-top-color: #007bff;
    font-weight: bold;
}

/* Adjust main content padding to avoid overlap with fixed tab bar */
.container {
    padding-bottom: 80px; /* Height of tab bar + some buffer */
}

/* Sign Up Form Styles */
#signUpView {
    padding-bottom: 70px; /* Add padding to bottom to avoid overlap with tab bar */
}

/* 页面主标题样式 */
main > h1 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.autocomplete-container {
    position: relative;
    margin-bottom: 10px;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 5px; /* Space between input and button */
}

.search-input-group input {
    flex-grow: 1; /* Input takes up available space */
}

.btn-search {
    padding: 8px 15px;
    border: 1px solid #007bff;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap; /* Prevent text wrapping */
    transition: background-color 0.3s;
}

.btn-search:hover {
    background-color: #0056b3;
}

/* 为搜索输入框容器启用相对定位，以便绝对定位清空按钮 */
.search-input-group {
    position: relative;
}

/* 清空按钮 (×) 的样式 */
.clear-btn {
    position: absolute;
    right: 80px; /* 定位在搜索按钮的左侧，这个值可能需要微调 */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #aaa;
    font-size: 20px;
    font-weight: 600;
    display: none; /* 默认隐藏，通过JS控制显示 */
}

.clear-btn:hover {
    color: #333;
}

/* 调整企业名称输入框的内边距，为清空按钮留出空间，防止文字被遮挡 */
#companySearch {
    padding-right: 35px !important; /* 使用!important确保样式生效 */
}

#signUpView h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    background-color: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Autocomplete styles for company search */
#companySearchResults {
    border: 1px solid #ccc;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    top: 100%; /* Position it right below the parent container */
    left: 0;
    right: 0;
    background-color: #ffffff;
    z-index: 9999; /* Ensure it's on top of everything */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 0 0 5px 5px;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f2f2f2;
}

.autocomplete-item.error {
    color: #dc3545; /* 红色错误提示 */
    cursor: default;
    background-color: #fbeaea;
}

/* 结果区域按钮样式 */
.result-section .button-group {
    margin-top: 20px;
}

.result-section .btn {
    width: 100%;
    max-width: 200px;
}