/* ============================================
   员工工时打卡系统 - 蓝白主题样式
   设计风格：简洁、新颖、蓝白配色
   ============================================ */

/* CSS变量 - 蓝白主题 */
:root {
    --primary: #2563EB;
    --primary-light: #3B82F6;
    --primary-lighter: #93C5FD;
    --primary-dark: #1D4ED8;
    --primary-bg: #EFF6FF;
    --primary-gradient: linear-gradient(135deg, #2563EB, #1D4ED8);
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #06B6D4;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --bg-white: #FFFFFF;
    --bg-gray: #F8FAFC;
    --bg-light: #F1F5F9;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-primary);
    background: var(--bg-gray);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary);
}

ul, ol {
    list-style: none;
}

/* ============================================
   移动端公共布局
   ============================================ */
.mobile-page {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-white);
    position: relative;
}

.mobile-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px 20px 30px;
    position: relative;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.mobile-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mobile-header p {
    font-size: 14px;
    opacity: 0.85;
}

.mobile-body {
    padding: 20px;
    margin-top: -10px;
}

/* ============================================
   表单组件
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

textarea.form-input {
    height: auto;
    padding: 12px 16px;
    resize: vertical;
    min-height: 100px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* 验证码输入组 */
.input-group {
    display: flex;
    gap: 10px;
}

.input-group .form-input {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 16px;
    height: 46px;
    font-size: 14px;
}

/* ============================================
   按钮组件
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    gap: 6px;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-outline {
    background: var(--bg-white);
    color: var(--primary);
    border: 1.5px solid var(--primary-lighter);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    height: 52px;
    font-size: 16px;
}

/* ============================================
   卡片组件
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================
   提示条
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert-danger {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background: var(--primary-bg);
    color: var(--primary-dark);
    border: 1px solid var(--primary-lighter);
}

/* ============================================
   弹窗组件
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    flex: 1;
}

/* ============================================
   导航/菜单
   ============================================ */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    width: 100%;
    background: var(--bg-white);
    display: flex;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 6px;
    color: var(--text-muted);
    font-size: 11px;
    transition: color 0.2s;
    cursor: pointer;
    border: none;
    background: none;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active svg {
    stroke: var(--primary);
}

/* ============================================
   状态标签
   ============================================ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-success {
    background: #D1FAE5;
    color: #065F46;
}

.tag-warning {
    background: #FEF3C7;
    color: #92400E;
}

.tag-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.tag-info {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

/* ============================================
   打卡状态大展示
   ============================================ */
.clock-status {
    text-align: center;
    padding: 30px 20px;
}

.clock-status-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 36px;
}

.clock-status-icon.checked-in {
    background: var(--primary-bg);
    color: var(--primary);
}

.clock-status-icon.not-checked {
    background: #F1F5F9;
    color: var(--text-muted);
}

.clock-status-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.clock-status-time {
    font-size: 14px;
    color: var(--text-secondary);
}

.clock-btn {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: none;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.clock-btn.clock-in {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.clock-btn.clock-out {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.clock-btn:active {
    transform: scale(0.95);
}

.clock-btn .time {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
}

/* ============================================
   列表组件
   ============================================ */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-info {
    flex: 1;
}

.list-item-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.list-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.list-item-action {
    flex-shrink: 0;
}

/* ============================================
   统计卡片
   ============================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card .num {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-card.green .num { color: var(--success); }
.stat-card.orange .num { color: var(--warning); }
.stat-card.red .num { color: var(--danger); }

/* ============================================
   日历组件
   ============================================ */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.calendar-weekdays span {
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 2px;
}

.calendar-day {
    padding: 10px 0;
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-day:hover {
    background: var(--primary-bg);
}

.calendar-day.other-month {
    color: var(--text-muted);
}

.calendar-day.today {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.calendar-day.has-record {
    font-weight: 600;
}

.calendar-day .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

/* ============================================
   管理后台
   ============================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
}

.admin-sidebar-logo {
    padding: 0 20px 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.admin-sidebar-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.admin-sidebar-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 500;
    border-right: 3px solid var(--primary);
}

.admin-sidebar-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.admin-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 管理后台表格 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th {
    background: var(--bg-gray);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg-gray);
}

/* 管理后台分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination .page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.pagination .page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

.filter-bar .form-input {
    width: auto;
    min-width: 150px;
    height: 38px;
    font-size: 13px;
}

.filter-bar .btn {
    height: 38px;
    font-size: 13px;
}

/* ============================================
   进度条
   ============================================ */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-light);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============================================
   复选框
   ============================================ */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
}

/* ============================================
   加载状态
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 页面加载骨架 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--border) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeletonShine 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   管理后台移动端适配
   ============================================ */
.admin-mobile-header {
    display: none;
    background: var(--primary-gradient);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-mobile-header .menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ============================================
   通知气泡
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
}

/* ============================================
   登录/注册页面特殊样式
   ============================================ */
.auth-page {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-white);
    display: flex;
    flex-direction: column;
}

.auth-header {
    background: var(--primary-gradient);
    padding: 60px 30px 40px;
    text-align: center;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.auth-header .auth-icon {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
}

.auth-header h1 {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.auth-body {
    padding: 30px 24px;
    flex: 1;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }
    
    .admin-sidebar.mobile-show {
        display: block;
        width: 260px;
        box-shadow: var(--shadow-lg);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 16px;
    }
    
    .admin-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .form-input {
        width: 100%;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (min-width: 769px) {
    .mobile-page {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    
    .mobile-nav {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
