/*
 * Django Admin 极简风格样式
 * 老人跌倒检测系统 - 与首页风格统一
 *
 * 设计原则：
 * 1. 无阴影原则 - 所有元素使用1px边框，无box-shadow
 * 2. 留白优先 - 增加padding/margin，让内容呼吸
 * 3. 字体轻重 - 标题用500，正文用400，清晰易读
 * 4. 极简按钮 - 实线边框，无渐变，hover时反转颜色
 */

/* ==================== 全局样式 ==================== */

/* 重置与基础 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-weight: 400;
    background: #fff;
    color: #1a1a1a;
    line-height: 1.6;
}

/* ==================== 容器布局 ==================== */

#container {
    max-width: 100%;
    padding: 0;
    margin: 0;
}

/* ==================== 头部样式 ==================== */

#header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: none;
    padding: 0;
}

#branding h1 {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.5px;
}

#branding a {
    color: #1a1a1a;
    text-decoration: none;
}

/* 用户信息区域 */
#user-tools {
    font-size: 14px;
    font-weight: 400;
}

#user-tools a {
    color: #1a1a1a;
    text-decoration: none;
    margin-left: 20px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

#user-tools a:hover {
    border-bottom-color: #000;
}

/* ==================== 模块卡片样式 ==================== */

.module {
    border: 1px solid #e5e5e5;
    background: #fff;
    box-shadow: none;
    border-radius: 2px;
    margin-bottom: 20px;
}

.module caption {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    text-align: left;
    letter-spacing: 0.5px;
}

.module li {
    border-bottom: 1px solid #f5f5f5;
}

.module li:last-child {
    border-bottom: none;
}

.module a {
    padding: 15px 20px;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.2s;
    display: block;
}

.module a:hover {
    background: #fafafa;
    color: #000;
}

/* ==================== 首页仪表盘 ==================== */

.dashboard-container {
    padding: 0;
    background: #fff;
    min-height: calc(100vh - 100px);
}

/* 统计卡片网格 - 与首页完全一致 */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 40px 20px;
    text-align: center;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    box-shadow: none;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: #000;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.6;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

/* 快捷操作按钮 */
.quick-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.action-btn {
    padding: 10px 25px;
    background: #fff;
    color: #1a1a1a;
    text-decoration: none;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.action-btn:hover {
    background: #1a1a1a;
    color: #fff;
}

.action-btn:hover {
    background: #000;
    color: #fff;
}

.action-btn.alert-btn {
    border-color: #d32f2f;
    color: #d32f2f;
}

.action-btn.alert-btn:hover {
    background: #d32f2f;
    color: #fff;
}

.action-btn.warning-btn {
    border-color: #f57c00;
    color: #f57c00;
}

.action-btn.warning-btn:hover {
    background: #f57c00;
    color: #fff;
}

/* ==================== 列表页面 ==================== */

/* 列表容器 */
.changelist-container {
    background: #fff;
    box-shadow: none;
}

#changelist {
    background: #fff;
    box-shadow: none;
}

/* 内容区域布局 */
.changelist-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.changelist-main {
    flex: 1;
    min-width: 0;
}

/* 工具栏 */
#changelist .toolbar {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 15px 20px;
    border-radius: 2px;
    margin-bottom: 20px;
}

#changelist-form {
    background: #fff;
}

/* 过滤器布局 */
#changelist-filter {
    order: 2;
    flex-shrink: 0;
    width: 240px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    padding: 0;
}

#changelist-filter h2 {
    font-size: 13px;
    font-weight: 600;
    padding: 15px 20px;
    margin: 0;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
}

#changelist-filter h3 {
    font-size: 12px;
    font-weight: 500;
    padding: 12px 20px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

/* 表头 */
#changelist thead th {
    background: #fff;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #e5e5e5;
    border-top: 1px solid #e5e5e5;
    padding: 15px;
    text-align: left;
}

#changelist thead th.sorted {
    font-weight: 600;
    border-bottom: 2px solid #1a1a1a;
}

#changelist thead th .sorticon {
    opacity: 0.3;
}

#changelist thead th.sorted .sorticon {
    opacity: 1;
}

/* 表格行 */
#changelist tbody tr {
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

#changelist tbody tr:hover {
    background: #fafafa;
}

#changelist tbody td {
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
    font-weight: 400;
    color: #1a1a1a;
}

/* 选中的行 */
#changelist tbody tr.selected {
    background: #f0f0f0;
}

/* ==================== 表单样式 ==================== */

/* 表单容器 */
.form-row {
    padding: 20px;
    border-bottom: 1px solid #f5f5f5;
}

.form-row:last-child {
    border-bottom: none;
}

.form-row.errors {
    border: 1px solid #d32f2f;
    background: #fff8f8;
}

/* 表单标签 */
label {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 8px;
    display: inline-block;
}

.required label {
    font-weight: 600;
}

/* 输入框 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 10px 15px;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 400;
    background: #fff;
    transition: border-color 0.2s;
    color: #1a1a1a;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* 只读输入框 */
input[readonly],
textarea[readonly],
select[disabled] {
    background: #fafafa;
    color: #666;
}

/* ==================== 按钮样式 ==================== */

.button,
input[type="submit"],
.button.default,
.submit-row input,
.object-tools a {
    padding: 8px 20px;
    border: 1px solid #1a1a1a;
    background: #fff;
    color: #1a1a1a;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.button:hover,
input[type="submit"]:hover,
.button.default:hover,
.submit-row input:hover,
.object-tools a:hover {
    background: #1a1a1a;
    color: #fff;
}

/* 主按钮（反转样式） */
.button.default,
.submit-row input.default,
.object-tools a:focus {
    background: #1a1a1a;
    color: #fff;
}

.button.default:hover,
.submit-row input.default:hover {
    background: #fff;
    color: #1a1a1a;
}

/* 取消按钮 */
.button.cancel {
    border-color: #666;
    color: #666;
}

.button.cancel:hover {
    background: #666;
    color: #fff;
}

/* 删除按钮 */
.deletelink {
    border-color: #d32f2f;
    color: #d32f2f;
}

.deletelink:hover {
    background: #d32f2f;
    color: #fff;
}

/* ==================== 分页样式 ==================== */

.paginator {
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.paginator a,
.paginator .this-page {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 300;
    text-decoration: none;
    color: #000;
    transition: all 0.2s;
}

.paginator a:hover {
    border-color: #000;
    background: #000;
    color: #fff;
}

.paginator .this-page {
    background: #000;
    color: #fff;
    border-color: #000;
    font-weight: 400;
}

/* ==================== 状态标签 ==================== */

/* 状态颜色 - 保持语义，但使用细边框样式 */
.status-online,
.device-online {
    color: #4caf50;
    font-weight: 400;
}

.status-offline,
.device-offline {
    color: #d32f2f;
    font-weight: 400;
}

.status-pending,
.alert-pending {
    color: #f57c00;
    font-weight: 400;
}

/* 预警严重程度 */
.severity-low {
    color: #1976d2;
}

.severity-medium {
    color: #f57c00;
}

.severity-high {
    color: #d32f2f;
}

.severity-critical {
    color: #d32f2f;
    font-weight: 400;
}

/* ==================== 面板样式 ==================== */

.module h2 {
    font-size: 14px;
    font-weight: 400;
    color: #000;
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    margin: 0;
}

/* ==================== 搜索框样式 ==================== */

#searchbar {
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
}

#searchbar input {
    border: 1px solid #e5e5e5;
    padding: 8px 15px;
    font-weight: 300;
}

/* ==================== 过滤器样式 ==================== */

#changelist-filter {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    padding: 0;
    float: right;
    width: 240px;
    margin-left: 20px;
}

#changelist-filter h2 {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 600;
    font-size: 13px;
    padding: 15px 20px;
    margin: 0;
}

#changelist-filter h3 {
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 500;
    font-size: 12px;
    padding: 12px 20px;
    margin: 0;
}

#changelist-filter ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#changelist-filter li {
    border-bottom: 1px solid #f5f5f5;
}

#changelist-filter a {
    padding: 10px 20px;
    display: block;
    color: #000;
    text-decoration: none;
    font-weight: 400;
    font-size: 13px;
}

#changelist-filter a:hover {
    background: #fafafa;
}

#changelist-filter .selected {
    background: #000;
    color: #fff !important;
    font-weight: 400;
}

/* ==================== 日期选择器 ==================== */

.calendarbox {
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: none;
    border-radius: 2px;
}

.calendarbox caption {
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 400;
}

.calendarbox td a {
    color: #000;
    font-weight: 300;
}

.calendarbox td.today a {
    background: #000;
    color: #fff;
    font-weight: 400;
}

/* ==================== 时间选择器 ==================== */

.clockbox {
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: none;
    border-radius: 2px;
}

/* ==================== 错误提示 ==================== */

.errornote {
    background: #fff8f8;
    border: 1px solid #d32f2f;
    color: #d32f2f;
    padding: 15px 20px;
    border-radius: 2px;
    font-weight: 400;
}

.errorlist {
    color: #d32f2f;
    font-size: 12px;
    font-weight: 300;
    padding: 5px 0;
}

/* ==================== 成功提示 ==================== */

.messagelist {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    margin-bottom: 20px;
}

.messagelist li {
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    font-weight: 300;
}

.messagelist li.success {
    color: #4caf50;
}

.messagelist li.warning {
    color: #f57c00;
}

.messagelist li.error {
    color: #d32f2f;
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    #changelist thead th,
    #changelist tbody td {
        padding: 10px;
    }

    /* 列表页面响应式 */
    .changelist-content {
        flex-direction: column;
    }

    #changelist-filter {
        width: 100%;
        order: 1;
        margin-bottom: 20px;
    }

    .object-tools {
        flex-wrap: wrap;
    }

    /* 表格横向滚动 */
    #changelist table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 992px) {
    /* 中等屏幕 - 隐藏过滤器或调整布局 */
    #changelist-filter {
        position: static;
        width: 100%;
    }

    .changelist-content {
        flex-direction: column;
    }
}

/* ==================== 动画效果 ==================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-container {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== 工具类 ==================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.p-2 { padding: 16px; }

/* ==================== 对象工具 ==================== */

.object-tools {
    margin-bottom: 20px;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.object-tools li {
    display: inline-block;
    margin: 0;
}

.object-tools a {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* 列表页面的面包屑 */
.breadcrumbs {
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.breadcrumbs a {
    color: #1a1a1a;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}
