/* ============================================================
 * 公安视频监控运维平台 - 主样式表
 * ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1a3a5c;
    --primary-dark: #0d2137;
    --primary-light: #2c5282;
    --accent: #c9a84c;
    --accent-light: #e2c97e;
    --danger: #c0392b;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #2980b9;
    --bg-dark: #0f1923;
    --bg-card: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --border-color: #e0e5ec;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.18);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
                 "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: #f0f2f5;
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================================
 * Login Page
 * ============================================================ */
.login-page {
    background: linear-gradient(135deg, #0d2137 0%, #1a3a5c 40%, #1a5276 70%, #1a3a5c 100%);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.login-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
}

.bg-grid {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* 容器 */
.login-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    gap: 60px;
}

.login-container {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    max-width: 1050px;
    width: 100%;
}

/* 卡片 */
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 80px rgba(26,58,92,0.3);
    padding: 45px 40px;
    width: 420px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-dark), var(--accent), var(--primary-dark));
}

/* 头部 */
.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-badge {
    margin-bottom: 18px;
    display: inline-block;
    animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Flash消息 */
.flash-container {
    margin-bottom: 20px;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 8px;
    animation: slideDown 0.3s ease-out;
}

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

.flash-error {
    background: #fdf0ef;
    color: var(--danger);
    border: 1px solid #f5d0cc;
}

.flash-success {
    background: #eafaf1;
    color: var(--success);
    border: 1px solid #d0f0d8;
}

.flash-warning {
    background: #fef9e7;
    color: #d68910;
    border: 1px solid #fce4b8;
}

.flash-info {
    background: #ebf5fb;
    color: var(--info);
    border: 1px solid #d0e8f7;
}

.flash-icon { font-size: 16px; flex-shrink: 0; }

/* 表单 */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.label-icon { color: var(--primary-light); }

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: #fafbfc;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44,82,130,0.1);
}

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

/* 记住我 */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    display: none !important;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background: #fff;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.checkbox-input:checked + .checkbox-custom {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.checkbox-input:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 6px; height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    box-shadow: 0 4px 20px rgba(26,58,92,0.4);
    transform: translateY(-1px);
}

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

.btn-login::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-login:active::after {
    width: 300px; height: 300px;
}

/* 底部 */
.login-footer {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    color: var(--success) !important;
}

/* 右侧信息卡片 */
.login-side-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
}

.side-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #ecf0f1;
}

.side-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--accent-light);
    letter-spacing: 1px;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.feature-list li:hover {
    background: rgba(255,255,255,0.08);
}

.feat-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.feature-list strong {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
    color: #fff;
}

.feature-list small {
    font-size: 12px;
    color: #a0b4c8;
    line-height: 1.5;
}

.contact-card {
    text-align: center;
}

.contact-card p {
    font-size: 13px;
    color: #a0b4c8;
    margin-bottom: 8px;
}

.contact-phone {
    font-size: 18px !important;
    font-weight: 700;
    color: var(--accent-light) !important;
    letter-spacing: 1px;
}

/* ============================================================
 * Dashboard Page
 * ============================================================ */
.dashboard-page {
    background: #f0f2f5;
    min-height: 100vh;
}

/* 顶部导航 */
.top-nav {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
}

.nav-brand svg { flex-shrink: 0; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user-info {
    text-align: right;
}

.nav-user-name {
    font-size: 14px;
    font-weight: 600;
}

.nav-user-role {
    font-size: 11px;
    color: #a0b4c8;
}

.btn-logout {
    padding: 8px 18px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: transparent;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

/* 内容区 */
.main-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 24px;
    color: var(--primary-dark);
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

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

.stat-card.total { border-left-color: var(--info); }
.stat-card.online { border-left-color: var(--success); }
.stat-card.offline { border-left-color: var(--warning); }
.stat-card.fault { border-left-color: var(--danger); }
.stat-card.pending { border-left-color: #8e44ad; }
.stat-card.processing { border-left-color: #16a085; }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.total .stat-icon { background: #ebf5fb; }
.online .stat-icon { background: #eafaf1; }
.offline .stat-icon { background: #fef9e7; }
.fault .stat-icon { background: #fdf0ef; }
.pending .stat-icon { background: #f4ecf7; }
.processing .stat-icon { background: #e8f8f5; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* 表格 */
.table-container {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-container h3 {
    padding: 18px 24px;
    font-size: 16px;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fb;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.status-online {
    background: #eafaf1;
    color: var(--success);
}

.status-offline {
    background: #fef9e7;
    color: #d68910;
}

.status-fault {
    background: #fdf0ef;
    color: var(--danger);
}

.status-disabled {
    background: #eaeded;
    color: #7f8c8d;
}

/* Flash容器(通用) */
.flash-messages {
    margin-bottom: 20px;
}

/* ============================================================
 * Responsive
 * ============================================================ */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        align-items: center;
    }

    .login-card {
        width: 100%;
        max-width: 420px;
    }

    .login-side-info {
        display: none;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .login-card {
        padding: 30px 24px;
    }

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

    .main-content {
        padding: 15px;
    }
}

/* ============================================================
 * 通用组件
 * ============================================================ */

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 文字 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* 间距 */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-light);
    color: #fff;
}

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

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

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

.empty-state svg {
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}
