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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #333;
}

/* ===== 顶部状态栏 ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    background: #1a1a2e;
    color: #e0e0e0;
    flex-shrink: 0;
    z-index: 1000;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.status-item {
    font-size: 13px;
    color: #aaa;
}

.status-item strong {
    color: #e0e0e0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-right input {
    width: 220px;
    padding: 5px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a3e;
    color: #e0e0e0;
    font-size: 13px;
}

/* ===== 连接模式切换 ===== */
.conn-mode-group {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #444;
}

.mode-btn {
    padding: 4px 12px;
    background: #2a2a3e;
    color: #aaa;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.mode-btn:hover { color: #ddd; }

.mode-btn.active {
    background: #007aff;
    color: #fff;
}

.conn-mode-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    background: #2a2a3e;
    color: #888;
    white-space: nowrap;
}

/* ===== 标签 ===== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.tag-success { background: #f6ffed; color: #52c41a; }
.tag-danger  { background: #fff1f0; color: #ff4d4f; }
.tag-warning { background: #fffbe6; color: #faad14; }
.tag-info    { background: #e6f7ff; color: #007aff; }

/* ===== 按钮 ===== */
.btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn:not(:disabled):hover { opacity: 0.85; }

.btn-primary   { background: #007aff; color: #fff; }
.btn-success   { background: #52c41a; color: #fff; }
.btn-warning   { background: #faad14; color: #fff; }
.btn-danger    { background: #ff4d4f; color: #fff; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn.wide      { width: 100%; }

.btn-link {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
}

.btn-link:hover { color: #007aff; }

.btn-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.btn-group .btn { flex: 1; }

/* ===== 主内容区 ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ===== 地图 ===== */
.map-container {
    flex: 1;
    min-width: 0;
    z-index: 1;
}

/* ===== 右侧控制面板 ===== */
.control-panel {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-section {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.panel-header {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header span:last-child {
    font-weight: 400;
    font-size: 12px;
    color: #999;
}

/* ===== 航点列表 ===== */
.waypoint-list {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.empty-hint {
    text-align: center;
    color: #bbb;
    font-size: 13px;
    padding: 20px 0;
}

.wp-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.wp-item:hover { background: #e6f7ff; }

.wp-item.active { background: #e6f7ff; border: 1px solid #91d5ff; }

.wp-index {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #007aff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

.wp-info {
    flex: 1;
    min-width: 0;
}

.wp-coord {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-alt {
    font-size: 11px;
    color: #999;
}

.wp-delete {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.wp-delete:hover { color: #ff4d4f; }

.wp-params {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.wp-params input {
    width: 60px;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

/* ===== 数据面板 ===== */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.data-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.data-label {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}

.data-value {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* ===== 底部日志栏 ===== */
.log-bar {
    height: 120px;
    flex-shrink: 0;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    color: #888;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-entry {
    white-space: nowrap;
}

.log-entry .time { color: #666; margin-right: 8px; }
.log-entry.success { color: #52c41a; }
.log-entry.error   { color: #ff4d4f; }
.log-entry.warning { color: #faad14; }
.log-entry.info    { color: #aaa; }

/* ===== Leaflet 自定义 ===== */
.drone-icon {
    width: 24px;
    height: 24px;
    position: relative;
}

.drone-icon-inner {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 20px solid #007aff;
    position: absolute;
    top: 2px;
    left: 2px;
    transform-origin: center 60%;
}
