/**
 * 组件样式
 */

/* 加载指示器 */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loader-content {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a73e8;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loader-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.toast::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 16px;
}

.toast-info {
    background-color: rgba(26, 115, 232, 0.95);
}

.toast-info::before {
    content: "\f05a";
}

.toast-success {
    background-color: rgba(52, 168, 83, 0.95);
}

.toast-success::before {
    content: "\f00c";
}

.toast-warning {
    background-color: rgba(251, 188, 4, 0.95);
    color: #333;
}

.toast-warning::before {
    content: "\f071";
}

.toast-error {
    background-color: rgba(234, 67, 53, 0.95);
}

.toast-error::before {
    content: "\f06a";
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 确认对话框 */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.confirm-dialog {
    background-color: white;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: dialogFadeIn 0.3s ease;
    overflow: hidden;
}

.confirm-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.confirm-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.confirm-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-close:hover {
    color: #333;
}

.confirm-body {
    padding: 25px 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.confirm-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon-warning {
    background-color: #fff3e0;
    color: #f57c00;
}

.confirm-icon-danger {
    background-color: #ffebee;
    color: #d32f2f;
}

.confirm-icon-info {
    background-color: #e3f2fd;
    color: #1976d2;
}

.confirm-message {
    flex: 1;
    line-height: 1.6;
    color: #333;
}

.confirm-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8f9fa;
}

.confirm-footer .btn {
    min-width: 80px;
    padding: 10px 20px;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dialogFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* 搜索高亮 */
mark {
    background-color: #ffeb3b;
    padding: 1px 3px;
    border-radius: 2px;
    color: #333;
}

/* 日期选项 */
.date-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.date-option:hover {
    background: #e8e8e8;
}

.date-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.date-option input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.dayoff-badge {
    background-color: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: auto;
}

/* 参与者信息 */
.participants-info {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
    line-height: 1.4;
}

/* 备注信息 */
.notes-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 5px;
    cursor: help;
}

.notes-info i {
    font-size: 10px;
}

/* 空行程状态 */
.empty-schedule {
    color: #999;
    font-style: italic;
    font-size: 13px;
}

/* 地点徽章悬停效果 */
.location-badge {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.location-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.location-badge:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

/* 日期输入组 */
.date-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.date-input-group:hover {
    border-color: #1a73e8;
    background-color: #fff;
}

.date-input-group .form-control {
    flex: 1;
    min-width: 0;
}

/* 自动填充按钮 */
.auto-fill-btn {
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.auto-fill-btn:hover {
    background-color: #0d62d9;
    transform: translateY(-1px);
}

/* 删除日期按钮 */
.delete-date-btn {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #c62828;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.delete-date-btn:hover:not(:disabled) {
    background-color: #ffcdd2;
}

.delete-date-btn:disabled {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
}

/* 自动填充说明 */
.auto-fill-notice {
    background-color: #e8f0fe;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #1a73e8;
    font-size: 14px;
}

.auto-fill-notice i {
    color: #1a73e8;
    margin-right: 8px;
    font-size: 16px;
}

.auto-fill-notice strong {
    color: #1a73e8;
}

/* 键盘快捷键提示 */
.keyboard-shortcuts {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    font-size: 13px;
}

.keyboard-shortcuts h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

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

.shortcut-key {
    background-color: #333;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
}

/* 统计卡片增强 */
.stats-card .stat-item {
    position: relative;
    overflow: hidden;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #1a73e8, #34a853);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.stat-item:hover::after {
    transform: scaleX(1);
}

/* 响应式设计增强 */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .card {
        margin-bottom: 20px;
    }
}

@media (max-width: 992px) {
    .header-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 20px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .schedule-table {
        font-size: 13px;
    }
    
    .time-slot-header {
        width: 60px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 85vh;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .date-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .date-input-group .form-control {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .schedule-table {
        font-size: 12px;
    }
    
    .time-slot-header {
        width: 50px;
        font-size: 12px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 4px;
    }
    
    .schedule-content {
        font-size: 11px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .toast {
        max-width: 90%;
        margin: 0 auto;
    }
}

/* 打印样式增强 */
@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }
    
    body {
        font-size: 10pt !important;
    }
    
    .print-header {
        margin-bottom: 1.5cm;
    }
    
    .employee-info {
        font-size: 9pt;
    }
    
    .schedule-table {
        font-size: 9pt;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 4px 3px;
    }
    
    /* 确保表格不被分割 */
    table {
        page-break-inside: avoid;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    /* 隐藏所有按钮和交互元素 */
    .btn, 
    .action-btn, 
    .schedule-actions,
    .card-actions,
    .controls,
    .week-navigation,
    .location-info,
    .date-edit-icon,
    .toggle-dayoff-btn {
        display: none !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .toast {
        background-color: rgba(30, 30, 30, 0.95);
    }
    
    .confirm-dialog {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    .confirm-header {
        background-color: #3d3d3d;
        border-bottom-color: #444;
    }
    
    .confirm-footer {
        background-color: #3d3d3d;
        border-top-color: #444;
    }
    
    .date-input-group {
        background-color: #3d3d3d;
        border-color: #444;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 聚焦样式 */
:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* 禁用状态样式 */
:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 用户管理相关样式 */
.current-user-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 14px;
    color: white;
    margin-left: auto;
}

.admin-badge {
    background-color: #fbbc04;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 用户切换菜单 */
.user-switch-menu {
    position: relative;
    display: inline-block;
}

.user-switch-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

    .user-switch-btn:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px 0;
    z-index: 1000;
    display: none;
}

    .user-dropdown.show {
        display: block;
    }

.user-dropdown-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #333;
}

    .user-dropdown-item:hover {
        background-color: #f5f5f5;
    }

    .user-dropdown-item i {
        color: #666;
        width: 20px;
        text-align: center;
    }

.user-dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 5px 0;
}