/* 整体样式 */
* {
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    padding-bottom: 15px; /* 为底部版权信息留出空间，高度大幅减小 */
    background-color: #A5dffd; /* 浅蓝色背景 */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

/* 电脑端样式 - 占满宽度但保留边距 */
@media (min-width: 768px) {
    body {
        min-width: auto !important;
        overflow-x: hidden !important;
        padding: 20px 40px !important; /* 左右保留40px边距，上下保持20px */
    }
    
    .container {
        width: 100% !important;
        max-width: none !important; /* 移除最大宽度限制 */
        margin: 0 !important;
        border-radius: 10px !important; /* 恢复圆角 */
        padding: 20px !important; /* 保持内边距 */
    }
    
    .search-form, .results-table {
        width: 100% !important;
    }
    
    /* 表格占满容器宽度 */
    table {
        width: 100% !important;
        min-width: auto !important; /* 移除最小宽度限制 */
        margin: 15px auto !important; /* 居中显示 */
        display: table !important; /* 恢复表格显示方式 */
    }
}

/* 移动端样式 - 保持当前版式 */
@media (max-width: 767px) {
    body {
        min-width: 1208px; /* 固定最小宽度 */
        overflow-x: auto; /* 允许水平滚动 */
    }
    
    .container {
        width: 1208px;
    }
}

/* search.php 移动端自适应样式 - 提高优先级 */
@media (max-width: 767px) and (min-width: 481px) {
    body.search-page {
        min-width: auto !important;
        overflow-x: hidden !important;
        padding: 20px 10px !important;
    }
    
    body.search-page .container {
        width: 100% !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    body.search-page .card-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        padding: 0 10px !important;
        max-width: none !important;
        width: 100% !important;
    }
    
    body.search-page .card {
        min-height: 180px !important;
        padding: 15px !important;
    }
    
    body.search-page .card i {
        font-size: 36px !important;
        margin-bottom: 10px !important;
    }
    
    body.search-page .card h3 {
        font-size: 16px !important;
    }
    
    body.search-page .card p {
        font-size: 13px !important;
    }
}

/* search.php 小屏移动端样式 - 提高优先级 */
@media (max-width: 480px) {
    body.search-page {
        min-width: auto !important;
        overflow-x: hidden !important;
        padding: 20px 10px !important;
    }
    
    body.search-page .container {
        width: 100% !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    body.search-page .card-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 0 10px !important;
        max-width: none !important;
        width: 100% !important;
    }
    
    body.search-page .card {
        min-height: 160px !important;
        padding: 15px !important;
    }
}
/* --- 新增：顶部用户信息条样式 --- */
.top-user-info {
    position: static; /* 改为静态定位，不固定 */
    background: none; /* 移除背景色 */
    padding: 8px 20px;
    border-bottom: none; /* 移除底部边框 */
    z-index: 1001; /* 确保在最顶层 */
    display: flex;
    justify-content: flex-end; /* 将内容推到右侧 */
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #333;
    margin-bottom: 10px; /* 添加底部边距，将内容挤到下一行 */
    margin-left: auto;
    width: fit-content;
}
.top-user-info .user-details {
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-user-info .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.top-user-info .user-name {
    font-weight: bold;
    cursor: pointer;
    position: relative;
    user-select: none;
}
.top-user-info .user-name:hover {
    color: #007BFF;
}
.top-user-info .user-dropdown {
    position: relative;
    display: inline-block;
}
.top-user-info .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 200px;
    z-index: 1002;
    display: none;
    margin-top: 5px;
}
.top-user-info .dropdown-menu.show {
    display: block;
}
.top-user-info .dropdown-item {
    padding: 8px 12px;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-user-info .dropdown-item i {
    width: 16px;
    text-align: center;
    color: #666;
}
.top-user-info .dropdown-item:hover {
    background-color: #f8f9fa;
}
.top-user-info .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 200px;
    z-index: 1002;
    display: none;
    margin-top: 5px;
}
.top-user-info .dropdown-menu.show {
    display: block;
}
.top-user-info .dropdown-trigger::after {
    content: '';
    font-size: 10px;
    margin-left: 5px;
    color: #666;
    transition: transform 0.2s;
}
.top-user-info .dropdown-trigger:hover::after {
    color: #007BFF;
}
.top-user-info .user-dropdown.show .dropdown-trigger::after {
    transform: rotate(180deg);
}
.top-user-info .logout-btn {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.top-user-info .logout-btn:hover {
    background-color: #dc3545;
    color: white;
}
/* 隐藏默认的用户信息显示 */
.user-info-display {
    display: none !important;
}
/* --- 结束新增 --- */

/* 下拉菜单响应式设计 */
@media (max-width: 768px) {
    .top-user-info .dropdown-menu {
        min-width: 180px;
        font-size: 11px;
    }
    .top-user-info .dropdown-item {
        font-size: 11px;
        padding: 6px 10px;
    }
}
/* 主容器 - 默认移动端样式 */
.container {
    width: 1208px;
    margin: 0 auto;
    margin-top: 50px; /* 添加上边距，为顶部固定信息条留出空间 */
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    position: relative;
}
/* 表格样式 - 默认移动端样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px auto; /* 设置外边距以实现居中 */
    background-color: white;
    min-width: 1000px; /* 确保表格最小宽度 */
    overflow-x: auto; /* 允许表格水平滚动 */
    display: block; /* 使表格可以滚动 */
}
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}
/* 药品目录编码列样式 - 自动换行成三行 */
#medicineTable th[data-title="药品目录编码"],
#medicineTable td[data-title="药品目录编码"] {
    max-width: 120px; /* 设置最大宽度 */
    white-space: normal; /* 允许换行 */
    word-break: break-all; /* 强制在任何字符处换行 */
    line-height: 1.5; /* 设置行高 */
    vertical-align: top; /* 顶部对齐 */
}
th {
    background-color: #f2f2f2;
    font-weight: bold;
}
/* 交替行颜色 */
.pink-row {
    background-color: #F0FFF0;
}
.blue-row {
    background-color: #E6E6FA;
}
/* 搜索表单样式 */
.search-form {
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap; /* 禁止换行 */
}
.search-form label {
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
}
.search-form input[type="text"] {
    padding: 10px;
    min-width: 250px; /* 最小宽度 */
    flex-grow: 1; /* 允许输入框增长 */
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    max-width: 500px; /* 最大宽度 */
}
.search-form button {
    padding: 10px 20px;
    background-color: #007BFF;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    white-space: nowrap;
}
.search-form button:hover {
    background-color: #0056b3;
}
.error-message {
    color: #e74c3c;
    font-weight: bold;
    margin: 10px 0;
}
/* 特定列不换行 */
#drugTable th[data-title="开始日期"],
#drugTable td[data-title="开始日期"],
#drugTable th[data-title="结束日期"],
#drugTable td[data-title="结束日期"],
#zhenliaoTable th[data-title="开始日期"],
#zhenliaoTable td[data-title="开始日期"],
#zhenliaoTable th[data-title="结束日期"],
#zhenliaoTable td[data-title="结束日期"],
#haocaiTable th[data-title="开始日期"],
#haocaiTable td[data-title="开始日期"],
#haocaiTable th[data-title="结束日期"],
#haocaiTable td[data-title="结束日期"] {
    white-space: nowrap;
}
/* 有效行红色加粗 */
.active-row {
    color: #0000FF !important;
    font-weight: bold !important;
}
/* 页脚样式 */
.footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    color: #333;
    font-size: 14px;
    width: 100%;
}
.footer a {
    color: #1a2a6c;
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}
/* 底部版权信息样式 */
.footer-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 0; /* 完全移除内边距 */
    text-align: center;
    color: #333;
    font-size: 14px;
    border-top: 1px solid #ddd;
    z-index: 1000;
    height: auto; /* 确保高度自适应内容 */
    min-height: auto; /* 移除最小高度限制 */
    line-height: 1.2; /* 减小行高 */
}

.footer-bottom p {
    margin: 0; /* 移除段落边距 */
    padding: 3px 0; /* 只在段落上添加少量垂直内边距 */
}
/* 新增："在用"复选框样式 */
.active-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    margin-left: 10px;
}
/* 新增：输入提示样式 */
.input-hint {
    font-size: 14px;
    color: #666;
    margin-left: 10px;
    white-space: nowrap;
}
/* 药品查询输入框特殊样式 - 确保宽度为60% */
#medicineQueryForm .search-form input[type="text"] {
    width: 60% !important;
    max-width: 300px !important;
    flex-grow: 0 !important;
    min-width: 200px !important;
}

/* 药品查询生产企业标签样式 */
#medicineQueryForm .search-form .manufacturer-label {
    margin-left: 15px;
}
/* 药品查询输入框特殊样式 - 确保宽度为60% */
#medicineQueryForm .search-form input[type="text"] {
    width: 60% !important;
    max-width: 300px !important;
    flex-grow: 0 !important;
    min-width: 200px !important;
}
/* 药品查询输入框特殊样式 - 确保宽度为60% */
#medicineQueryForm .search-form input[type="text"] {
    width: 60% !important;
    max-width: 300px !important;
    flex-grow: 0 !important;
    min-width: 200px !important;
}
/* 药品查询输入框特殊样式 */
#medicineQueryForm .search-form input[type="text"] {
    width: 60% !important;
    max-width: 300px !important;
    flex-grow: 0 !important;
    min-width: 200px !important;
}
/* --- 新增：灰码行样式 --- */
.gray-row {
    color: #888888 !important; /* 设置文字颜色为灰色 */
}
.red-cell {
    color: red !important; /* 设置文字颜色为红色 */
    font-weight: bold;
}
/* --- 结束新增 --- */
/* --- 新增：登录模态框样式 --- */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.modal-content h3 {
    margin-top: 0;
    color: #333;
}
.qrcode-container {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #fafafa;
}
.qrcode-container img {
    max-width: 200px;
    height: auto;
    border: 1px solid #ddd;
}
.instruction {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin: 15px 0;
    font-size: 13px;
    text-align: left;
}
.instruction ol {
    margin: 5px 0;
    padding-left: 20px;
}
.instruction li {
    margin: 3px 0;
}
.close-modal {
    margin-top: 15px;
    padding: 8px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.close-modal:hover {
    background: #545b62;
}
.scene-info {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    word-break: break-all;
}
.loading-spinner {
    color: #007bff;
    font-size: 16px;
}
.loading-spinner .fa-spinner {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 卡片样式 */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px auto;
    max-width: 1200px;
    width: 100%;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #007BFF;
}

.card h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.card p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
}

.card .access-label {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    margin-top: 10px;
}

.card .access-free {
    background-color: #d4edda;
    color: #155724;
}

.card .access-vip {
    background-color: #fff3cd;
    color: #856404;
}

/* 返回首页按钮样式 */
.back-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.back-home-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}

/* 搜索条件提示 */
.search-conditions {
    background-color: #e7f3fe;
    border-left: 6px solid #2196F3;
    margin: 15px 0;
    padding: 10px 15px;
    font-size: 14px;
    color: #333;
    text-align: left;
    border-radius: 4px;
}

.search-conditions strong {
    color: #2196F3;
}

/* 搜索用时和结果统计样式 */
.search-stats {
    font-size: 14px;
    color: #555;
    margin-top: 5px;
    text-align: left;
}

.search-stats .search-time {
    font-weight: bold;
    color: #4CAF50;
}

.search-stats .result-count {
    font-weight: bold;
    color: #FF9800;
    margin-left: 10px;
}