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

/* 隐藏元素 */
.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

/* 头部导航栏 */
.header {
    background-color: #0077be;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#userInfo {
    font-size: 0.9rem;
    color: white;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

/* 主内容区域 */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* 统计图表区域 */
.statistics-section {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

.statistics-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    color: #333;
}

.statistics-section canvas {
    max-width: 100%;
    height: auto;
}

/* 功能入口卡片 */
.function-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.8rem;
}

.card-icon.violation {
    background-color: #ffebee;
    color: #e53935;
}

.card-icon.device {
    background-color: #e3f2fd;
    color: #1976d2;
}

/* 积分排行榜 */
.points-ranking-container {
    margin-top: 1rem;
}

.points-ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.points-ranking-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.points-ranking-item:hover {
    background-color: #f5f5f5;
}

.points-ranking-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.points-ranking-rank.gold {
    background-color: #ffd700;
    color: white;
}

.points-ranking-rank.silver {
    background-color: #c0c0c0;
    color: white;
}

.points-ranking-rank.bronze {
    background-color: #cd7f32;
    color: white;
}

.points-ranking-rank.normal {
    background-color: #e0e0e0;
    color: #333;
}

.points-ranking-info {
    flex: 1;
}

.points-ranking-nickname {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.points-ranking-phone {
    font-size: 0.9rem;
    color: #666;
}

.points-ranking-points {
    font-weight: bold;
    font-size: 1.2rem;
    color: #0077be;
}

.card-icon.touching {
    background-color: #fce4ec;
    color: #c2185b;
}

.card-icon.records {
    background-color: #e8f5e9;
    color: #388e3c;
}

.card-icon.points {
    background-color: #fff9c4;
    color: #fbc02d;
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.card p {
    font-size: 0.8rem;
    color: #666;
}

/* Custom menu card styles - higher specificity */
.card.custom-card .custom-card-icon {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 1rem !important;
    font-size: 1.8rem !important;
    background-color: #e3f2fd !important;
    color: #1976d2 !important;
}

.card.custom-card .custom-card-title {
    text-align: center !important;
    margin-bottom: 0.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.card.custom-card .custom-card-desc {
    text-align: center !important;
    color: #666 !important;
    font-size: 0.8rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

/* 底部信息 */
.footer {
    background-color: #f5f5f5;
    color: #666;
    text-align: center;
    padding: 1rem 0;
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

/* 表单样式 */
.form-container {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #e74c3c;
}

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

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.btn-primary {
    background-color: #e74c3c;
    color: white;
}

.btn-primary:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-block {
    width: 100%;
}

/* 图片上传区域 */
.image-upload-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.image-upload {
    width: 100px;
    height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.image-upload:hover {
    border-color: #e74c3c;
}

.image-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-preview,
.video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #e53935;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    transition: all 0.2s ease;
}

.image-delete-btn:hover {
    background-color: #e53935;
    color: white;
    transform: scale(1.1);
}

.image-upload.has-image {
    border-style: solid;
    border-color: #e74c3c;
}

/* 车牌输入特殊样式 */
.license-plate-container {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.license-plate-container input {
    width: 40px;
    text-align: center;
    font-weight: 600;
}

/* 选择器样式 */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    background-image: 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 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }

    .function-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .card {
        padding: 1rem 0.75rem;
    }

    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .form-container {
        padding: 1rem;
    }
}

/* 位置选择器样式 */
.location-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.location-selector select, .location-selector input {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.location-selector select:focus, .location-selector input:focus {
    outline: none;
    border-color: #e74c3c;
}

.location-display {
    padding: 0.75rem;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    text-align: center;
    border: 1px solid #ddd;
}

/* 记录列表样式 */
.records-list {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

.record-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

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

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.record-title {
    font-weight: 600;
    color: #333;
}

.record-date {
    font-size: 0.8rem;
    color: #666;
}

.record-content {
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 0.5rem;
}

.record-images {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.report-media {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    object-fit: cover;
}

.report-video {
    background-color: #000;
}

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

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pagination button:hover {
    background-color: #f5f5f5;
}

.pagination button.active {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* 顶部导航返回按钮 */
.nav-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: #0077be;
    color: white;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-header .back-btn {
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    background: none;
    border: none;
}

.nav-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* 错误提示 */
.error-message {
    background-color: #ffebee;
    color: #e53935;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* 成功提示 */
.success-message {
    background-color: #e8f5e9;
    color: #388e3c;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* 车牌选择弹出框 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    display: none;
}

.popup-overlay.show {
    display: flex;
}

.license-plate-popup {
    background-color: white;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

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

.popup-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

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

.close-popup:hover {
    background-color: #f5f5f5;
    color: #333;
}

/* 键盘样式 */
.keyboard {
    margin-bottom: 1.5rem;
}

.keyboard-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.key {
    width: 3rem;
    height: 3rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.key:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.key:active {
    background-color: #dee2e6;
    transform: translateY(0);
}

.delete-key {
    width: 6.5rem;
    background-color: #ffebee;
    color: #c62828;
    border-color: #f8bbd0;
}

.delete-key:hover {
    background-color: #ffcdd2;
    border-color: #f48fb1;
}

/* 确认按钮区域 */
.confirm-section {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.btn-confirm {
    flex: 1;
    background-color: #0077be;
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-confirm:hover {
    background-color: #005a8c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 119, 190, 0.3);
}

.btn-confirm:disabled {
    background-color: #a0c4db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-cancel {
    flex: 1;
    background-color: white;
    color: #666;
    border: 1px solid #ddd;
    padding: 0.875rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background-color: #f5f5f5;
    border-color: #c0c0c0;
}

/* 车牌预览区域 */
.license-preview {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.license-preview-text {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.3rem;
    color: #333;
    font-family: monospace;
}

/* 车牌输入区域样式优化 */
.license-plate-inputs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.license-plate-inputs:hover {
    border-color: #0077be;
}

.license-plate-inputs input {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 2px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.new-energy-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f5f5f5;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.new-energy-btn.active {
    background-color: #0077be;
    color: white;
    border-color: #0077be;
}

/* 微信定位按钮样式 */
.location-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.location-input-group input {
    flex: 1;
}

.wx-location-btn {
    padding: 0.75rem 1rem;
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wx-location-btn:hover {
    background-color: #06ad56;
}

.wx-location-btn:disabled {
    background-color: #9de5b5;
    cursor: not-allowed;
}

/* 微信授权按钮样式 */
.phone-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.phone-input-group input {
    flex: 1;
}

.wx-auth-btn {
    padding: 0.75rem 1rem;
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wx-auth-btn:hover {
    background-color: #06ad56;
}

.wx-user-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #e8f5e9;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #2e7d32;
}

.wx-logout-btn {
    padding: 0.25rem 0.75rem;
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wx-logout-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}