* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    padding: 10px;
    color: #1a202c;
}

.container {
    max-width: 3000px;
    height: calc(100vh - 20px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.6em;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

.main-content {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.panel {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-title {
    font-size: 1.1em;
    color: #1a365d;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5282;
    font-weight: 600;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    height: 50%;
    min-height: 0;
}

.gps-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #00ff00;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gps-overlay i {
    font-size: 14px;
}

.gps-overlay.no-gps {
    color: #ff6b6b;
}

#videoElement {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 1;
    object-fit: contain;
}

#yoloCanvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
    object-fit: contain;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
}

.btn-primary {
    background: #2c5282;
    color: white;
}

.btn-primary:hover {
    background: #1a365d;
}

.btn-success {
    background: #2f855a;
    color: white;
}

.btn-success:hover {
    background: #276749;
}

.btn-danger {
    background: #c53030;
    color: white;
}

.btn-danger:hover {
    background: #9b2c2c;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #5a6b7a;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    color: #4a5568;
    font-weight: 500;
    font-size: 13px;
}

.input-group input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed #cbd5e0;
    border-radius: 4px;
    background: #f7fafc;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

.status {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
}

.status-ready {
    background: #c6f6d5;
    color: #22543d;
}

.status-analyzing {
    background: #fefcbf;
    color: #744210;
}

.status-error {
    background: #fed7d7;
    color: #742a2a;
}

.result-panel {
    background: #f7fafc;
    border-radius: 6px;
    padding: 15px;
    height: 20%;
    max-height: 20%;
    min-height: 100px;
    overflow-y: auto;
    flex-shrink: 0;
}

.result-text {
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #2d3748;
}

.settings-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #48bb78;
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.detection-info {
    background: #fff;
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
    font-size: 12px;
    max-height: 80px;
    overflow-y: auto;
}

/* 问题表格样式 */
.issues-panel {
    grid-column: 1 / -1;
}

.issues-table-container {
    overflow-x: auto;
    flex: 1;
    min-height: 0;
}

.issues-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.issues-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.issues-table th {
    background: #2c5282;
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #1a365d;
}

.issues-table td {
    padding: 8px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
    background: #fff;
}

.issues-table tbody tr:hover {
    background: #f0f4f8;
}

.issues-table .col-index {
    width: 50px;
    text-align: center;
}

.issues-table .col-date {
    width: 90px;
}

.issues-table .col-time {
    width: 80px;
}

.issues-table .col-location {
    width: 100px;
}

.issues-table .col-case-type {
    width: 90px;
}

.issues-table .col-project {
    width: 120px;
}

.issues-table .col-issue-type {
    width: 100px;
}

.issues-table .col-position {
    width: 80px;
}

.issues-table .col-deduction {
    width: 50px;
    text-align: center;
    font-weight: bold;
    color: #c53030;
}

.issues-table .col-reason {
    width: 150px;
    max-width: 150px;
    word-wrap: break-word;
}

.issues-table .col-district {
    width: 80px;
}

.issues-table .col-street {
    width: 80px;
}

.issues-table .col-image {
    width: 80px;
    text-align: center;
}

.issues-table .col-remark {
    width: 100px;
    max-width: 100px;
    word-wrap: break-word;
}

.issue-image-thumb {
    width: 70px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid #e2e8f0;
}

.issue-image-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

/* 图片弹窗 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-modal.active {
    display: flex;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.summary-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 10px 20px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #2c5282;
    font-weight: 500;
    flex-shrink: 0;
}

.summary-bar strong {
    color: #c53030;
}

/* 表格滚动条美化 */
.issues-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.issues-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.issues-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.issues-table-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 平板适配 - 保持电脑端布局，使用缩放适配 */
@media (max-width: 1200px) and (min-width: 769px) {
    html {
        zoom: 0.85;
    }
    
    .container {
        max-width: 98%;
        height: auto;
        min-height: calc(100vh - 20px);
    }
    
    .main-content {
        grid-template-columns: 35% 65%;
    }
    
    .issues-table {
        font-size: 11px;
    }
    
    .issues-table th,
    .issues-table td {
        padding: 6px 4px;
    }
}

/* 小屏幕适配 - 保持电脑端布局，使用缩放适配 */
@media (max-width: 768px) {
    html {
        zoom: 0.75;
    }
    
    .container {
        max-width: 99%;
        height: auto;
        min-height: calc(100vh - 10px);
    }
    
    .main-content {
        grid-template-columns: 35% 65%;
        gap: 10px;
    }
    
    .issues-table {
        font-size: 11px;
    }
    
    .issues-table th,
    .issues-table td {
        padding: 5px 3px;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    h1 {
        font-size: 0.95em;
    }
    
    h1 img {
        height: 25px !important;
    }
    
    .btn {
        padding: 8px 6px;
        font-size: 11px;
        min-width: 70px;
    }
    
    .video-container {
        min-height: 200px;
    }
    
    .toggle-container span {
        font-size: 12px;
    }
}

/* 报告弹窗样式 */
.report-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.report-modal.active {
    display: flex;
}

.report-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.report-modal-header {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: #fff;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-modal-header h3 i {
    font-size: 1.2em;
}

.report-modal-close {
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.report-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.report-modal-body {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: #f8fafc;
}

.report-modal-body::-webkit-scrollbar {
    width: 8px;
}

.report-modal-body::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 4px;
}

.report-modal-body::-webkit-scrollbar-thumb {
    background: #a0aec0;
    border-radius: 4px;
}

.report-modal-body::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.report-modal-footer {
    padding: 15px 25px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 报告内容样式 */
.report-content {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.report-content h1 {
    color: #1a365d;
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #2c5282;
}

.report-content h2 {
    color: #2c5282;
    font-size: 1.2em;
    margin: 20px 0 10px 0;
    padding: 8px 12px;
    background: linear-gradient(90deg, #e2e8f0 0%, transparent 100%);
    border-left: 4px solid #2c5282;
}

.report-content p {
    line-height: 1.8;
    color: #4a5568;
    margin: 10px 0;
}

.report-content .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.report-content .info-item {
    background: #f7fafc;
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 3px solid #2c5282;
}

.report-content .info-item strong {
    color: #1a365d;
    display: block;
    margin-bottom: 5px;
}

.report-content .issue-list {
    margin: 15px 0;
}

.report-content .issue-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.report-content .issue-item h3 {
    color: #c53030;
    font-size: 1em;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-content .issue-item h3 i {
    color: #c53030;
}

.report-content .issue-detail {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.report-content .issue-detail .detail-item {
    background: #f7fafc;
    padding: 8px 12px;
    border-radius: 4px;
}

.report-content .issue-detail .detail-item strong {
    color: #718096;
    font-size: 0.85em;
    display: block;
}

.report-content .issue-image {
    margin-top: 15px;
    text-align: center;
}

.report-content .issue-image img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: transform 0.2s;
}

.report-content .issue-image img:hover {
    transform: scale(1.05);
}

.report-content .summary-section {
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.report-content .summary-section h2 {
    background: none;
    border-left: none;
    padding-left: 0;
    color: #2b6cb0;
}

.report-content .summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 15px;
}

.report-content .summary-item {
    text-align: center;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.report-content .summary-item .number {
    font-size: 2em;
    font-weight: bold;
    color: #2c5282;
}

.report-content .summary-item .label {
    color: #718096;
    font-size: 0.9em;
    margin-top: 5px;
}

/* 图表样式 */
.report-content .charts-section {
    margin: 20px 0;
}

.report-content .charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.report-content .chart-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
}

.report-content .chart-container canvas {
    max-height: 300px;
}

.report-content .chart-title {
    text-align: center;
    font-size: 1em;
    color: #2c5282;
    margin-bottom: 15px;
    font-weight: 600;
}
