/**
 * 智能考勤系统 - 全局样式
 * 适用于所有页面
 */

/* ===== 基础样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== 通用组件 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover {
    background: #5a6fd6;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #34a853;
    color: white;
}
.btn-success:hover {
    background: #2d9248;
}

.btn-danger {
    background: #e53935;
    color: white;
}
.btn-danger:hover {
    background: #c62828;
}

.btn-warning {
    background: #f9a825;
    color: white;
}
.btn-warning:hover {
    background: #f57f17;
}

.btn-secondary {
    background: #e8e8e8;
    color: #555;
}
.btn-secondary:hover {
    background: #ddd;
}

.btn-sm {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 5px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 输入框 */
.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-field::placeholder {
    color: #bbb;
}

.input-field.error {
    border-color: #e53935;
}

.input-field.success {
    border-color: #34a853;
}

textarea.input-field {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #e8f0fe;
    color: #1a73e8;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.empty-state h3 {
    font-size: 18px;
    color: #555;
    margin-bottom: 8px;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 弹窗/模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-box .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-box .modal-header h3 {
    font-size: 20px;
    color: #333;
}

.modal-box .modal-header .close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 0 8px;
}

.modal-box .modal-header .close:hover {
    color: #333;
}

.modal-box .modal-body {
    margin-bottom: 20px;
}

.modal-box .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
    margin: 10px 0;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-wrap table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}

.table-wrap table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table-wrap table tr:hover td {
    background: #fafafa;
}

.table-wrap table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== 网格布局 ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ===== 响应式 ===== */
@media (max-width: 992px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .modal-box {
        padding: 20px;
        margin: 10px;
    }
    
    .table-wrap table {
        font-size: 13px;
    }
    
    .table-wrap table th,
    .table-wrap table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .input-field {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .modal-box {
        padding: 16px;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .table-wrap table th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}