/* ============================================
   校园报修后台管理系统样式
   ============================================ */

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

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #DBEAFE;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #6366F1;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --border: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   应用容器
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   侧边栏
   ============================================ */

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    position: relative;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

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

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-weight: 600;
    color: var(--gray-900);
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================
   主内容区
   ============================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.topbar-right {
    display: flex;
    gap: 12px;
}

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* ============================================
   按钮样式
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

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

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

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

.btn-danger:hover {
    background: #DC2626;
}

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

.btn-success:hover {
    background: #059669;
}

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

/* ============================================
   表单样式
   ============================================ */

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    text-align: right;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

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

/* ============================================
   统计卡片
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon-blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.stat-icon-yellow { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-icon-green { background: linear-gradient(135deg, #10B981, #059669); }
.stat-icon-red { background: linear-gradient(135deg, #EF4444, #DC2626); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* ============================================
   快捷操作
   ============================================ */

.quick-actions {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.quick-actions h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-900);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--gray-50);
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-600);
}

.action-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================
   最近报修
   ============================================ */

.recent-repairs {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.repair-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repair-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.repair-item:hover {
    background: var(--primary-light);
}

.repair-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.repair-item-info {
    flex: 1;
}

.repair-item-title {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.repair-item-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.repair-item-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   筛选栏
   ============================================ */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.filter-group .form-input,
.filter-group .form-select {
    min-width: 140px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: var(--gray-400);
}

.search-box .form-input {
    padding-left: 36px;
}

/* ============================================
   数据表格
   ============================================ */

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.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: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table td {
    color: var(--gray-600);
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-400);
}

.empty-state svg {
    margin-bottom: 16px;
}

/* ============================================
   状态标签
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #FEF3C7;
    color: #D97706;
}

.status-processing {
    background: #DBEAFE;
    color: #2563EB;
}

.status-completed {
    background: #D1FAE5;
    color: #059669;
}

.status-rejected {
    background: #FEE2E2;
    color: #DC2626;
}

/* ============================================
   类型标签
   ============================================ */

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.type-water {
    background: #E0F2FE;
    color: #0284C7;
}

.type-facility {
    background: #F3E8FF;
    color: #9333EA;
}

.type-network {
    background: #FEF3C7;
    color: #D97706;
}

.type-other {
    background: #F1F5F9;
    color: #64748B;
}

/* ============================================
   分页
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-600);
}

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

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

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

/* ============================================
   弹窗
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

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

.modal-sm { width: 400px; }
.modal-md { width: 500px; }
.modal-lg { width: 700px; }

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

/* ============================================
   详情内容
   ============================================ */

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--gray-500);
}

.detail-value {
    font-size: 14px;
    color: var(--gray-900);
}

.detail-description {
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    color: var(--gray-700);
    line-height: 1.6;
}

/* ============================================
   进度时间线
   ============================================ */

.progress-timeline {
    margin-top: 16px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding-bottom: 20px;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 30px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-icon.create { background: var(--primary-light); color: var(--primary); }
.timeline-icon.assign { background: #F3E8FF; color: #9333EA; }
.timeline-icon.update { background: #DBEAFE; color: #2563EB; }
.timeline-icon.complete { background: #D1FAE5; color: #059669; }
.timeline-icon.reject { background: #FEE2E2; color: #DC2626; }

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.timeline-time {
    font-size: 12px;
    color: var(--gray-500);
}

.timeline-note {
    margin-top: 8px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray-600);
}

/* ============================================
   日志时间线
   ============================================ */

.log-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.log-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

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

/* ============================================
   统计图表
   ============================================ */

.statistics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

.type-chart,
.status-chart {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.chart-item {
    text-align: center;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 8px;
}

.chart-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.chart-label {
    font-size: 13px;
    color: var(--gray-500);
}

.chart-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.trend-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.trend-label {
    width: 80px;
    font-size: 13px;
    color: var(--gray-600);
}

.trend-bar-container {
    flex: 1;
    height: 40px;
    background: var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.trend-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    color: white;
    font-weight: 600;
    transition: width 0.5s ease;
}

/* ============================================
   设置
   ============================================ */

.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

.staff-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.staff-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.staff-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.staff-item-info {
    flex: 1;
}

.staff-item-name {
    font-weight: 500;
    color: var(--gray-900);
}

.staff-item-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================
   开关控件
   ============================================ */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ============================================
   响应式
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .filter-bar {
        flex-direction: column;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95% !important;
        max-height: 95vh;
    }

    .statistics-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   动画
   ============================================ */

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

.page.active {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   打印样式
   ============================================ */

@media print {
    .sidebar,
    .topbar,
    .filter-bar,
    .pagination,
    .modal-footer,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .table-container {
        box-shadow: none;
    }
}
