/* TRAE系数工时测算工具 - 主样式文件 */

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

:root {
    --primary: #667eea;
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --text: #2c3e50;
    --muted: #6c757d;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e5e7eb;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

/* 头部站点图标（与 favicon 同步） */
.logo .logo-icon,
img.logo-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.35em;
    vertical-align: text-bottom;
    border-radius: 0.2em;
    object-fit: cover;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-menu a.active {
    background: rgba(255,255,255,0.18);
    padding: 6px 10px;
    border-radius: 8px;
}

.nav-menu a:hover {
    opacity: 0.8;
}

/* 主要内容区域 */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
    border-bottom: 2px solid #f1f3f4;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* 欢迎块与头像样式 */
.welcome-block {
    display: flex;
    align-items: center;
    gap: 16px;
}
.welcome-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}
.welcome-avatar i {
    font-size: 96px;
    color: #cfd8dc;
}
.welcome-text h1 {
    margin-bottom: 6px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(0,0,0,0.1);
    color: #333;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    text-align: left;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.table tbody tr:hover {
    background-color: #f5f5f5;
}

.table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

/* 表单网格 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-group-full {
    grid-column: 1 / -1;
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 0.25rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-primary {
    color: #fff;
    background-color: #007bff;
}

.badge-success {
    color: #fff;
    background-color: #28a745;
}

.badge-info {
    color: #fff;
    background-color: #17a2b8;
}

.badge-warning {
    color: #212529;
    background-color: #ffc107;
}

.badge-danger {
    color: #fff;
    background-color: #dc3545;
}

/* 提示框样式 */
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    transition: opacity 0.3s ease;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-error,
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* 文本工具类 */
.text-muted {
    color: #6c757d !important;
}

.text-center {
    text-align: center !important;
}

/* 间距工具类 */
.mb-3 {
    margin-bottom: 1rem !important;
}

.p-3 {
    padding: 1rem !important;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid #007bff;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.stat-card.success {
    border-left-color: #28a745;
}

.stat-card.warning {
    border-left-color: #ffc107;
}

.stat-card.info {
    border-left-color: #17a2b8;
}

.stat-card.primary {
    border-left-color: #007bff;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-detail {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

/* 图表容器 */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.chart-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .current {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s;
}

.modal .btn {
    min-width: 120px;
    justify-content: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

/* 警告和成功消息 */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.alert-info {
    background-color: #cce7ff;
    border-left-color: #17a2b8;
    color: #0c5460;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 页脚样式 */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 10px;
    color: var(--muted);
}

/* 统一深色模式 */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #60a5fa;
    --secondary: #64748b;
    --success: #34d399;
    --info: #22d3ee;
    --warning: #fbbf24;
    --danger: #f87171;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --bg: #0f172a;
    --surface: #1f2937;
    --border: #374151;
  }

  body { background-color: var(--bg); color: var(--text); }

  .header { background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
  .logo { color: #e5e7eb; }
  .nav-menu a { color: #e5e7eb; }
  .nav-menu a.active { background: rgba(255,255,255,0.12); }

  .card { background: var(--surface); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
  .card-header { border-bottom-color: var(--border); }
  .card-title { color: var(--text); }
  .card-actions .btn-outline { border-color: var(--border); color: var(--text); }

  .chart-container { background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
  .chart-header { border-bottom-color: var(--border); }
  .chart-title { color: var(--text); }

  .form-control, .form-select { background-color: #111827; color: var(--text); border-color: var(--border); }
  .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(96,165,250,0.2); }
  .form-label { color: var(--muted); }

  .table { background-color: var(--surface); color: var(--text); }
  .table thead th { background-color: #111827; color: var(--text); border-bottom-color: var(--border); }
  .table th, .table td { border-color: var(--border); }
  .table tbody tr:hover { background-color: #0b1220; }
  .table tbody tr:nth-child(even) { background-color: #0d1424; }

  .modal { background-color: rgba(2,6,23,0.7); }
  .modal-content { background: var(--surface); color: var(--text); box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
  .modal-header { border-bottom-color: var(--border); }
  .modal-header h3 { color: var(--text); }
  .modal-header .close { color: var(--muted); }
  .modal-header .close:hover { background-color: #111827; color: var(--text); }
  .modal-body textarea { background: #0b1220; color: var(--text); border-color: var(--border); }

  .btn-primary { background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); color: #fff; }
  .btn-success { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); color: #fff; }
  .btn-info { background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%); color: #fff; }
  .btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); color: #111; }
  .btn-danger { background: linear-gradient(135deg, #ef4444 0%, #f87171 100%); color: #fff; }
  .btn-secondary { background: #334155; color: #e5e7eb; }
  .btn-outline { border-color: var(--border); color: var(--text); }
  .btn-outline:hover { border-color: var(--primary); color: var(--primary); }

  .alert { border-left-color: var(--primary); }
  .alert-success { background-color: rgba(16,185,129,0.12); color: #d1fae5; border-left-color: #10b981; }
  .alert-danger { background-color: rgba(239,68,68,0.12); color: #fecaca; border-left-color: #ef4444; }
  .alert-warning { background-color: rgba(245,158,11,0.12); color: #fde68a; border-left-color: #f59e0b; }
  .alert-info { background-color: rgba(6,182,212,0.12); color: #a5f3fc; border-left-color: #06b6d4; }

  .footer { background-color: #0b1220; color: #cbd5e1; }
  .footer-links a { color: #cbd5e1; }
  .footer-links a:hover { opacity: 0.9; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .chart-controls {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .stat-card {
        text-align: center;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图表网格 */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body textarea {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 表单选择器样式 */
.form-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 管理员页面样式 */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.admin-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
}

.admin-card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.admin-card-header i {
    margin-right: 0.5rem;
}

.admin-card-body {
    padding: 1.5rem;
}

.admin-card-body p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
}

/* 系统信息网格 */
.system-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.system-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

.system-info-item strong {
    color: #333;
    font-weight: 600;
}

.system-info-item span {
    color: #666;
    font-family: 'Courier New', monospace;
}

/* 响应式管理员页面 */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .admin-card-header,
    .admin-card-body {
        padding: 1rem;
    }
    
    .system-info-grid {
        grid-template-columns: 1fr;
    }
    
    .system-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* 响应式图表网格 */
@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
