:root {
    --primary: #3b82f6;
    --bg: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    font-family: system-ui, sans-serif;
}

body {
    background: var(--bg);
    padding: 1rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

select, input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.date-range-input {
    cursor: pointer;
    background: white;
}

.date-range-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
}

/* 科室选择器样式 */
.ks-selector {
    position: relative;
}

.ks-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    text-align: left;
}

.ks-trigger::after {
    content: "▼";
    font-size: 0.75rem;
    color: #64748b;
    transition: transform 0.2s;
}

.ks-trigger.open::after {
    transform: rotate(180deg);
}

.ks-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.ks-modal.show {
    display: flex;
}

.ks-modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 500px;
    height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.ks-modal-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.ks-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.ks-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.ks-search {
    padding: 0.75rem 1.25rem; /* 减小了上下内边距 */
    border-bottom: 1px solid #e2e8f0;
}

.ks-search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.ks-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ks-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.ks-item {
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.ks-item.selected {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 500;
}

.ks-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: #64748b;
}

/* 表格样式 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.875rem;
}

.result-table th,
.result-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    word-break: break-word;
}

.result-table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* 调整表格列宽 */
.result-table th:nth-child(1),
.result-table td:nth-child(1) { width: 19%; }
.result-table th:nth-child(2),
.result-table td:nth-child(2) { width: 20%; }
.result-table th:nth-child(3),
.result-table td:nth-child(3) { width: 21%; }
.result-table th:nth-child(4),
.result-table td:nth-child(4) { width: 20%; }
.result-table th:nth-child(5),
.result-table td:nth-child(5) { width: 20%; }

.error-msg {
    color: #dc3545;
    padding: 1rem;
    text-align: center;
    border-radius: 0.5rem;
    background: #fff5f5;
    margin: 1rem 0;
}

/* 日期选择器样式 */
.date-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2007;
    padding: 1rem;
}

.date-picker-modal.show {
    display: flex;
}

.date-picker {
    background: #fff;
    border: 1px solid #dfe2eb;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
    width: 350px;
}

.shortcut-buttons {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e2e2;
    padding: 10px 15px;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    position: relative;
}

.shortcut-label {
    font-size: 14px;
    color: #666;
    margin-right: 10px;
}

.shortcut-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    touch-action: manipulation;
}

.shortcut-btn:hover {
    color: #417ff9;
    border-color: #417ff9;
}

.date-close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    touch-action: manipulation;
}

.date-close:hover {
    color: #333;
    background: #ebf4ff;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e2e2;
}

.date-title {
    font-size: 14px;
    font-weight: bold;
    color: #000;
}

/* 专门针对月份、年份切换按钮禁用所有效果 */
.nav-btn {
    cursor: pointer;
    color: #000 !important;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    /* 完全禁用过渡效果 */
    transition: none !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

/* 专门针对导航按钮禁用所有悬停和激活状态 */
.nav-btn:hover,
.nav-btn:active,
.nav-btn:focus {
    color: #000 !important;
    background: transparent !important;
}

.calendar-content {
    padding: 15px 20px;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.calendar-table th {
    padding: 8px 0;
    color: #333;
    font-weight: normal;
    border-bottom: 1px solid #E8F0FB;
}

.calendar-table td {
    text-align: center;
    padding: 4px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.date-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.date-number {
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 4px;
    transition: all 0.2s;
}

.date-number:hover {
    background: #ebf4ff;
}

/* 修复高亮样式 - 确保边界日期优先级最高 */
.range-start .date-number,
.range-end .date-number {
    background: #417ff9 !important;
    color: #fff !important;
}

.in-range .date-number {
    background: #ebf4ff !important;
    color: #333 !important;
}

/* 确保边界日期覆盖范围内日期 */
td.range-start .date-number,
td.range-end .date-number {
    background: #417ff9 !important;
    color: #fff !important;
}

td.in-range:not(.range-start):not(.range-end) .date-number {
    background: #ebf4ff !important;
    color: #333 !important;
}

.prev-month, .next-month {
    color: #c7d0da;
}

/* 非当前月份日期禁用样式 */
.prev-month .date-cell,
.next-month .date-cell {
    cursor: not-allowed !important;
    opacity: 0.5;
}

.prev-month .date-number:hover,
.next-month .date-number:hover {
    background: transparent !important;
    cursor: not-allowed !important;
}

.date-footer {
    border-top: 1px solid #e2e2e2;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
}

.clear-btn {
    padding: 6px 16px;
    background: #fff;
    color: #666;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.clear-btn:hover {
    color: #417ff9;
    border-color: #417ff9;
}

.confirm-btn {
    padding: 6px 16px;
    background: #417ff9;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.confirm-btn:hover {
    background: #3a6ed9;
}

/* 移动端优化 */
@media (max-width: 640px) {
    .result-table {
        font-size: 0.75rem;
    }

    .result-table th,
    .result-table td {
        padding: 0.5rem;
    }

    .container {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    .date-picker {
        width: 100%;
        max-width: 350px;
    }

    .ks-modal-content {
        height: 600px;
    }

    /* 移动端进一步减小搜索框周围空白 */
    .ks-search {
        padding: 0.5rem 1.25rem;
    }
}