/* 数据看板主样式 */
.hospital-dashboard {
    padding: 20px;
    background: #f5f7fa;
    min-height: 100vh;
}

/* 患者头像样式 */
.patient-photo {
    flex-shrink: 0;
}

.patient-avatar {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    border: 2px solid #ddd;
    transition: border-color 0.2s;
    overflow: hidden !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.patient-avatar-img {
    width: 100% !important;
    height: 100% !important;
    max-width: 60px !important;
    max-height: 60px !important;
    object-fit: cover;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
}

.patient-avatar:hover {
    border-color: #007cba;
}

.patient-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ddd;
    color: #999;
    transition: background-color 0.2s;
}

.patient-avatar-placeholder:hover {
    background: #e8e8e8;
}

.patient-avatar-placeholder .dashicons {
    font-size: 24px;
}

/* 统计卡片样式 */
.dashboard-stats {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 24px;
    color: #fff;
    position: relative;
}

.patients-total .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.beds-total .stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.beds-occupied .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.alerts-count .stat-icon {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #d69e2e;
}

.revenue-today .stat-icon {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #38a169;
}

.expense-today .stat-icon {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #e53e3e;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 4px 0;
    line-height: 1;
}

.stat-number.alert-red {
    color: #e53e3e;
}

.stat-label {
    font-size: 15px;
    color: #718096;
    font-weight: 500;
}

.stat-trend {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.stat-trend.positive {
    background: #c6f6d5;
    color: #22543d;
}

.stat-trend.negative {
    background: #fed7d7;
    color: #742a2a;
}

/* 主要内容区域 */
.dashboard-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 小部件通用样式 */
.widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.widget:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.widget-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.widget-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.view-all {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.view-all:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* 床位网格样式 */
.bed-grid-container {
    padding: 24px;
    width: 100%;
    min-width: 600px;
    overflow-x: auto;
}

.bed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 120px));
    gap: 16px;
    max-height: 800px;
    overflow-y: auto;
    justify-content: start;
    align-content: start;
    will-change: auto;
    contain: layout style;
    width: 100%;
}

.bed-item {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    max-width: 120px;
    max-height: 120px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
    position: relative;
    border: 4px solid transparent;
    transform: scale(1);
    overflow: hidden;
    box-sizing: border-box;
}

/* 空床显示床位号 */
.bed-item .bed-number {
    font-size: 28px;
    font-weight: 700;
}

/* 在住床位患者信息 */
.bed-patient-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 6px;
    box-sizing: border-box;
}

.patient-avatar-small {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.patient-name-small {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
    color: #fff;
}

.bed-number-small {
    font-size: 16px;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1;
    color: #fff;
}

.bed-item:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
    transition: all 0.2s ease;
    transform: none !important;
}

.bed-item.available {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.bed-item.occupied {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.bed-item.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.bed-item.danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.bed-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 15px;
    color: #718096;
    font-weight: 600;
}

.legend-item::before {
    content: '';
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 6px;
}

.legend-item.available::before {
    background: #48bb78;
}

.legend-item.occupied::before {
    background: #4299e1;
}

.legend-item.warning::before {
    background: #ed8936;
}

.legend-item.danger::before {
    background: #f56565;
}

/* 患者列表样式 */
.patient-list {
    padding: 0 24px 24px;
}

.patient-card {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: pointer;
    background: #fff;
}

.patient-card:hover {
    border-color: #cbd5e0;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.patient-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 16px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.patient-info {
    flex: 1;
}

.patient-name {
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 4px 0;
    font-size: 16px;
}

.patient-details {
    font-size: 14px;
    color: #718096;
    margin: 0;
}

.patient-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 50px;
}

.patient-status.normal {
    background: #c6f6d5;
    color: #22543d;
}

.patient-status.warning {
    background: #faf089;
    color: #744210;
}

.patient-status.danger {
    background: #fed7d7;
    color: #742a2a;
}

/* 预警面板样式 */
.alert-list {
    padding: 0 24px 24px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-left: 4px solid;
    background: #f7fafc;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
    transition: all 0.2s;
}

.alert-item:hover {
    background: #edf2f7;
    transform: translateX(2px);
}

.alert-item.warning {
    border-left-color: #ed8936;
    background: #fffaf0;
}

.alert-item.warning:hover {
    background: #fef5e7;
}

.alert-item.danger {
    border-left-color: #f56565;
    background: #fffafa;
}

.alert-item.danger:hover {
    background: #fef5f5;
}

.alert-icon {
    margin-right: 12px;
    font-size: 16px;
    margin-top: 2px;
}

.alert-item.warning .alert-icon {
    color: #ed8936;
}

.alert-item.danger .alert-icon {
    color: #f56565;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 4px 0;
    font-size: 14px;
}

.alert-description {
    font-size: 13px;
    color: #718096;
    margin: 0;
    line-height: 1.4;
}

.alert-count-badge {
    background: #f56565;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* 图表容器样式 */
.chart-container {
    padding: 24px;
    height: 300px;
    position: relative;
}

.chart-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chart-controls select {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
}

/* 快速操作面板 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.quick-action-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.quick-action-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.quick-action-btn {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s;
    width: 100%;
}

.quick-action-btn:hover {
    background: #f7fafc;
    color: #667eea;
}

.quick-action-btn i {
    font-size: 20px;
    margin-right: 12px;
    color: #667eea;
}

.quick-action-btn span {
    font-weight: 500;
}

/* 无数据状态 */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    font-style: italic;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #718096;
}

/* 响应式设计括号内max-width: 1400px */
@media (max-width: 1200px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hospital-dashboard {
        padding: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .stat-number {
        font-size: 28px;
    }

    .bed-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .bed-item {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }

    .widget-header {
        padding: 16px 20px;
    }

    .widget-header h2 {
        font-size: 16px;
    }

    .patient-list,
    .alert-list,
    .bed-grid-container,
    .chart-container {
        padding: 16px 20px 20px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        margin-right: 0;
        margin-bottom: 12px;
    }

    .dashboard-main {
        gap: 20px;
    }

    .bed-legend {
        justify-content: center;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .patient-card {
        padding: 12px;
    }

    .patient-avatar {
        width: 40px;
        height: 40px;
    }
}