/* =====================================================
   教学签到系统 - 公共样式表
   清新科技风 | 浅色玻璃态 | 流畅动画
   文件名: css/common.css
   ===================================================== */

/* ---- CSS 变量定义 ---- */
:root {
    /* 核心色彩 - 浅色体系 */
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-card-hover: rgba(255, 255, 255, 0.92);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --border-glass: rgba(99, 102, 241, 0.12);
    --border-soft: rgba(148, 163, 184, 0.2);

    /* 强调色 */
    --accent-cyan: #0ea5e9;
    --accent-purple: #6366f1;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;
    --accent-indigo: #6366f1;

    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    --gradient-cyan: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --gradient-bg: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 40%, #f8fafc 100%);
    --gradient-bg-alt: linear-gradient(120deg, #e0e7ff 0%, #ddd6fe 100%);

    /* 文字 */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    --text-on-gradient: #ffffff;

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;

    /* 阴影 - 浅色系精致阴影 */
    --shadow-sm: 0 1px 3px rgba(99, 102, 241, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(99, 102, 241, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(99, 102, 241, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-glow: 0 4px 20px rgba(99, 102, 241, 0.15);
    --shadow-glow-purple: 0 4px 20px rgba(99, 102, 241, 0.15);
    --shadow-glow-cyan: 0 4px 20px rgba(14, 165, 233, 0.15);

    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* 旧版表单页变量别名 —— 兼容 addstu/uptec 等内联样式，统一映射到科技风主题 */
    --primary: #6366f1;
    --secondary: #0ea5e9;
    --primary-light: #818cf8;
    --dark: #1e293b;
    --light: #f8fafc;
    --border-color: rgba(148, 163, 184, 0.2);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 背景装饰光晕 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 85%, rgba(14, 165, 233, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ---- 容器 ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.container-fluid {
    width: 100%;
    padding: var(--space-lg);
}

/* ---- 卡片组件 ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2, .card-header h3 {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-header h2::before, .card-header h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: var(--gradient-cyan);
    border-radius: var(--radius-full);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ---- 页面头部 ---- */
.page-header {
    text-align: center;
    padding: var(--space-2xl) 0;
    position: relative;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-cyan);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
    letter-spacing: 2px;
}

.page-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.page-header .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

/* ---- 按钮组件 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    color: white;
    line-height: 1.5;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary { background: var(--gradient-primary); }
.btn-cyan { background: var(--gradient-cyan); }
.btn-blue { background: var(--gradient-blue); }
.btn-success { background: var(--gradient-success); }
.btn-warning { background: var(--gradient-warning); }
.btn-danger { background: var(--gradient-danger); }

.btn-sm { padding: 6px 16px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; display: flex; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(14, 165, 233, 0.06);
}

.btn-ghost {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--accent-purple);
}

.btn-ghost:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

/* ---- 表格组件 ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.data-table thead {
    background: rgba(99, 102, 241, 0.06);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--accent-purple);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-soft);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.data-table tbody tr:hover td {
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格响应式 */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
}

/* ---- 通用文字工具类 ---- */
.text-muted {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ---- 基础数据表格（.table） ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-card);
}
.table th, .table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}
.table thead th {
    background: rgba(99, 102, 241, 0.07);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}
.table-sm th, .table-sm td {
    padding: 8px 12px;
}

/* ---- 提示框（alert） ---- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-md);
    margin: 14px 0;
    font-size: 0.92rem;
    line-height: 1.6;
    border: 1px solid transparent;
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #047857;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #b45309;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.32);
    color: #b91c1c;
}

/* ---- 状态标签 ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); }
.badge-info { background: rgba(14, 165, 233, 0.12); color: var(--accent-cyan); }
.badge-purple { background: rgba(99, 102, 241, 0.12); color: var(--accent-purple); }

/* ---- 表单组件 ---- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: rgba(255, 255, 255, 0.95);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ---- 搜索栏 ---- */
.search-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.search-bar .form-control {
    flex: 1;
    min-width: 200px;
}

/* ---- 分页组件 ---- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    padding: var(--space-md) 0;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.pagination a:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: var(--border-soft);
    color: var(--accent-purple);
}

.pagination .current {
    background: var(--gradient-cyan);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* ---- 统计卡片 ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-cyan);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-cyan);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

/* ---- 工具栏 ---- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md) 0;
}

/* ---- 表单卡片（添加/编辑页统一复用） ---- */
.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.form-card-header {
    background: var(--gradient-primary);
    color: white;
    padding: 20px 24px;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-card-body {
    padding: var(--space-xl);
}

/* 表单专属补充（深色输入框/提交按钮，统一科技风） */
.form-card-body .input-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-fast);
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    font-family: inherit;
}

.form-card-body .input-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
    background: #fff;
}

.form-card-body .submit-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 16px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-glow);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.form-card-body .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.form-card-body .submit-btn:active {
    transform: translateY(1px);
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ---- 导航面包屑 ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--accent-purple);
}

.breadcrumb .separator {
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-primary);
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.4;
    color: var(--accent-purple);
}

/* ---- 加载动画 ---- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-soft);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* ---- Toast 通知 ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    pointer-events: all;
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error { border-left: 3px solid var(--accent-red); }
.toast-warning { border-left: 3px solid var(--accent-orange); }
.toast-info { border-left: 3px solid var(--accent-cyan); }

/* ---- 确认对话框 ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-box {
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ---- 响应式布局 ---- */
@media (max-width: 768px) {
    .page-header h1 { font-size: 1.8rem; }
    .page-header .brand { font-size: 1.2rem; }
    .container { padding: var(--space-md); }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { width: 100%; justify-content: center; }
    .search-bar { flex-direction: column; }
    .data-table th, .data-table td { padding: 10px; font-size: 0.85rem; }
    .card-header { flex-direction: column; gap: var(--space-md); align-items: flex-start; }
    .toast-container { left: 10px; right: 10px; }
    .toast { min-width: auto; width: 100%; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .page-header { padding: var(--space-xl) 0; }
    .btn { padding: 10px 16px; font-size: 0.9rem; }
}

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

::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.6);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* ---- 打印样式 ---- */
@media print {
    body { background: white !important; color: black !important; }
    body::before { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; background: white !important; }
    .btn, .toolbar, .pagination { display: none !important; }
}
