/* -*- coding: utf-8 -*-
   加班倒休管理系统 - 全局样式
   企业级蓝色主题，移动端优先设计
*/

/* ==================== CSS变量 ==================== */
:root {
    --primary-color: #1976D2;
    --primary-light: #2196F3;
    --primary-dark: #1565C0;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border-color: #e0e0e0;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --header-height: 56px;
    --nav-height: 56px;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ==================== 顶部导航 ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left, .header-right {
    width: 48px;
    display: flex;
    align-items: center;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
}

.back-btn, .logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    transition: background 0.2s;
}

.back-btn:hover, .logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== 主内容区 ==================== */
.main-content {
    padding: calc(var(--header-height) + 16px) 16px 16px;
    min-height: 100vh;
}

/* ==================== 容器 ==================== */
.container {
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #e0e0e0;
}

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

.info-label {
    color: var(--text-muted);
}

.info-value {
    font-weight: 500;
}

.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-secondary);
    font-size: 13px;
}

.info-list li:last-child {
    border-bottom: none;
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    color: var(--text-muted);
    font-size: 11px;
    transition: color 0.2s;
}

.nav-item svg {
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary-color);
}

/* ==================== 记录列表 ==================== */
.record-list {
    margin: 0 -16px;
}

.record-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}

.record-item:hover {
    background: #f8f9fa;
}

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

.record-date {
    flex: 1;
    font-size: 13px;
}

.record-date small {
    color: var(--text-muted);
    font-size: 12px;
}

.record-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 12px;
}

.record-hours {
    font-weight: 500;
    color: var(--text-primary);
}

.record-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.status-auto { background: #E8F5E9; color: #4CAF50; }
.status-pending { background: #FFF3E0; color: #FF9800; }
.status-approved { background: #E3F2FD; color: #1976D2; }
.status-rejected { background: #FFEBEE; color: #F44336; }

.arrow {
    margin-left: 8px;
}

.empty-text, .loading-text {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== 用户卡片 ==================== */
.user-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 500;
    margin-right: 16px;
}

.user-detail h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.user-detail p {
    opacity: 0.8;
    font-size: 13px;
}

/* ==================== 操作卡片 ==================== */
.action-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
}

.action-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-item:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.action-item:active {
    transform: scale(0.98);
}

.action-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.action-text h3 {
    font-size: 14px;
    margin-bottom: 2px;
}

.action-text p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== 提示组件 ==================== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #E8F5E9; color: #4CAF50; }
.alert-warning { background: #FFF3E0; color: #FF9800; }
.alert-danger { background: #FFEBEE; color: #F44336; }
.alert-info { background: #E3F2FD; color: #1976D2; }

/* ==================== 加载状态 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 登录页面 ==================== */
.login-container {
    padding-top: 40px;
}

.login-header {
    text-align: center;
    padding: 32px 16px;
}

.logo {
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-card {
    padding: 24px;
}

.login-hint {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.login-tip {
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ==================== 工具类 ==================== */
.link {
    color: var(--primary-color);
    font-size: 13px;
}

.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }

/* ==================== 响应式适配 ==================== */
@media (min-width: 768px) {
    .container {
        max-width: 640px;
    }
    
    .action-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 360px) {
    .action-cards {
        grid-template-columns: 1fr;
    }
}
