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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 登录页面 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-box h2 {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: normal;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.login-footer a:hover {
    text-decoration: underline;
}

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

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    height: 44px;
}

/* 移除日期和时间输入框的浏览器默认样式 */
.form-group input[type="date"],
.form-group input[type="time"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* 修复日期选择器图标样式 */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: opacity(0.6);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    filter: opacity(1);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-block {
    width: 100%;
    display: block;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

/* 提示信息 */
.alert {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 管理后台布局 */
.admin-layout {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    font-size: 24px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-user .btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
}

.admin-user .btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

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

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 16px;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
}

/* 管理区块 */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    color: #333;
    font-size: 22px;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th {
    background-color: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

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

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

/* 用户前台布局 */
.user-layout {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.user-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-header h1 {
    font-size: 24px;
}

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

.user-info .btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
}

.user-info .btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.form-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.form-card h2 {
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.records-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.records-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
}

/* 信息框 */
.info-box {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.info-box h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.info-box p {
    margin: 10px 0;
    color: #666;
}

.info-box ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-box code {
    background: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #667eea;
}

/* 设备管理特定样式 */
.data-table code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #667eea;
    word-break: break-all;
}

/* 表单卡片样式增强 */
.form-card input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.form-card label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination span.current {
    background: #667eea;
    color: white;
    border-color: #667eea;
    font-weight: 500;
}

/* 筛选表单样式 */
.filter-form label {
    font-size: 14px;
}

.filter-form input,
.filter-form select {
    font-size: 14px;
}

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

.vehicle-dropdown {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    flex-direction: column;
}

.vehicle-dropdown.show {
    display: flex !important;
}

.vehicle-dropdown input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.vehicle-dropdown input[type="text"]:focus {
    outline: none;
    background: #f8f9fa;
}

.vehicle-list {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.vehicle-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.vehicle-item:hover {
    background: #f8f9fa;
}

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

.vehicle-plate {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    margin-bottom: 4px;
}

.vehicle-info {
    font-size: 13px;
    color: #666;
}

/* 车辆选择器遮罩层 */
.vehicle-dropdown-backdrop {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.vehicle-dropdown-backdrop.show {
    display: block !important;
}

/* 记录卡片样式 */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.record-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.record-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.record-vehicle {
    font-size: 18px;
    font-weight: 600;
}

.record-time {
    font-size: 14px;
    opacity: 0.95;
    font-weight: 500;
}

.record-card-body {
    padding: 20px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.record-label {
    color: #666;
    font-size: 14px;
}

.record-value {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.record-card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}

/* 代码标签样式 */
code {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #1565c0;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-header,
    .user-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .admin-user,
    .user-info {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .admin-container,
    .container {
        padding: 15px;
    }
    
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-card,
    .records-section {
        padding: 15px;
        margin: 10px 0;
    }
    
    .data-table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 5px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start !important;
    }
    
    .section-header > div {
        width: 100%;
    }
    
    .section-header form {
        width: 100%;
    }
    
    .section-header input[type="text"] {
        width: 100% !important;
        max-width: 100%;
    }
    
    /* 车辆选择器移动端优化 */
    .vehicle-dropdown.show {
        display: flex !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 400px !important;
        max-height: 80vh !important;
        z-index: 9999 !important;
        margin: 0 !important;
        border-radius: 10px !important;
    }
    
    .vehicle-dropdown input[type="text"] {
        font-size: 16px !important;
        padding: 15px !important;
    }
    
    .vehicle-list {
        max-height: calc(80vh - 60px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .vehicle-item {
        padding: 15px !important;
        min-height: 60px !important;
    }
    
    .vehicle-plate {
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    
    .vehicle-info {
        font-size: 14px !important;
        margin-top: 5px;
    }
    
    /* 修复车辆选择显示输入框 */
    .vehicle-select-wrapper input#vehicle_display {
        font-size: 16px !important;
    }
    
    /* 登录页面移动端优化 */
    .login-box,
    .login-card {
        width: 95%;
        padding: 25px 20px;
    }
    
    /* 记录卡片移动端优化 */
    .records-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .record-card-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .record-card-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* 底部版权移动端优化 */
    footer {
        margin-top: 20px !important;
        padding: 15px 10px !important;
    }
    
    /* 移除不必要的底部边距 */
    body {
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

