/* ============================================
   请销假系统 - 全局样式表
   色彩规范：
   主色：#1E40AF (深蓝) - 代表权威、专业
   主色浅：#3B82F6 (蓝) - 交互元素
   辅助色：#059669 (绿) - 成功/通过
   中性色：#1F2937 (深灰) - 文字
   中性色浅：#F3F4F6 (浅灰) - 背景
   功能色-警告：#D97706 (橙)
   功能色-错误：#DC2626 (红)
   功能色-信息：#2563EB (蓝)
   ============================================ */

:root {
    --primary: #1E40AF;
    --primary-light: #3B82F6;
    --primary-lighter: #DBEAFE;
    --secondary: #059669;
    --secondary-light: #10B981;
    --neutral-dark: #1F2937;
    --neutral: #6B7280;
    --neutral-light: #F3F4F6;
    --neutral-border: #E5E7EB;
    --warning: #D97706;
    --error: #DC2626;
    --info: #2563EB;
    --white: #FFFFFF;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--neutral-light);
    color: var(--neutral-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 通用容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 卡片样式 */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--secondary);
    color: var(--white);
}

.btn-success:hover {
    background: var(--secondary-light);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-lighter);
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--neutral-dark);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--neutral-border);
    border-radius: 8px;
    font-size: 16px; /* 防止iOS缩放 */
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--neutral-border);
    border-radius: 8px;
    font-size: 16px; /* 防止iOS缩放 */
    background: var(--white);
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    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='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 表格样式 */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -24px;
    padding: 0 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 500px;
}

.data-table th {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--neutral-border);
}

.data-table tr:hover {
    background: var(--neutral-light);
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-pending {
    background: #FEF3C7;
    color: #92400E;
}

.badge-approved {
    background: #D1FAE5;
    color: #065F46;
}

.badge-rejected {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-cancelled {
    background: #E5E7EB;
    color: #374151;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, #1E3A8A 100%);
    color: var(--white);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.navbar-brand svg {
    width: 28px;
    height: 28px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.navbar-menu a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.15);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

/* 侧边栏 - 移动端 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--white);
    z-index: 1002;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 24px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #1E3A8A 100%);
    color: var(--white);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: var(--neutral-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--neutral-border);
    transition: background 0.2s;
    font-size: 15px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--primary-lighter);
    color: var(--primary);
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

/* 页面标题 */
.page-header {
    padding: 20px 0;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--neutral-dark);
    word-break: break-word;
}

.page-subtitle {
    font-size: 14px;
    color: var(--neutral);
    margin-top: 4px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--neutral-dark);
}

.stat-label {
    font-size: 12px;
    color: var(--neutral);
    white-space: nowrap;
}

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--neutral-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--neutral);
    padding: 4px 8px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--neutral-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--white);
    border-radius: 0 0 16px 16px;
}

/* 签名画布 */
.signature-pad {
    border: 2px dashed var(--neutral-border);
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}

/* 审批流程 */
.approval-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
}

.approval-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.approval-node {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    min-width: 70px;
}

.approval-node.completed {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.approval-node.current {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.approval-node.pending {
    background: var(--neutral-light);
    color: var(--neutral);
    border: 1px solid var(--neutral-border);
}

.approval-arrow {
    color: var(--neutral);
    font-size: 16px;
}

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: var(--white);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 320px;
    word-break: break-word;
}

.toast-success {
    background: var(--secondary);
}

.toast-error {
    background: var(--error);
}

.toast-info {
    background: var(--info);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   响应式设计 - 平板 (≤1024px)
   ============================================ */
@media (max-width: 1024px) {
    .navbar-menu a {
        padding: 6px 8px;
        font-size: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   响应式设计 - 手机 (≤768px)
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .menu-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
    }

    .navbar-user span {
        display: none;
    }

    .navbar {
        height: 56px;
        padding: 0 12px;
    }

    .navbar-brand {
        font-size: 16px;
    }

    .navbar-brand svg {
        width: 24px;
        height: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .card {
        padding: 16px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    .page-header {
        padding: 16px 0;
    }

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    .approval-flow {
        flex-direction: column;
        align-items: stretch;
    }

    .approval-node {
        width: 100%;
        padding: 8px 12px;
    }

    .approval-arrow {
        transform: rotate(90deg);
        text-align: center;
        display: block;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .table-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    /* 快捷操作按钮网格 - 手机端2列 */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   响应式设计 - 小屏手机 (≤480px)
   ============================================ */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .stat-value {
        font-size: 18px;
    }

    .navbar {
        padding: 0 10px;
    }

    .navbar-brand {
        font-size: 14px;
        gap: 6px;
    }

    .card {
        padding: 14px;
    }

    .page-title {
        font-size: 18px;
    }

    .modal-title {
        font-size: 15px;
    }

    .form-input,
    .form-select {
        padding: 10px 12px;
        font-size: 16px;
    }

    .toast {
        max-width: calc(100vw - 40px);
        font-size: 13px;
        padding: 10px 14px;
    }

    .toast-container {
        right: 10px;
        top: 64px;
    }
}

/* ============================================
   安全区域适配 (iPhone X+ 刘海屏)
   ============================================ */
@supports (padding: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
        height: calc(60px + env(safe-area-inset-top));
    }

    .sidebar-header {
        padding-top: calc(24px + env(safe-area-inset-top));
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    .navbar,
    .sidebar,
    .sidebar-overlay,
    .btn,
    .no-print,
    .menu-toggle,
    .toast-container {
        display: none !important;
    }

    body {
        background: white;
        font-size: 12pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}
