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

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 顶部标题 */
.header {
    background: linear-gradient(135deg, #1a7a3e 0%, #0f5028 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
}

.header h1 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 1px;
}

/* 主内容区域 */
.main-content {
    display: flex;
    gap: 0;
    min-height: 700px;
}

/* 左侧面板 */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
}

/* Canvas容器 */
.canvas-container {
    flex: 1;
    padding: 10px 10px 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#table-canvas {
    border: 3px solid #8B4513;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: #1a7a3e;
    cursor: default;
}

/* 球形参考 */
.ball-reference {
    background: #ffffff;
    border-top: 2px solid #e0e0e0;
    padding: 0;
    max-height: 450px;
    overflow-y: auto;
}

.ball-reference-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ball-reference-header h3 {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.add-reference-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.add-reference-btn:hover {
    background: #5568d3;
}

.ball-reference-list {
    padding: 15px;
    background: #f8f9fa;
}

/* 滚动条样式 */
.ball-reference::-webkit-scrollbar {
    width: 6px;
}

.ball-reference::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.ball-reference::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 3px;
}

.ball-reference::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* 球类型分组样式 */
.ball-type-group {
    margin-bottom: 18px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ball-type-group:last-child {
    margin-bottom: 0;
}

.ball-type-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: white;
    border-left: 5px solid;
    border-bottom: 1px solid #f0f0f0;
}

.ball-type-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.ball-type-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.ball-type-count {
    font-size: 11px;
    color: #7f8c8d;
    background: #ecf0f1;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* 收藏项样式 */
.favorite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

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

.favorite-item:hover {
    background: #f5f5f5;
}

.favorite-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s;
}

.favorite-thumbnail:hover {
    transform: scale(1.05);
}

.favorite-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.favorite-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.favorite-name {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-angle {
    font-size: 11px;
    color: #7f8c8d;
    line-height: 1.3;
}

.favorite-time {
    font-size: 10px;
    color: #95a5a6;
}

.favorite-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

.favorite-actions button {
    padding: 5px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.favorite-load-btn {
    background: #3498db;
    color: white;
}

.favorite-load-btn:hover {
    background: #2980b9;
}

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

.favorite-delete-btn:hover {
    background: #c0392b;
}

/* 导出按钮样式 */
.export-btn-container {
    margin-bottom: 12px;
}

.export-json-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.export-json-btn:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    box-shadow: 0 3px 8px rgba(39, 174, 96, 0.4);
}

/* 空状态样式 */
.favorites-empty {
    text-align: center;
    padding: 40px 20px;
    color: #adb5bd;
}

.favorites-empty p {
    margin: 8px 0;
}

.favorites-empty p:first-child {
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
}

/* 控制面板 */
.control-panel {
    width: 420px;
    background: #fafafa;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    max-height: 800px;
}

.panel-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.panel-section h3 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

/* 瞄准示意图 */
.aim-guide-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

#aim-guide-canvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

/* 角度信息 */
.angle-info {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

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

.info-item .label {
    font-weight: bold;
    color: #666;
    font-size: 14px;
}

.info-item .value {
    color: #333;
    font-weight: bold;
    font-size: 14px;
}

/* 袋口选择 */
.pocket-grid-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pocket-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.pocket-btn {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
}

.pocket-btn:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.pocket-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 预设场景 */
.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scenario-btn {
    padding: 10px 15px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.scenario-btn:hover {
    background: #1a7a3e;
    color: white;
    border-color: #1a7a3e;
}

/* 显示选项 */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.toggle-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-item:hover {
    color: #333;
}

/* 使用说明 */
.instructions {
    font-size: 13px;
    line-height: 1.8;
    color: #666;
}

.instructions p {
    margin-bottom: 8px;
    padding-left: 5px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
    }

    .control-panel {
        width: 100%;
        max-height: none;
        border-left: none;
        border-top: 1px solid #ddd;
    }

    .canvas-container {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

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

    .header {
        padding: 20px 15px;
    }

    .canvas-container {
        padding: 15px;
    }

    .panel-section {
        padding: 15px;
    }

    #table-canvas {
        max-width: 100%;
        height: auto;
    }
}

/* 滚动条样式 */
.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}
