:root {
    --bg-color: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* 状态颜色 (柔和版) */
    --color-normal-bg: #eff6ff;
    --color-normal-border: #bfdbfe;
    --color-normal-text: #1e40af;

    --color-staff-bg: #fef2f2;
    --color-staff-border: #fecaca;
    --color-staff-text: #991b1b;

    --color-reserved-bg: #fffbeb;
    --color-reserved-border: #fde68a;
    --color-reserved-text: #92400e;

    --color-empty-bg: #ffffff;
    --color-empty-border: #e5e7eb;
    --color-empty-text: #9ca3af;

    --color-special-bg: #f0fdf4;
    --color-special-border: #bbf7d0;
    --color-special-text: #166534;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 2rem;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.main-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #111827;
}

.status-legend {
    display: flex;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid transparent;
}

.dot.type-normal {
    background-color: var(--color-normal-bg);
    border-color: var(--color-normal-border);
}

.dot.type-staff {
    background-color: var(--color-staff-bg);
    border-color: var(--color-staff-border);
}

.dot.type-reserved {
    background-color: var(--color-reserved-bg);
    border-color: var(--color-reserved-border);
}

.dot.type-empty {
    background-color: var(--color-empty-bg);
    border-color: var(--color-empty-border);
}

/* 选项卡导航 */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 楼层样式 */
.floor-section {
    margin-bottom: 3rem;
}

.floor-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.floor-badge {
    background: #374151;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 1rem;
}

.floor-divider {
    flex-grow: 1;
    height: 1px;
    background: #e5e7eb;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* 房间卡片样式 */
.room-card {
    background: var(--card-bg);
    border: 1px solid var(--color-empty-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.room-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.room-tag {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.occupant-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.occupant {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.occupant-name {
    font-weight: 500;
}

.occupant-time {
    font-size: 0.75rem;
    opacity: 0.7;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
    font-style: italic;
}

/* 状态变体 */
.room-card.status-staff {
    background-color: var(--color-staff-bg);
    border-color: var(--color-staff-border);
}

.room-card.status-staff .room-number {
    color: var(--color-staff-text);
}

.room-card.status-staff .room-tag {
    background: rgba(255, 255, 255, 0.6);
    color: var(--color-staff-text);
}

.room-card.status-reserved {
    background-color: var(--color-reserved-bg);
    border-color: var(--color-reserved-border);
}

.room-card.status-reserved .room-number {
    color: var(--color-reserved-text);
}

.room-card.status-reserved .room-tag {
    background: rgba(255, 255, 255, 0.6);
    color: var(--color-reserved-text);
}

.room-card.status-normal {
    background-color: var(--color-normal-bg);
    border-color: var(--color-normal-border);
}

.room-card.status-normal .room-number {
    color: var(--color-normal-text);
}

.room-card.status-special {
    background-color: var(--color-special-bg);
    border-color: var(--color-special-border);
}

.room-card.status-special .room-number {
    color: var(--color-special-text);
}

/* 交接班表格样式 */
.handover-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.handover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.handover-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.handover-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.handover-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
}

.handover-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.handover-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    font-size: 0.85rem;
}

.handover-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-secondary);
}

.handover-table tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}

.handover-table tbody tr:hover {
    background-color: #f9fafb;
}

.handover-table tbody tr.highlight {
    background-color: #fffbeb;
}

.handover-table tbody tr.highlight td {
    font-weight: 500;
}

.handover-table td.date-cell {
    font-weight: 500;
    color: var(--text-primary);
}

.handover-table td.staff-cell {
    color: #2563eb;
    font-weight: 500;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 500px;
    max-width: 90%;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalFadeIn 0.3s;
}

.modal-wide {
    width: 800px;
    max-width: 95%;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* 人员输入行 */
.occupant-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.occupant-input-row input {
    flex: 1;
}

.btn-remove {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 6px;
    width: 36px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: #fecaca;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary,
.btn-secondary,
.btn-cancel,
.btn-danger {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

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

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-cancel {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid #d1d5db;
}

.btn-cancel:hover {
    background-color: #f3f4f6;
}

/* 标签页导航 */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 交接班容器 */
.handover-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.handover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.handover-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* 交接班表格 */
.handover-table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.handover-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.handover-table thead {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 10;
}

.handover-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    font-size: 0.85rem;
}

.handover-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-secondary);
}

.handover-table tbody tr {
    transition: background-color 0.2s;
}

.handover-table tbody tr:hover {
    background-color: #f9fafb;
}

/* 交接班模态框 - 更宽 */
.modal-wide .modal-content {
    max-width: 900px;
}

/* 统计表容器 */
.statistics-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.statistics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.statistics-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.statistics-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.statistics-controls input[type="date"] {
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* 统计表格 */
.statistics-table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.statistics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 1500px;
}

.statistics-table thead {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 10;
}

.statistics-table th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
    white-space: nowrap;
    font-size: 0.85rem;
    background: #f9fafb;
}

.statistics-table td {
    padding: 0.75rem 0.5rem;
    border: 1px solid #e5e7eb;
    color: var(--text-secondary);
    text-align: center;
}

.statistics-table tbody tr:first-child {
    background-color: #eff6ff;
}

.statistics-table tbody tr:last-child {
    background-color: #f0fdf4;
}

.statistics-table tbody td:first-child {
    font-weight: 600;
    color: var(--text-primary);
    background-color: #f9fafb;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .main-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .status-legend {
        flex-wrap: wrap;
    }

    .handover-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .handover-table {
        font-size: 0.75rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .statistics-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .statistics-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .statistics-controls input[type="date"] {
        flex: 1;
        min-width: 150px;
    }

    .statistics-table {
        font-size: 0.75rem;
        min-width: 1200px;
    }

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