/* ==================== 隐患智巡 - 公共样式 ==================== */
/* 版本: 1.0.0 | 更新: 2024-12-29 */

:root {
    --primary: #1677FF;
    --primary-dark: #0958D9;
    --primary-light: #E6F7FF;
    --success: #52C41A;
    --success-light: #F6FFED;
    --warning: #FAAD14;
    --warning-light: #FFF7E6;
    --danger: #FF4D4F;
    --danger-light: #FFF1F0;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --text: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border: #E8E8E8;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    vertical-align: middle;
}

/* ==================== 移动端容器 ==================== */
.mobile-container {
    max-width: 450px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* ==================== 头部导航 ==================== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-back {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.9;
    transition: var(--transition);
}

.header-back:hover {
    opacity: 1;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.header-action {
    font-size: 18px;
    cursor: pointer;
    opacity: 0.9;
    transition: var(--transition);
}

.header-action:hover {
    opacity: 1;
}

/* ==================== 底部导航 ==================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 450px;
    background: white;
    display: flex;
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
}

.tab-item:hover {
    color: var(--primary);
}

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

.tab-item i {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

.tab-item span {
    font-size: 11px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title .more {
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    font-weight: normal;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #389E0D 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(0,0,0,0.04);
}

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

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

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-select {
    appearance: none;
    background: white 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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding-right: 36px;
}

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

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* ==================== 状态标签 ==================== */
.status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: var(--warning-light);
    color: #D46B08;
}

.status-processing {
    background: var(--primary-light);
    color: #1890FF;
}

.status-completed {
    background: var(--success-light);
    color: #52C41A;
}

.status-high {
    background: var(--danger-light);
    color: #CF1322;
}

.status-medium {
    background: var(--warning-light);
    color: #D46B08;
}

.status-low {
    background: var(--success-light);
    color: #52C41A;
}

/* ==================== 列表样式 ==================== */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

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

.list-item:hover {
    background: rgba(0,0,0,0.02);
    margin: 0 -16px;
    padding: 14px 16px;
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.list-item-content {
    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-arrow {
    color: var(--text-light);
    font-size: 14px;
}

.list-item-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* ==================== 加载状态 ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

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

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

.loading-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== Toast提示 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    max-width: 80%;
    text-align: center;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==================== 时间线 ==================== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border);
}

.timeline-item.completed::before {
    background: var(--success);
    border-color: var(--success);
}

.timeline-item.active::before {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.2);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
    line-height: 1.6;
}

/* ==================== 管理后台布局 ==================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #001529 0%, #002140 100%);
    color: white;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-logo i {
    font-size: 24px;
    color: var(--primary);
}

.admin-menu {
    padding: 16px 0;
}

.admin-menu-group {
    margin-bottom: 8px;
}

.admin-menu-label {
    padding: 8px 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-menu-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    text-decoration: none;
}

.admin-menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.admin-menu-item.active {
    background: var(--primary);
    color: white;
}

.admin-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.admin-main {
    flex: 1;
    margin-left: 240px;
    background: #F0F2F5;
    min-height: 100vh;
}

.admin-header {
    background: white;
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.admin-breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.admin-breadcrumb a:hover {
    color: var(--primary);
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.admin-notification {
    position: relative;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
}

.admin-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.admin-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.admin-content {
    padding: 24px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-trend {
    font-size: 12px;
    margin-top: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ==================== 图表卡片 ==================== */
.chart-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-container {
    height: 300px;
}

/* ==================== 数据表格 ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #FAFAFA;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table td {
    font-size: 14px;
}

.data-table tr:hover td {
    background: #FAFAFA;
}

.data-table-actions {
    display: flex;
    gap: 12px;
}

.data-table-actions a {
    font-size: 13px;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-info {
    
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

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

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

/* ==================== 工具类 ==================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
